-
Notifications
You must be signed in to change notification settings - Fork 36
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
Some devices don't drop into LAN mode automatically after boot with no internet #8
Comments
So, I opened this in the hope of working with @tiagoboldt to do a bit of trial and error with his device (as I don't own an S20 yet). I believe there's a chance we may be able to write code to programmatically force the device into LAN mode by telling it to use an invalid server URL. Here are instructions copied from several repos: sonoff-server, simple-sonoff-server, SonOTA and this blog post, to configure your device to connect to a different URL for the "cloud" server:
The device will automatically drop out of AP mode and attempt to connect to the WiFi and server IP provided. Now, I'm not sure what happens if you follow these instructions successfully but configure the device with a nonsense / unreachable server IP. It's possible the firmware just gives up and falls back to a hard-coded cloud hostname (e.g. coolkit.cc) if it can't connect to the specified address. However, there's also a chance that it might fall back to LAN mode! So, here's hoping 😄 |
great work @beveradb please keep it going as i would love to borrow some of the code 😊 now i know this add a lot of complexity (and packages) to this whole (again crazy/stupid) idea but i'm thinking that in the future, by merging both of our work, i could do something like this: pull sonoff device list from cloud, check their connectivity (this assumes that HA has a connection to the internet), try to find their current local IP addresses using the device MAC address, cut their internet connection via software (and try to keep it like this) in order to drop to LAN mode, control & query their state exclusively via local network using your implementation. i'll try a POC these days to see if it's even remotely doable 😅 |
Hey guys, I won't be able to help. I've opened my S20 and flashed it "manually". Keep it up :) |
Cheers @peterbuga - you're of course welcome to use anything of value. Your websocket client implementation was very helpful to me as a starting point for the test scripts I implemented yesterday. One of them is a very basic mock Sonoff device, allowing me to test my own LAN mode client until I have access to an original firmware Sonoff again 😄 That's a really interesting idea for sure - performing an ARP poisoning attack against the device to break its connectivity could actually work pretty well, and would certainly be more flexible as it would in theory be able to enable/disable at will programmatically, enabling the "best of both worlds" cloud + local implementation you're keen on. Unfortunately, we wouldn't be able to do that from HomeAssistant though, as you'd need root access to send the required ARP packets. I'm still keen to try the instructions above with a real device to see if it's at least possible to get a device to stay in LAN mode permanently, for users of this repo. If not, I'll probably go ahead and implement an ARP poisoning Hass.io add-on! |
Report from user with S20, firmware 2.6.1:
"When I plug it in and internet access is blocked, mine keeps blinking once every couple of seconds, trying to connect to the internet. This goes on forever. A few seconds after unblocking its internet traffic, it stops blinking and fixes the green LED. Some minutes after I block the internet connectivity again, it drops to lan mode. So this one requires internet access to set itself up before being able to drop to lan mode. :/"
Originally posted by @tiagoboldt in #4 (comment)
The text was updated successfully, but these errors were encountered: