I have a ESPHome display to show my current energy values.
Now I have the problem, that my battery chargers change from x to 0 W, when the charging is done. My display does not always got this update to 0 W. So the old value is still showing. It seems, that home assistant does not send a refresh of the values, because they are no more changing.
At the moment I try the timeout filter. But this will also switch to 0 W even the charger is on, when the value is not changed.
Are you using mqtt or the native api? The later should work with local push in both ways afaik and the expected behavior is the moment a value changes in HA it should be immediately pushed to the esphome node
As you can see in the code above, I use the native API.
In 90% of the cases, the values are pushed to my ESP immediately. But in 10% they are lost in my network. I do not know why. Maybe because of bad WiFi of the ESP. This is normally not bad because when next value update works correct.
But if the value in home assistent do not change anymore, there is no refresh or repush of this value. If this value does not receive the ESP, it will always shown the old value. This is my issue.
With the timeout filter I can fix this behavior when it change to 0. But if it stays on one other value for more then 120 seconds (see my code above) it changes also to 0. I want to force push the value to the ESP even it do not change.
You should be able to figure this out easily. Monitor the wifi signal and api status of your esphome node to have an idea how bad (or hopefully good) your infrastructure is.
That’s indeed the expected behavior of local push.
One way to force the esphome node to receive the value again from HA is probably a restart
I wouldn’t go that far to restart the node. Seems a bit drastic.
As a workaround you could setup a service on the node and an automation in HA, that runs every X minutes and calls that service. See the second example here.
Or you could just check on the node if the api is connected (or maybe re-connected) and react on that like sending the value with the above method or start a new poll for the state. Should work equally well. See here.
Or use the wifi_connected condition to see, if there are any connection problems. That would be here.