Hi,
how to find out if a motion sensor or a door sensor is ‘dead’ or totally out of battery ?
I found out that I could monitor when was the last_updated via something like :
value_template: '{{ ( as_timestamp(now()) - as_timestamp(state.attributes.last_updated | default(0) ) ) }}'
above: '25200'
This (I think) would tell me if there’s no update for a week.
I’ve read on State objects - Home Assistant
state.last_updated : Time the state was written to the state machine. Note that writing the exact same state including attributes will not result in this field being updated.
Problem : maybe this motion sensor or door sensor hasn’t seen anyone for a week, in this case it would alert (incorrectly!)
Also, if I restart HA, it would ‘reset’ the 7 days, as the last_updated would be the HA startup time.
Is there another way to find out about dead motion/door sensors ?
I’m using the Xiaomi Aqara ones, if that makes any difference.