I have no suggestions regarding device_id
and defer to your decision. I was in the process of streamlining the template and wondered why device_id
wasn’t used.
I don’t have the appropriate gadgetry to test this but I believe it should work as well as the original version.
action:
- variables:
scene_id: '{{ trigger.event.data.scene_id }}'
- condition: template
value_template: >
{{ trigger.event.data.node_id == (ozw_node_id | int) and
trigger.event.data.scene_value_id == 1 }}
- choose:
- conditions: '{{ scene_id == 1 }}'
sequence: !input 'button_1'
- conditions: '{{ scene_id == 2 }}'
sequence: !input 'button_2'
- conditions: '{{ scene_id == 3 }}'
sequence: !input 'button_3'
- conditions: '{{ scene_id == 4 }}'
sequence: !input 'button_4'
All four choices in choose
had two common conditions so I moved them out of choose
and to a separate condition
. If it evaluates to false then there’s no reason for the action to execute choose
. The template also employs the new shorthand notation for Template Conditions.
EDIT
Corrected improperly defined Template Condition.