Hello, I reboot by wifi router every night and it messes up sensors. HA becomes unavailable and the ESPhome sensor does not go to deep sleep because it is connecting to wifi, or MQTT, or HA, or creates AP and drains the battery.
Is it possible to check connection to wifi or MQTT broker and if either of that is not accessible, then go to deep sleep and try at next run?
Why not fix or replace your router?
Thank you tom. I like the router, it just somehow gets stuck after few days, so I better reboot it regularly. I would like to come up with systematic approach that whole life of low power sensors is not dependent on one-time wifi inaccessibility. Instead of buying new router, I can use LoRa radio node v1.0 for $12 and lora-mqtt gateway, which will not suffer with this problem, takes 76uA and works well outside of wifi. But I still want to make ESPhome sensors better
It shouldn’t be getting stuck. Find and fix the problem rather than the symptom. It’s probably an IP lease issue, and you running out of addresses.
Try setting static ips for all devices and ensure IP address pool is large enoigh
Hello I use static IP. I think the problem is here - when not connected for 5 min, the sensor can only reboot, but not go to deep sleep. It could be great if I can create lambda that checks for reset cause and if it is not timer boot then goes to deep sleep. But I am afraid that esp8266 cannot distinguish between software reset and deep-sleep wakeup…
there’s not much to like then!
So this only happens when the esp wakes up when the router is rebooting?