Record time of last update request even if there are no changes

TLDR: Add a timestamp for the last sensor update to allow availability checking when state changes are rare.

I believe the rationale is obvious. Any battery powered, wireless, or mobile device can loose their connection to HA. Currently the only way to check is using the last_updated (or last_changed) timestamps.
For rapidly changing sensors like power usage this is not an issue as the last_updated attribute would be equivalent to this. But some sensors only change a few times per day or in the worst case stay constant for many days.

Another use case is interpolation in history graphs. Interpolating electricity or gas usage is impossible for intermittent consumers like heaters or ovens, because the long off-period is only marked by one data point at the start.

Some integrations already provide a similar mechanism themselves (like zigbee2mqtt’s …_last_seen), but why is it not a general feature of every sensor?

Having a brief look at the code it does not seem impossible to implement (looking at Sensor.async_set), but I would like some feedback before working on a pull request that will never be accepted.

Closed as a duplicate. Please search before posting. You can vote and comment here:

https://community.home-assistant.io/t/add-a-last-refreshed-to-complement-last-changed-and-last-updated/620462