New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connectivity: POST /setup/scan_wifi and GET /setup/scan_results #22

Closed
vaguerant opened this Issue Jan 23, 2018 · 10 comments

Comments

Projects
None yet
3 participants
@vaguerant
Copy link

vaguerant commented Jan 23, 2018

Found this endpoint on this webpage about sniffing traffic on a Chromecast. It works on the Home, too. On that page it's documented as "scan for available wifi" but the result I get from the request only shows one AP, the one the device is currently connected to (there are others in range). I'm not sure what to make of this.

I think everything else on that page is either already documented or doesn't work on Homes.

@vaguerant

This comment has been minimized.

Copy link

vaguerant commented Jan 24, 2018

Aha. Pulling from here, I see there's a /setup/scan_wifi. And from here, I see that it takes an empty POST request. After doing a POST /setup/scan_wifi, GET /setup/scan_results is now showing all the wifi networks in my area.

I'm guessing this is completely unused behavior, the device should never have any reason to scan for its own wifi as far as I can tell since it's just told by the Home app what network to connect to.

@vaguerant

This comment has been minimized.

Copy link

vaguerant commented Jan 24, 2018

Sorry for the commentspam, edit field seems to be playing up for me. The Home seems to forget the results of the wifi scan after roughly (exactly?) three minutes. When I checked the results again after making the previous comment, they were back to just listing the connected AP. So I did another POST /setup/scan_wifi and sat running GET /setup/scan_results for the next three minutes until it stopped showing all the other networks.

@vaguerant vaguerant changed the title Connectivity: GET /setup/scan_results Connectivity: POST /setup/wifi_scan and GET /setup/scan_results Jan 24, 2018

@vaguerant vaguerant changed the title Connectivity: POST /setup/wifi_scan and GET /setup/scan_results Connectivity: POST /setup/scan_wifi and GET /setup/scan_results Jan 24, 2018

@vaguerant

This comment has been minimized.

Copy link

vaguerant commented Jan 24, 2018

More commentspam: there's also POST /setup/save_wifi, found here. No idea what you'd do with it, sorry.

An interesting note on that page is the comment mentioning "debug view" in the Chromecast app if you tap Apps 7 times. I wonder if there's anything similar in the Home app.

@rithvikvibhu

This comment has been minimized.

Copy link
Owner

rithvikvibhu commented Feb 7, 2018

Not spam if it's adding more info 😉 Will add it and try to find more on it

@rithvikvibhu

This comment has been minimized.

Copy link
Owner

rithvikvibhu commented Feb 7, 2018

Okay things are slightly different for me. /setup/scan_results takes slightly longer to respond (compared to other endpoints) and always returns a list of all APs in range. I didn't have to send the POST request before. Something must've changed in 2 weeks.

@vaguerant can you try this again?

rithvikvibhu added a commit that referenced this issue Feb 7, 2018

@brannondorsey

This comment has been minimized.

Copy link

brannondorsey commented Apr 18, 2018

I can confirm that GET /setup/scan_results seems to behave similarly for me as it does for @vaguerant. If the chromecast has been running for a while it only has the network it has connected to in /setup/scan_results. But if I reboot or POST /setup/scan_wifi it has a full list.

@rithvikvibhu

This comment has been minimized.

Copy link
Owner

rithvikvibhu commented Apr 20, 2018

Looks like I'll be taking another look at this. Thanks for trying it out @brannondorsey!

@rithvikvibhu

This comment has been minimized.

Copy link
Owner

rithvikvibhu commented Jun 12, 2018

@brannondorsey Sorry about the delay. I still get all APs at GET /setup/scan_results even after a few minutes.

Are you using a Chromecast or a Google Home? Things might be a bit different.

@brannondorsey

This comment has been minimized.

Copy link

brannondorsey commented Jun 12, 2018

No problem. I'm using Chromecast. I can't remember off hand, but it may be the case that the cache persists for a few minutes. After an extended period of time mine clears the cache and the only available network is the one the device is connected to. What kind of results do you get after 30 minutes or an hour?

@rithvikvibhu

This comment has been minimized.

Copy link
Owner

rithvikvibhu commented Jun 15, 2018

So I guess it's slightly different for Google Home because I tried getting scan results (without scanning first) and it always listed the APs. Good to know.

rlaneth added a commit to radialle/cast-toolkit that referenced this issue Jan 16, 2019

Update ct-locate.py
The Chromecast does not need to be restarted for the /setup/scan_results endpoint to return a full list of nearby Wi-Fi networks — the /setup/scan_wifi endpoint may be called instead, as described on rithvikvibhu/GHLocalApi#22 (thanks @Theldus for pointing it out!)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment