bkbilly
(Vasilis Koulis)
July 27, 2020, 1:09pm
1
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
fedot
July 27, 2020, 1:28pm
2
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
bkbilly
(Vasilis Koulis)
July 27, 2020, 4:09pm
3
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?
fedot
July 27, 2020, 4:12pm
4
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
bkbilly
(Vasilis Koulis)
July 27, 2020, 4:19pm
5
Works fluently!
I got really confused with the condition inside the condition.
Thanks a lot!
1 Like