Hello,
I am doing my first steps with Home Assistant and now try to set up an automation.
I want to have a three state device trigger two different actions, depending whether it is on
or either off
or unknown
. I’ve followed the docs on the OR usage for conditions, tried all the options described therein, but can’t get it to work.
If I leave the or-part behind #ELIF out, it reacts to “on”. With it, there is an error.
extra keys not allowed @ data['actions'][0]['choose'][1]['condition']. Got 'or'
Can anybody give me a hint how to use the or conditions?
triggers:
- trigger: state
entity_id: binary_sensor.fenster_buro_tur
for: '00:00:02'
actions:
- choose:
# IF gekippt
- conditions:
- condition: state
entity_id: binary_sensor.fenster_buro_tur
state: 'on'
sequence:
- action: lcn.pck
data:
address: LinHK.0.20
pck: PIN001
# ELIF offen/geschlossen
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.fenster_buro_tur
state: 'off'
- condition: state
entity_id: binary_sensor.fenster_buro_tur
state: 'unknown'
sequence:
- action: lcn.pck
data:
address: LinHK.0.20
pck: PIN002
The code can probably be condensed, but for a beginner this is easier to read.
Thanks