Condition or on Choice

I recently installed the new version of home assistant 0.113 and I want to make an automation which will have an OR condition on the chooser.
I am attaching the yaml bellow and what I want is the either the frontdoor or the motion sensor to be on state on, then the timer will start.
There must be a way to do it, but I can’t figure out how. The documendation for the or condition is located here.
Also this is part of a larger automation, so I need the chooser.

- alias: Light - Timer finished
  trigger:
    platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.light
  action:
  - choose:
    - conditions:
      - condition: state
        entity_id:
        - binary_sensor.frontdoor
        - binary_sensor.motion
        state: 'on'
      sequence:
      - service: timer.start
        entity_id: timer.light

Hey Basilis,

you don’t need a chooser for that. A chooser is more like an if…else statement.

Try:

- alias: 'Light - Timer finished'
  trigger:
    platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.light
  condition:
    - condition: or
      conditions:
        - condition: state
          entity_id: binary_sensor.frontdoor
          state: 'on'
        - condition: state
          entity_id: binary_sensor.motion
          state: 'on'
  action:
  - service: timer.start
    entity_id: timer.light

As I mentioned, the yaml I write is part of a larger automation, so I need the chooser. Do you know how to do it with chooser?

Alright, I seem to have overlooked that part. Try:

- alias: Light - Timer finished
  trigger:
    platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.light
  action:
  - choose:
    - conditions:
        - condition: or
          conditions:
            - condition: state
              entity_id: binary_sensor.frontdoor
              state: 'on'
            - condition: state
              entity_id: binary_sensor.motion
              state: 'on'
      sequence:
      - service: timer.start
        entity_id: timer.light
2 Likes

Works fluently!
I got really confused with the condition inside the condition. :innocent:
Thanks a lot!

1 Like