I have an espdevice which tracks the power consumption and everything seems to work fine, except that the battery fails unexpectedly. Since I can not add a monitor the battery I wanted to track the last update of the sensor.
Is there a way to set a timestamp of the last update es value to use in an automation ?
Thanks for the suggestion, however I am thinking of using deep sleep in the future which would mean I get an offline every time the sensor goes to sleep. Therefor I thought I could somehow access the information when the data was last updated, e.g. as
in the history.
You can access that information,
states.<sensor_name>.last_updated, states.<sensor_name>.last_changed
Be aware though if you use it to create a sensor or a trigger, it wont update on its own, you might need to create an automation to trigger its updates. As a condition it works fine. You should also use defaults as using the states entries, they arent well filtered so can cause non-expected data types.
People probably wont like this solution, but I use it for exactly what you want and I dont believe there are other good options.