#trigger based on state with delay

1 messages · Page 1 of 1 (latest)

sterile cedar
#

Hi,

I have a simple automation that should send a push notification to my PC when my desk was in the sitting position for more than 2h. I created a template sensor that returns sitting when my desk is <1m, and standing otherwise. This part works perfectly fine. But for some reason, the automation does not trigger. Where am I going wrong?

alias: Desk Chris Stand Up
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.desk_chris_mode
    for:
      hours: 2
      minutes: 0
      seconds: 0
    to:
      - sitting
conditions: []
actions:
  - action: notify.chrisdesktop
    metadata: {}
    data:
      message: Stand up!
      data:
        actions:
          - action: "yes"
            title: "Yes"
          - action: "no"
            title: "No"
mode: single
meager sand
#

Are you sure it's not triggering? Check the trace for the automation and the last_triggered attribute

sterile cedar
meager sand
#

And did the state start out as standing when the automation was created? It will only trigger as a result of a state change

#

My guess is that you created the automation when the state was already 'sitting'

balmy plaza
#

Only actual state changes will trigger it, the status is not being constantly checked