Using timer state as a condition

I am trying to use the timer state (idle or active) in a condition for an automation and it doesn’t seem to be working. The condition always passes as true. Do I have a syntax issue?

  - id: shop_timer_test
    alias: Shop Timer Test
    # Temp above 75 or below 60
    trigger:
      - platform: numeric_state
        entity_id: sensor.shop_multisensor6_temperature
        above: 75
      - platform: numeric_state
        entity_id: sensor.shop_multisensor6_temperature
        below: 60
    # Ensure alarm isn't already set (idle vs active).  This avoids multiple text messages.
    condition:
      condition: state
      entity_id: timer.shop_temp_alarm
      state: 'idle'
    action:
      # Alarm timer is set for 8 hours --> prevents multiple text messages
      - service: timer.start
        entity_id: timer.shop_temp_alarm
        data:
          duration: '08:00:00'
      # Send text message
      - service: notify.text_jeremy
        data:
          message: 'TEST: Shop Temp Out of Range.  Shop temperature is {{ states.sensor.shop_multisensor6_temperature.state }} degrees'

Looks fine to me, are you triggering this from the interface? If so it will ignore the condition.

2 Likes

Yes, I was triggering this from the Home Assistant front end. I assumed that I was just “triggering” the automation and the rest of it (condition and action) would be executed. Thanks.

Yeah, a fair few people get caught out by that at first (me included) :+1:

I’m trying to use timer state in a condition too.

Can ‘finished’ be used as a state?

I’m having no luck with it so far and can’t find anything in the docs so clutching at straws really.

  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.driveway_motion_1_detected
        state: 'on'
      - condition: state
        entity_id: timer.vehicle_timer
        state: finished

Solved: Seemingly, ‘idle’ has the same functionality as ‘finished’.

1 Like