Hello,
I use ESPHome to create sensor “base” from Linky, the issue is when I restart HA or the ESP the value become unavailable and HA record a crazy value at this moment in the “sensor.energy_total_daily”.
Is there a solution to avoid this issue, by example save the last value when unavailable ?
PS : Impossible to use “restore_mode: RESTORE_LAST_VALUE” in ESPHome for my sensor.
Alot of people have been searching for the answer to this using the API. Much easier to fix if you use mqtt instead. In mqtt you just make sure the birth and last will topics are different. The value of sensor doesn’t change until device comes back available and sends a new value.
mqtt:
# ...
birth_message:
topic: myavailability/topic
payload: online
will_message:
topic: myavailability/anything as long as it's not topic
payload: offline