#Getting last updated from a sensor

1 messages · Page 1 of 1 (latest)

plush totem
#

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.

main thistle
#
  1. i doubt you have a sensor called sensor.lounge.temperature, as that's not possible. maybe sensor.lounge_temperature?
  2. last_updated is a property of the state object. so that would be {{ as_timestamp(states.sensor.lounge_temperature.last_updated) }}
plush totem
#

You're corect - that was a typo. Sorry.

#

I'll give that a go and see where I get! Thank you

plush totem
#

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?

main thistle
#

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?

jagged temple
#

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

main thistle
#

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

plush totem
#

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?

main thistle
main thistle
plush totem
#

Great stuff. I'll give that a nose. Many, many thanks.