Add a last_refreshed to complement last_changed and last_updated

From the State Objects documentation:

Field Description
state.last_updated Time the state was written to the state machine in UTC time. Note that writing the exact same state including attributes will not result in this field being updated. Example: 2017-10-28 08:13:36.715874+00:00.
state.last_changed Time the state changed in the state machine in UTC time. This is not updated when there are only updated attributes. Example: 2017-10-28 08:13:36.715874+00:00.

Often people are confused by this as they expect “last updated” to show when the state/attributes were fetched, regardless of whether new data was written to the state machine.

I propose adding last_refreshed as follows:

Field Description
state.last_updated Time the state was written to the state machine in UTC time. Note that writing the exact same state including attributes will not result in this field being updated. Example: 2017-10-28 08:13:36.715874+00:00.
state.last_refreshed Time the state was written to the state machine in UTC time. Writing the exact same state including attributes will result in this field being updated. Example: 2017-10-28 08:13:36.715874+00:00.
state.last_changed Time the state changed in the state machine in UTC time. This is not updated when there are only updated attributes. Example: 2017-10-28 08:13:36.715874+00:00.

This would primarily be useful for integrations that are cloud/local polling to understand the freshness of the data. Obviously it would also make sense to expose this in the UI alongside last changed and last updated and to allow it to be used as a trigger.

Many thanks,
Tom

Don’t forget to vote for your own request.

I had the same request, thanks tom_l for helping me find this one.
I made a very basic request on github with the required changes in core.State.
No Idea if this will be accepted, I am not a core developer.