It sounds like the new last_reported would solve this but from cursory testing ESPHome sensors seem to operate in one of two modes:
Don’t update Home Assistant if the sensor value didn’t change
Set force_update which updates Home Assistant on every sensor update while ALSO setting the force_update flag on Home Assistant.
It seems like with the new option there needs to be a 3rd choice of “always notify Home Assistant on sensor read but don’t set the force_update flag” so that the last_updated field on the sensor can be correctly incremented.
OR I’m missunderstanding how it all works and need to tweak something else
I have just spent the morning looking at this problem when using statistics integration and no change in state creating unknown … to solve I used the “old” method of template trigger and timestamp … which works … but now find I could have done this another way … will fiddle more and report!! Thank you for pointing out and asking
Setting force_update on my ESPHome sensors solves the statistics integration problem as well but I’m pretty sure that is going down the anti-pattern of writing an event to the DB every interval.
Querying the HA Database directly makes it look like last_reported is not currently working with the ESPHome Integration. The last_reported field for a sensor who’s value doesn’t change is only incremented when force_update is set.
Digging through the code I’m thinking this is an issue in the ESPHome Integration vs the ESPHome Addon/Device code.