Try to get warning of battery dead of a bluetooth temperature/humidity device. When I try using battery level becames unavailable, it doesn’t work as HA seems always getting last value of the devices before it dead. Now I try working a condition to say if temperature value not moving for 5 hours (unusual), give me the warning. However, not good of python. Here is the coding I attemped. would anyone can help me to correct it?
trigger: state
entity_id:
- sensor.miaomiaoce_t2_7d7b_temperature
attribute: No change
for:
hours: 5
minutes: 0
seconds: 0
trigger: state
entity_id: sensor.miaomiaoce_t2_7d7b_temperature
for:
hours: 5
It’s not Python. You’re looking for the state to not change for 5 hours. The Attribute field is for when you’re looking at one of the sensor’s attributes — as you’re not doing that here, it should be left blank (see here for more info).
Alternatively, protecting against a very constant temperature for 5 hours:
That’s a Jinja template in the {{ ... }} — the trigger will fire when the template turns from false to true, which will happen when the last_reported property of the sensor becomes more than 18000s (5 hours) old.
thanks. However, I try testing to put time of 1 min. After copy paste your coding with currect senor name. and save it. it didn’t fire up. and check again. It seems HA changed coding automatically as following