I have a temperature sensor - sensor.lounge.temperature - when I put it into an entity card it offers me the secondary value of "last updated" which is the value that I need. However, in the sensor, that value doesn't exist. AI led me to try {{ as_timestamp(states.sensor.lounge.temperature.last_updated) }} but that doesn't work. Grateful for any advice on how to get that "last updated" value please.
#Getting last updated from a sensor
1 messages · Page 1 of 1 (latest)
- i doubt you have a sensor called
sensor.lounge.temperature, as that's not possible. maybesensor.lounge_temperature? last_updatedis a property of the state object. so that would be{{ as_timestamp(states.sensor.lounge_temperature.last_updated) }}
You're corect - that was a typo. Sorry.
I'll give that a go and see where I get! Thank you
This is working... to a point. If there is no change in the temperature then the last_updated doesn't change. Is there any other way I can check when it last contacted HA even if it didn't change anything please?
i don't think there is and if there was, it would depend on the integration by which you're getting your temp sensor data. why is that piece of information important to you?
It depends on the sensor and integration how that is handled - it should behave like that - last updated is the last time the value was checked, last changed is when it differed, but sadly not everyone does it like that
last updated is the last time the value was checked, last changed is when it differed
i beg to differ, sir
however, apparently there is a last_reported which does just what @plush totem wants
I'm using the temperature sensors to run a heating system. If any of them fail, I need to ensure that the heaters stop running while I fix the problem.
last_reported. Brilliant. How did you find that out please?
good use case! check out what I've linked, it sounds like it does just the thing
i was looking for documentation to contradict hilburn 😛 and stumbled across this
Great stuff. I'll give that a nose. Many, many thanks.