-
Notifications
You must be signed in to change notification settings - Fork 21
/
philips_929002398602.yaml
716 lines (711 loc) · 32.9 KB
/
philips_929002398602.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
# Blueprint metadata
blueprint:
name: Controller - Philips 929002398602 Hue Dimmer switch v2
description: |
# Controller - Philips 929002398602 Hue Dimmer switch v2
Controller automation for executing any kind of action triggered by the provided Philips 929002398602 Hue Dimmer switch v2. Allows to optionally loop an action on a button long press.
Supports ZHA, Zigbee2MQTT.
Automations created with this blueprint can be connected with one or more [Hooks](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/hooks) supported by this controller.
Hooks allow to easily create controller-based automations for interacting with media players, lights, covers and more.
See the list of [Hooks available for this controller](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/controllers/philips_929002398602#available-hooks) for additional details.
📕 Full documentation regarding this blueprint is available [here](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/controllers/philips_929002398602).
🚀 This blueprint is part of the **[Awesome HA Blueprints](https://epmatt.github.io/awesome-ha-blueprints) project**.
ℹ️ Version 2022.08.08
source_url: https://github.com/EPMatt/awesome-ha-blueprints/blob/main/blueprints/controllers/philips_929002398602/philips_929002398602.yaml
domain: automation
input:
integration:
name: (Required) Integration
description: Integration used for connecting the remote with Home Assistant. Select one of the available values.
selector:
select:
options:
- ZHA
- Zigbee2MQTT
controller_device:
name: (ZHA) Controller Device
description: The controller device to use for the automation. Choose a value only if the remote is integrated with ZHA.
default: ''
selector:
device:
controller_entity:
name: (Zigbee2MQTT) Controller Entity
description: The action sensor of the controller to use for the automation. Choose a value only if the remote is integrated with Zigbee2MQTT.
default: ''
selector:
entity:
domain: sensor
helper_last_controller_event:
name: (Required) Helper - Last Controller Event
description: Input Text used to store the last event fired by the controller. You will need to manually create a text input entity for this, please read the blueprint Additional Notes for more info.
default: ''
selector:
entity:
domain: input_text
# inputs for custom actions
action_button_on_short:
name: (Optional) On button short press
description: Action to run on short on button press.
default: []
selector:
action:
action_button_on_long:
name: (Optional) On button long press
description: Action to run on long on button press.
default: []
selector:
action:
action_button_on_release:
name: (Optional) On button release
description: Action to run on on button release after long press.
default: []
selector:
action:
action_button_on_double:
name: (Optional) On button double press
description: Action to run on double on button press.
default: []
selector:
action:
action_button_off_short:
name: (Optional) Off button short press
description: Action to run on short off button press.
default: []
selector:
action:
action_button_off_long:
name: (Optional) Off button long press
description: Action to run on long off button press.
default: []
selector:
action:
action_button_off_release:
name: (Optional) Off button release
description: Action to run on off button release after long press.
default: []
selector:
action:
action_button_off_double:
name: (Optional) Off button double press
description: Action to run on double off button press.
default: []
selector:
action:
action_button_up_short:
name: (Optional) Up button short press
description: Action to run on short up button press.
default: []
selector:
action:
action_button_up_long:
name: (Optional) Up button long press
description: Action to run on long up button press.
default: []
selector:
action:
action_button_up_release:
name: (Optional) Up button release
description: Action to run on up button release after long press.
default: []
selector:
action:
action_button_up_double:
name: (Optional) Up button double press
description: Action to run on double up button press.
default: []
selector:
action:
action_button_down_short:
name: (Optional) Down button short press
description: Action to run on short down button press.
default: []
selector:
action:
action_button_down_long:
name: (Optional) Down button long press
description: Action to run on long down button press.
default: []
selector:
action:
action_button_down_release:
name: (Optional) Down button release
description: Action to run on down button release after long press.
default: []
selector:
action:
action_button_down_double:
name: (Optional) Down button double press
description: Action to run on double down button press.
default: []
selector:
action:
# inputs for looping custom actions on long button press events until the corresponding release event is received
button_on_long_loop:
name: (Optional) On button long press - loop until release
description: Loop the on button action until the button is released.
default: false
selector:
boolean:
button_on_long_max_loop_repeats:
name: (Optional) On button long press - Maximum loop repeats
description: >-
Maximum number of repeats for the custom action, when looping is enabled.
Use it as a safety limit to prevent an endless loop in case the corresponding stop event is not received.
default: 500
selector:
number:
min: 1
max: 5000
mode: slider
step: 1
button_off_long_loop:
name: (Optional) Off button long press - loop until release
description: Loop the off button action until the button is released.
default: false
selector:
boolean:
button_off_long_max_loop_repeats:
name: (Optional) Off button long press - Maximum loop repeats
description: >-
Maximum number of repeats for the custom action, when looping is enabled.
Use it as a safety limit to prevent an endless loop in case the corresponding stop event is not received.
default: 500
selector:
number:
min: 1
max: 5000
mode: slider
step: 1
button_up_long_loop:
name: (Optional) Up button long press - loop until release
description: Loop the up button action until the button is released.
default: false
selector:
boolean:
button_up_long_max_loop_repeats:
name: (Optional) Up button long press - Maximum loop repeats
description: >-
Maximum number of repeats for the custom action, when looping is enabled.
Use it as a safety limit to prevent an endless loop in case the corresponding stop event is not received.
default: 500
selector:
number:
min: 1
max: 5000
mode: slider
step: 1
button_down_long_loop:
name: (Optional) Down button long press - loop until release
description: Loop the down button action until the button is released.
default: false
selector:
boolean:
button_down_long_max_loop_repeats:
name: (Optional) Down button long press - Maximum loop repeats
description: >-
Maximum number of repeats for the custom action, when looping is enabled.
Use it as a safety limit to prevent an endless loop in case the corresponding stop event is not received.
default: 500
selector:
number:
min: 1
max: 5000
mode: slider
step: 1
# inputs for enabling double press events
button_on_double_press:
name: (Optional) Expose on button double press event
description: Choose whether or not to expose the virtual double press event for the on button. Turn this on if you are providing an action for the on button double press event.
default: false
selector:
boolean:
button_off_double_press:
name: (Optional) Expose off button double press event
description: Choose whether or not to expose the virtual double press event for the off button. Turn this on if you are providing an action for the off button double press event.
default: false
selector:
boolean:
button_up_double_press:
name: (Optional) Expose up button double press event
description: Choose whether or not to expose the virtual double press event for the up button. Turn this on if you are providing an action for the up button double press event.
default: false
selector:
boolean:
button_down_double_press:
name: (Optional) Expose down button double press event
description: Choose whether or not to expose the virtual double press event for the down button. Turn this on if you are providing an action for the down button double press event.
default: false
selector:
boolean:
# helpers used to properly recognize the remote button events
helper_double_press_delay:
name: (Optional) Helper - Double Press delay
description: Max delay between the first and the second button press for the double press event. Provide a value only if you are using a double press action. Increase this value if you notice that the double press action is not triggered properly.
default: 500
selector:
number:
min: 100
max: 5000
unit_of_measurement: milliseconds
mode: box
step: 10
helper_debounce_delay:
name: (Optional) Helper - Debounce delay
description:
Delay used for debouncing RAW controller events, by default set to 0. A value of 0 disables the debouncing feature. Increase this value if you notice custom actions or linked Hooks running multiple times when interacting with the device. When the controller needs to be debounced,
usually a value of 100 is enough to remove all duplicate events.
default: 0
selector:
number:
min: 0
max: 1000
unit_of_measurement: milliseconds
mode: box
step: 10
# Automation schema
variables:
# convert input tags to variables, to be used in templates
integration: !input integration
button_on_long_loop: !input button_on_long_loop
button_on_long_max_loop_repeats: !input button_on_long_max_loop_repeats
button_on_double_press: !input button_on_double_press
button_off_long_loop: !input button_off_long_loop
button_off_long_max_loop_repeats: !input button_off_long_max_loop_repeats
button_off_double_press: !input button_off_double_press
button_up_long_loop: !input button_up_long_loop
button_up_long_max_loop_repeats: !input button_up_long_max_loop_repeats
button_up_double_press: !input button_up_double_press
button_down_long_loop: !input button_down_long_loop
button_down_long_max_loop_repeats: !input button_down_long_max_loop_repeats
button_down_double_press: !input button_down_double_press
helper_last_controller_event: !input helper_last_controller_event
helper_double_press_delay: !input helper_double_press_delay
helper_debounce_delay: !input helper_debounce_delay
# integration id used to select items in the action mapping
integration_id: '{{ integration | lower }}'
# adjusted debounce delay so that the resulting double press delay is exactly as specified by the user when running the action, taking also account of debouncing
# make sure it never goes below the minimum double press delay
adjusted_double_press_delay: '{{ [helper_double_press_delay - helper_debounce_delay, 100] | max }}'
# mapping between actions and integrations
actions_mapping:
zha:
button_on_short: [on_press]
button_on_long: [on_hold]
button_on_release: [on_long_release]
button_off_short: [off_press]
button_off_long: [off_hold]
button_off_release: [off_long_release]
button_up_short: [up_press]
button_up_long: [up_hold]
button_up_release: [up_long_release]
button_down_short: [down_press]
button_down_long: [down_hold]
button_down_release: [down_long_release]
zigbee2mqtt:
button_on_short: [on_press]
button_on_long: [on_hold]
button_on_release: [on_hold_release]
button_off_short: [off_press]
button_off_long: [off_hold]
button_off_release: [off_hold_release]
button_up_short: [up_press]
button_up_long: [up_hold]
button_up_release: [up_hold_release]
button_down_short: [down_press]
button_down_long: [down_hold]
button_down_release: [down_hold_release]
# pre-choose actions for buttons based on configured integration
# no need to perform this task at automation runtime
button_on_short: '{{ actions_mapping[integration_id]["button_on_short"] }}'
button_on_long: '{{ actions_mapping[integration_id]["button_on_long"] }}'
button_on_release: '{{ actions_mapping[integration_id]["button_on_release"] }}'
button_off_short: '{{ actions_mapping[integration_id]["button_off_short"] }}'
button_off_long: '{{ actions_mapping[integration_id]["button_off_long"] }}'
button_off_release: '{{ actions_mapping[integration_id]["button_off_release"] }}'
button_up_short: '{{ actions_mapping[integration_id]["button_up_short"] }}'
button_up_long: '{{ actions_mapping[integration_id]["button_up_long"] }}'
button_up_release: '{{ actions_mapping[integration_id]["button_up_release"] }}'
button_down_short: '{{ actions_mapping[integration_id]["button_down_short"] }}'
button_down_long: '{{ actions_mapping[integration_id]["button_down_long"] }}'
button_down_release: '{{ actions_mapping[integration_id]["button_down_release"] }}'
# build data to send within a controller event
controller_entity: !input controller_entity
controller_device: !input controller_device
controller_id: '{% if integration_id=="zigbee2mqtt" %}{{controller_entity}}{% else %}{{controller_device}}{% endif %}'
mode: restart
max_exceeded: silent
trigger:
# trigger for zigbee2mqtt
- platform: event
event_type: state_changed
event_data:
entity_id: !input controller_entity
# trigger for other integrations
- platform: event
event_type:
- zha_event
event_data:
device_id: !input controller_device
condition:
- condition: and
conditions:
# check that the button event is not empty
- >-
{%- set trigger_action -%}
{%- if integration_id == "zigbee2mqtt" -%}
{{ trigger.event.data.new_state.state }}
{%- elif integration_id == "deconz" -%}
{{ trigger.event.data.event }}
{%- elif integration_id == "zha" -%}
{{ trigger.event.data.command }}
{%- endif -%}
{%- endset -%}
{{ trigger_action not in ["","None"] }}
# only for zigbee2mqtt, check if the event is relative to a real state change, and not only some minor changes in the sensor attributes
# this is required since multiple state_changed events are fired for a single button press, with the result of the automation being triggered multiple times
- '{{ integration_id != "zigbee2mqtt" or trigger.event.data.new_state.state != trigger.event.data.old_state.state }}'
action:
# debouncing - when automation is triggered multiple times, the last automation run is the one which completes execution, due to mode restart
# therefore previous runs must wait for the debounce delay before executing any other action
# if the delay expires and the automation is still running it means it's the last run and execution can continue
- delay:
milliseconds: !input helper_debounce_delay
# extract button event from the trigger
# provide a single string value to check against
- variables:
trigger_action: >-
{%- if integration_id == "zigbee2mqtt" -%}
{{ trigger.event.data.new_state.state }}
{%- elif integration_id == "deconz" -%}
{{ trigger.event.data.event }}
{%- elif integration_id == "zha" -%}
{{ trigger.event.data.command }}
{%- endif -%}
trigger_delta: '{{ (as_timestamp(now()) - ((states(helper_last_controller_event) | from_json).t if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^\{((\"a\": \".*\"|\"t\": \d+\.\d+)(, )?){2}\}$")) else as_timestamp("1970-01-01 00:00:00"))) * 1000 }}'
# update helper
- service: input_text.set_value
data:
entity_id: !input helper_last_controller_event
value: '{{ {"a":trigger_action,"t":as_timestamp(now())} | to_json }}'
# choose the sequence to run based on the received button event
- choose:
- conditions: '{{ trigger_action | string in button_on_short }}'
sequence:
- choose:
# if double press event is enabled
- conditions: '{{ button_on_double_press }}'
sequence:
- choose:
# if previous event was a short press
- conditions: '{{ trigger_action | string in states(helper_last_controller_event) and trigger_delta | int <= helper_double_press_delay | int }}'
sequence:
# store the double press event in the last controller event helper
- service: input_text.set_value
data:
entity_id: !input helper_last_controller_event
value: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json }}'
# run the double press action
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_on_double
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_on_double
# previous event was not a short press
default:
# wait for the double press event to occur, within the provided delay
# if the second press is received, automation is restarted
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
# if delay expires, no second press was received, therefore run the short press action
# run the short press action
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_on_short
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_on_short
# if double press event is disabled run the action for the single short press
default:
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_on_short
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_on_short
- conditions: '{{ trigger_action | string in button_on_long }}'
sequence:
# fire the event only once before looping the action
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_on_long
- choose:
# if looping is enabled, loop the action for a finite number of iterations
- conditions: '{{ button_on_long_loop }}'
sequence:
- repeat:
while: '{{ repeat.index < button_on_long_max_loop_repeats | int }}'
sequence: !input action_button_on_long
# if looping is not enabled run the custom action only once
default: !input action_button_on_long
- conditions: '{{ trigger_action | string in button_on_release }}'
sequence:
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_on_release
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_on_release
- conditions: '{{ trigger_action | string in button_off_short }}'
sequence:
- choose:
# if double press event is enabled
- conditions: '{{ button_off_double_press }}'
sequence:
- choose:
# if previous event was a short press
- conditions: '{{ trigger_action | string in states(helper_last_controller_event) and trigger_delta | int <= helper_double_press_delay | int }}'
sequence:
# store the double press event in the last controller event helper
- service: input_text.set_value
data:
entity_id: !input helper_last_controller_event
value: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json }}'
# run the double press action
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_off_double
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_off_double
# previous event was not a short press
default:
# wait for the double press event to occur, within the provided delay
# if the second press is received, automation is restarted
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
# if delay expires, no second press was received, therefore run the short press action
# run the short press action
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_off_short
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_off_short
# if double press event is disabled run the action for the single short press
default:
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_off_short
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_off_short
- conditions: '{{ trigger_action | string in button_off_long }}'
sequence:
# fire the event only once before looping the action
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_off_long
- choose:
# if looping is enabled, loop the action for a finite number of iterations
- conditions: '{{ button_off_long_loop }}'
sequence:
- repeat:
while: '{{ repeat.index < button_off_long_max_loop_repeats | int }}'
sequence: !input action_button_off_long
# if looping is not enabled run the custom action only once
default: !input action_button_off_long
- conditions: '{{ trigger_action | string in button_off_release }}'
sequence:
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_off_release
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_off_release
- conditions: '{{ trigger_action | string in button_up_short }}'
sequence:
- choose:
# if double press event is enabled
- conditions: '{{ button_up_double_press }}'
sequence:
- choose:
# if previous event was a short press
- conditions: '{{ trigger_action | string in states(helper_last_controller_event) and trigger_delta | int <= helper_double_press_delay | int }}'
sequence:
# store the double press event in the last controller event helper
- service: input_text.set_value
data:
entity_id: !input helper_last_controller_event
value: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json }}'
# run the double press action
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_up_double
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_up_double
# previous event was not a short press
default:
# wait for the double press event to occur, within the provided delay
# if the second press is received, automation is restarted
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
# if delay expires, no second press was received, therefore run the short press action
# run the short press action
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_up_short
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_up_short
# if double press event is disabled run the action for the single short press
default:
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_up_short
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_up_short
- conditions: '{{ trigger_action | string in button_up_long }}'
sequence:
# fire the event only once before looping the action
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_up_long
- choose:
# if looping is enabled, loop the action for a finite number of iterations
- conditions: '{{ button_up_long_loop }}'
sequence:
- repeat:
while: '{{ repeat.index < button_up_long_max_loop_repeats | int }}'
sequence: !input action_button_up_long
# if looping is not enabled run the custom action only once
default: !input action_button_up_long
- conditions: '{{ trigger_action | string in button_up_release }}'
sequence:
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_up_release
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_up_release
- conditions: '{{ trigger_action | string in button_down_short }}'
sequence:
- choose:
# if double press event is enabled
- conditions: '{{ button_down_double_press }}'
sequence:
- choose:
# if previous event was a short press
- conditions: '{{ trigger_action | string in states(helper_last_controller_event) and trigger_delta | int <= helper_double_press_delay | int }}'
sequence:
# store the double press event in the last controller event helper
- service: input_text.set_value
data:
entity_id: !input helper_last_controller_event
value: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json }}'
# run the double press action
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_down_double
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_down_double
# previous event was not a short press
default:
# wait for the double press event to occur, within the provided delay
# if the second press is received, automation is restarted
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
# if delay expires, no second press was received, therefore run the short press action
# run the short press action
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_down_short
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_down_short
# if double press event is disabled run the action for the single short press
default:
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_down_short
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_down_short
- conditions: '{{ trigger_action | string in button_down_long }}'
sequence:
# fire the event only once before looping the action
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_down_long
- choose:
# if looping is enabled, loop the action for a finite number of iterations
- conditions: '{{ button_down_long_loop }}'
sequence:
- repeat:
while: '{{ repeat.index < button_down_long_max_loop_repeats | int }}'
sequence: !input action_button_down_long
# if looping is not enabled run the custom action only once
default: !input action_button_down_long
- conditions: '{{ trigger_action | string in button_down_release }}'
sequence:
# fire the event
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_down_release
# run the custom action
- choose:
- conditions: []
sequence: !input action_button_down_release