Hi everyone,
I’m struggling for hours on a blueprint now.
Here is the point, we usually use action input as the only entry in a sequence (see exemple below)
action:
- variables:
event: '{{ trigger.event.data.event }}'
- choose:
- conditions:
- '{{ event == 1002 }}'
sequence: !input 'remote_button_short_press'
- conditions:
- '{{ event == 1003 }}'
sequence: !input 'remote_button_hold_press'
- conditions:
- '{{ event == 1004 }}'
sequence: !input 'remote_button_double_press'
Today, I have complex situation. I want to loop an action (selected by the user) and there’s no way I get this working.
action:
- variables:
device: !input 'ikea_styrbar'
event: '{{ trigger.event.data.event }}'
- choose:
- conditions:
- '{{ event == 1002 }}'
sequence: !input 'remote_button_short_press_light_up'
- conditions:
- '{{ event == 1001 }}'
sequence:
- repeat:
until:
- condition: template
value_template: "{{ wait.trigger is not none or repeat.index > 10 }}"
sequence:
- !input 'remote_button_hold_press_light_up'
- wait_for_trigger:
- platform: event
event_type: deconz_event
event_data:
device_id: !input 'ikea_styrbar'
event: 1003
timeout:
milliseconds: 500
The idea here is to handle the looping conditions in the blueprint, this code works like a charm in my automations.
Here is an example of automation that works :
alias: Test
description: ""
trigger:
- platform: event
event_type: deconz_event
event_data:
id: remote_control_n2
condition: []
action:
- choose:
- conditions:
- condition: template
value_template: "{{ trigger.event.data.event == 1002}}"
sequence: []
- conditions:
- condition: template
value_template: "{{ trigger.event.data.event == 1001}}"
sequence:
- repeat:
until:
- condition: template
value_template: "{{ wait.trigger is not none or repeat.index >= 20 }}"
sequence:
- service: light.turn_on
data:
brightness_step_pct: 10
target:
area_id: salon
- wait_for_trigger:
- platform: event
event_type: deconz_event
event_data:
id: remote_control_n2
event: 1003
timeout:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
mode: single
I’m looping until the wait.trigger is set which occurs once the “release” event of my button is fired.
This allows me to increase/decrease brightness in a room when you hold a button until you release it.
I’d like to turn this into a blueprint, letting the user choose the actions in my until loop.
I’ve tried many syntax in order to get the action input working in the repeat’s sequence but I always get an error
expected dictionary @ data['action'][1]['choose'][1]['sequence'][0]['repeat']['sequence'][0]. Got Non
Anyone has already tried something like this ?
Using action input in a sequence with other actions in the same sequence ?
Thanks for reading me