{"action":"created","issue":{"url":"https://api.github.com/repos/micropython/micropython/issues/2996","repository_url":"https://api.github.com/repos/micropython/micropython","labels_url":"https://api.github.com/repos/micropython/micropython/issues/2996/labels{/name}","comments_url":"https://api.github.com/repos/micropython/micropython/issues/2996/comments","events_url":"https://api.github.com/repos/micropython/micropython/issues/2996/events","html_url":"https://github.com/micropython/micropython/issues/2996","id":219447785,"number":2996,"title":"ESP8266/ESP32 wlan.scan('myssid')","user":{"login":"pacmac","id":2349856,"avatar_url":"https://avatars1.githubusercontent.com/u/2349856?v=3","gravatar_id":"","url":"https://api.github.com/users/pacmac","html_url":"https://github.com/pacmac","followers_url":"https://api.github.com/users/pacmac/followers","following_url":"https://api.github.com/users/pacmac/following{/other_user}","gists_url":"https://api.github.com/users/pacmac/gists{/gist_id}","starred_url":"https://api.github.com/users/pacmac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pacmac/subscriptions","organizations_url":"https://api.github.com/users/pacmac/orgs","repos_url":"https://api.github.com/users/pacmac/repos","events_url":"https://api.github.com/users/pacmac/events{/privacy}","received_events_url":"https://api.github.com/users/pacmac/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-04-05T02:33:11Z","updated_at":"2017-04-05T09:15:51Z","closed_at":null,"body":"Hi;\r\n\r\nPresently, the only way I know to get the connection info (i.e. RSSI) is to perform a network scan() and then loop  through all the results searching for a known SSID and parse the values.\r\n\r\nThis takes valuable time when running on battery power and is not very efficient, it also requires that you need to pass the SSID to your function in order to extract the correct record, rather than being able to simply get the 'connected ssid'.\r\n\r\nI notice that the API (wifi_station_scan) supports providing the ssid variable with the scan, i'e scan('my-ssid') however the micropython implementation does not. This may help speed up the scan process and reduce the scan time and complexity of the code needed to extract the required data.\r\n\r\nWould it be possible to enhance the present design to:\r\n\r\n1) Add the option of passing the ssid to the scan function: wlan.scan('my-ssid')\r\n2) Add the option of scanning the connected SSID wlan.scan(wlan.CONNECTED_SSID)\r\n\r\nMany Thanks\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/micropython/micropython/issues/comments/291802502","html_url":"https://github.com/micropython/micropython/issues/2996#issuecomment-291802502","issue_url":"https://api.github.com/repos/micropython/micropython/issues/2996","id":291802502,"user":{"login":"pacmac","id":2349856,"avatar_url":"https://avatars1.githubusercontent.com/u/2349856?v=3","gravatar_id":"","url":"https://api.github.com/users/pacmac","html_url":"https://github.com/pacmac","followers_url":"https://api.github.com/users/pacmac/followers","following_url":"https://api.github.com/users/pacmac/following{/other_user}","gists_url":"https://api.github.com/users/pacmac/gists{/gist_id}","starred_url":"https://api.github.com/users/pacmac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pacmac/subscriptions","organizations_url":"https://api.github.com/users/pacmac/orgs","repos_url":"https://api.github.com/users/pacmac/repos","events_url":"https://api.github.com/users/pacmac/events{/privacy}","received_events_url":"https://api.github.com/users/pacmac/received_events","type":"User","site_admin":false},"created_at":"2017-04-05T09:15:51Z","updated_at":"2017-04-05T09:15:51Z","body":"Thanks for the comprehensive reply.\r\n\r\nI have checked before, and my conclusion was that there is no way to get the connection status directly from the connection and that a scan() is necessary.\r\n\r\nI was just trying to make that scan() more efficient / faster by only scanning for the connected  SSID.\r\n\r\nBut I have to admit that I did not consider compatibility for all the other devices, would it not be possible to allow this option only if the device supports it ?\r\n\r\nAn alternative for devices that don't support this might be to scan for all ssids and filter / return the connected one by looping through the ssids, this would effectively be no slower that having to do the same thing in code on devices that don't support the feature but hopefully faster for those that do ?\r\n\r\nAs you know battery charge is precious, and just saving 2 seconds during a wake up can have a dramatic positive effect on the battery life ;-)\r\n\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"pacmac"}}