#Automation trigger for "no change"

17 messages · Page 1 of 1 (latest)

bleak blade
#

I'd like an automation that alerts me if one of my sensors (temp) hasn't changed at all for x minutes. To alert me if the sensor isn't working (since none of the activity checks are working). I'm a bit stuck on how to achieve that, since there's no last_change attribute on my sensor. This shouldn't be too hard right?

peak karma
#

from the docs:

In this example, the trigger fires if the state value of the entity remains the same for for the time specified, regardless of the current state value.

#

state trigger, don't specify from: or to:, and provide a for: duration

#

it has to start with a state change, though

bleak blade
#

Thanks! Should have RTFM... 😐

#

And that also works for numeric states right?

peak karma
#

states are strings

bleak blade
#

Ah, so the numeric state kindof converts the state to a number when needed? Is that how it works?
So your first linked (State change) will work fine for the temperature state of a temperature sensor

peak karma
#

yes, numeric_state triggers and conditions evaluate the state as a numeric value

bleak blade
#

Ah cool, that's new info for me, never got that

peak karma
#

states are stored as strings. A state trigger makes an exact string comparison

bleak blade
#

Thanks. Then maybe a final q... If I use this YAML (derived from UI automation)

trigger: state
entity_id:
  - sensor.small_study_temperature
  - sensor.big_study_temperature
for:
  hours: 0
  minutes: 30
  seconds: 0

Is there a way to get the name of the sensor in my action? I think I can only add trigger IDs if I add each entity as a separater trigger right?

#

And it seems I can't use labels yet to identify entities in an automation

peak karma
#

with a template, yes

#

{{ trigger.entity_id }}