hatasmota
hatasmota copied to clipboard
Sensors with deep-sleep operations are mostly unavailable
Improvement-Request
I have a couple of Tasmota-based sensors that transmit values on MQTT every 5 minutes and are powered down otherwise. The current integration recognizes these and detects them for home assistant, but any sensor entity does only display the value for 5-10 seconds. As soon as the device writes the LWT to offline, everything shows only "unavailable".
From the MQTT-side the Tasmota behaviour is correct, LWT tells listeners that the device will not respond. In HA otherwise it should be clear that the sensor is functioning normally, only if it does not update for more than 2*deep_sleep_time it could be considered really unavailable.
This is not only a problem for me but has been discussed on some forums: The suggested workaround is, to configure a manual MQTT device and not use the Tasmota integration :-(
As the code in this project is generating the MQTT interactions and the status updates (available , unavailable) it should be addressed in this code.
Features:
- Deep sleep setup of sensors should be detected in Homeassistant (e.g. ESP last wakeup reason in /stat/$dev/STATUS1 or /tele/$dev/DEEPSLEEP)
- If deep sleep is detected, the availability should not go to unavailable on LWT=offline
- optional: there could be a timer triggered on LWT offline to mark the entities unavailable, if they are not alive for more than the usual deep-sleep period: ** this means HA must recognize the wakeup and deep-sleep and measure the usual sleep period ** the last wakeup is remembered ** the timer marks the device dead, after last-wakeup+deepsleep*safeftyfactor, if the device did not show up in between