ESPHome devices are expected to be connected for most of the time and start rebooting when that is not the case (WiFi down, no API connectivity, no connection to MQTT server, …). But what if being ‘offline’ is the expected situation, and ‘online’ the exception? How can ESPHome powered devices be configured to gracefully handle offline situations without constantly rebooting?
Yes, there is the option of preventing rebooting (
reboot_timeout: 0s), but that has significant side effects and may cause the device to become unresponsive or never again connect. So, what are the best practices for dealing with a situation like this? Ideally, ESPHome devices do their thing while being offline without complaints, and gracefully reconnect whenever WiFi becomes available.
What is the use case, you ask? I’m running Home Assistant in an RV. When the RV is in storage, I do not want to run HA, my ethernet switch, WIFI router, and LTE modem 24/7 because that consumes way too much energy. Instead, all these devices will be turned off for, say 20 hours per day, and on for only 4 hours, so I can remotely monitor battery, systems, perform maintenance, etc. All my ESPHome devices still get power, including the ESPHome relay (Shelly 1) that is programmed as a timer and shuts down HA at predefined times for a predefined duration.