-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathikea_E1743-E2201-E2213_ZHA-Z2M_control-anything.yaml
More file actions
588 lines (574 loc) · 21.8 KB
/
ikea_E1743-E2201-E2213_ZHA-Z2M_control-anything.yaml
File metadata and controls
588 lines (574 loc) · 21.8 KB
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
blueprint:
homeassistant:
min_version: 2024.10.0
author: damru
domain: automation
name: ⚠️ DEPRECATED - Ikea's Rodret, Somrig or Tradfri ⚙️ Controls
description: >
# ⚠️⚠️ DEPRECATION NOTICE: This blueprint was renamed and is now deprecated as it is. Please reimport to update to the latest version
How to migrate:
- Import from the new url: https://github.com/damru/ha-blueprints/blob/main/ikea_remotes_control-anything.yaml
- Reconfigure your existing automations to use the new blueprint (the old one will not receive updates anymore)
- Edit the automation in YAML
- Update the following:
```yaml
use_blueprint:
[...]
path: damru/ikea_E1743-E2201-E2213_ZHA-Z2M_control-anything.yaml
```
to:
```yaml
use_blueprint:
[...]
path: damru/ikea_remotes_control-anything.yaml
```
- Delete the old blueprint from your Home Assistant instance
## ⚙️ Control anything with **IKEA RODRET** or **IKEA SOMRIG** or **IKEA TRADFRI ON/OFF** remotes
Only for use with [ZHA](https://www.home-assistant.io/integrations/zha/)
or Zigbee2MQTT (cf [MQTT](https://www.home-assistant.io/integrations/mqtt)
+ [Z2M addon](https://www.zigbee2mqtt.io/guide/installation/03_ha_addon.html)).
Available controls:
- Single press **on/off** (Rodret, Tradfri) **1 dot/2 dots** (Somrig)
- Double press **on/off** (Rodret, Tradfri, _Optional_) **1 dot/2 dots** (Somrig)
- Hold **on/off** (Rodret, Tradfri) **1 dot/2 dots** (Somrig).
Actions will be executed every **Hold delay**, but maximum **Max number of loops** times.
input:
remote_devices:
name: Remotes
description: >
IKEA remote (Rodret, Somrig, Tradfri) to use.
default: []
selector:
device:
filter:
- integration: zha
manufacturer: IKEA of Sweden
model: RODRET Dimmer
- integration: zha
manufacturer: IKEA of Sweden
model: RODRET wireless dimmer
- integration: zha
manufacturer: IKEA of Sweden
model: SOMRIG shortcut button
- integration: zha
manufacturer: IKEA of Sweden
model: TRADFRI on/off switch
- integration: mqtt
manufacturer: IKEA
model: RODRET wireless dimmer/power switch
- integration: mqtt
manufacturer: IKEA
model: SOMRIG shortcut button
- integration: mqtt
manufacturer: IKEA
model: TRADFRI on/off switch
# DEPRECATED - for removal, keeping for z2m v1 backward compatibility
- integration: mqtt
manufacturer: IKEA
model: RODRET wireless dimmer/power switch (E2201)
# DEPRECATED - for removal, keeping for z2m v1 backward compatibility
- integration: mqtt
manufacturer: IKEA
model: SOMRIG shortcut button (E2213)
# DEPRECATED - for removal, keeping for z2m v1 backward compatibility
- integration: mqtt
manufacturer: IKEA
model: TRADFRI on/off switch (E1743)
multiple: true
on_press_action:
name: Press "on / 1 dot" action
description: Choose action(s) to run when **on** (Rodret, Tradfri) or **1 dot** (Somrig) button is **pressed**.
default: []
selector:
action: {}
off_press_action:
name: Press "off / 2 dots" action
description: Choose action(s) to run when **off** (Rodret, Tradfri) or **2 dots** (Somrig) button is **pressed**.
default: []
selector:
action: {}
on_hold_action:
name: Hold "on / 1 dot" action
description: Choose action(s) to run when **on** (Rodret, Tradfri) or **1 dot** (Somrig) button is **held**.
default: []
selector:
action: {}
off_hold_action:
name: Hold "off / 2 dots" action
description: Choose action(s) to run when **off** (Rodret, Tradfri) or **2 dots** (Somrig) button is **held**.
default: []
selector:
action: {}
on_double_press_action:
name: Double press "on / 1 dot" action
description: >
Choose action(s) to run when the **on** (Rodret, Tradfri) or **1 dot** (Somrig) button is **pressed twice**.
**_NB for Rodret, Tradfri only_**: **Double press event (on)** must be exposed and **Double press delay** interval is used as a timeout.
default: []
selector:
action: {}
off_double_press_action:
name: Double press "off / 2 dots" action
description: >
Choose action(s) to run when the **off** (Rodret, Tradfri) or **2 dots** (Somrig) button is **pressed twice**.
**_NB for Rodret, Tradfri only_**: **Double press event (off)** must be exposed and **Double press delay** interval is used as a timeout.
default: []
selector:
action: {}
helper_section :
name: Helpers
icon: mdi:cog-outline
collapsed: true
input:
helper_hold_delay:
name: Hold delay
description: Delay between the execution of the **Hold** action(s).
default: 250
selector:
number:
unit_of_measurement: milliseconds
min: 100.0
max: 5000.0
step: 10.0
mode: slider
helper_max_loops:
name: Max number of loops
description: Maximum number of loops when holding down a button.
default: 20
selector:
number:
min: 1.0
max: 1000.0
step: 1.0
mode: slider
rodret_tradfri_options_section:
name: Rodret, Tradfri options
icon: mdi:remote
collapsed: true
input:
on_double_press_exposed:
name: Expose virtual double press "on" event
description: >
Choose whether or not to expose the virtual **double press** event for the **on** button.
Turn this on if you are providing action(s) for the **Double press action (on / 1 dot)**.
default: false
selector:
boolean: {}
off_double_press_exposed:
name: Expose virtual double press "off" 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 **Double press action (off / 2 dots)**.
default: false
selector:
boolean: {}
helper_double_press_delay:
name: Double press delay
description: >
Max delay between the first and the second button press for the
**Double press events**. 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: 250
selector:
number:
unit_of_measurement: milliseconds
min: 100.0
max: 5000.0
step: 10.0
mode: slider
source_url: https://github.com/damru/ha-blueprints/blob/main/ikea_remotes_control-anything.yaml
mode: single
max_exceeded: silent
triggers:
# RODRET (E2201) + TRADFRI (E1743)
- trigger: event
event_type: zha_event
event_data:
command: "on"
cluster_id: 6
endpoint_id: 1
id: press-on-zha-e1743-e2201
- trigger: mqtt
topic: "+/+/action"
payload: "on"
id: press-on-z2m-e1743-e2201
- trigger: event
event_type: zha_event
event_data:
command: "off"
cluster_id: 6
endpoint_id: 1
id: press-off-zha-e1743-e2201
- trigger: mqtt
topic: "+/+/action"
payload: "off"
id: press-off-z2m-e1743-e2201
- trigger: event
event_type: zha_event
event_data:
command: move_with_on_off
cluster_id: 8
endpoint_id: 1
id: hold-on-zha-e1743-e2201
- trigger: mqtt
topic: "+/+/action"
payload: brightness_move_up
id: hold-on-z2m-e1743-e2201
- trigger: event
event_type: zha_event
event_data:
command: move
cluster_id: 8
endpoint_id: 1
id: hold-off-zha-e1743-e2201
- trigger: mqtt
topic: "+/+/action"
payload: brightness_move_down
id: hold-off-z2m-e1743-e2201
- trigger: event
event_type: zha_event
event_data:
endpoint_id: 1
cluster_id: 8
command: stop_with_on_off
id: release-zha-e1743-e2201
- trigger: mqtt
topic: "+/+/action"
payload: brightness_stop
id: release-z2m-e1743-e2201
# SOMRIG (E2213)
- trigger: event
event_type: zha_event
event_data:
command: short_release
endpoint_id: 1
id: press-dots1-zha-e2213
- trigger: mqtt
topic: "+/+/action"
payload: 1_short_release
id: press-dots1-z2m-e2213
- trigger: event
event_type: zha_event
event_data:
command: short_release
endpoint_id: 2
id: press-dots2-zha-e2213
- trigger: mqtt
topic: "+/+/action"
payload: 2_short_release
id: press-dots2-z2m-e2213
- trigger: event
event_type: zha_event
event_data:
command: multi_press_complete
endpoint_id: 1
id: double-press-dots1-zha-e2213
- trigger: mqtt
topic: "+/+/action"
payload: 1_double_press
id: double-press-dots1-z2m-e2213
- trigger: event
event_type: zha_event
event_data:
command: multi_press_complete
endpoint_id: 2
id: double-press-dots2-zha-e2213
- trigger: mqtt
topic: "+/+/action"
payload: 2_double_press
id: double-press-dots2-z2m-e2213
- trigger: event
event_type: zha_event
event_data:
command: long_press
endpoint_id: 1
id: hold-dots1-zha-e2213
- trigger: mqtt
topic: "+/+/action"
payload: 1_long_press
id: hold-dots1-z2m-e2213
- trigger: event
event_type: zha_event
event_data:
command: long_press
endpoint_id: 2
id: hold-dots2-zha-e2213
- trigger: mqtt
topic: "+/+/action"
payload: 2_long_press
id: hold-dots2-z2m-e2213
- trigger: event
event_type: zha_event
event_data:
command: long_release
endpoint_id: 1
id: release-hold-dots1-zha-e2213
- trigger: mqtt
topic: "+/+/action"
payload: 1_long_release
id: release-hold-dots1-z2m-e2213
- trigger: event
event_type: zha_event
event_data:
command: long_release
endpoint_id: 2
id: release-hold-dots2-zha-e2213
- trigger: mqtt
topic: "+/+/action"
payload: 2_long_release
id: release-hold-dots2-z2m-e2213
variables:
is_mqtt: "{{ trigger.platform == 'mqtt' }}"
is_zha: "{{ trigger.platform == 'event' and trigger.event.event_type == 'zha_event' }}"
mqtt_topic: "{{ trigger.topic }}"
on_double_press_exposed: !input on_double_press_exposed
off_double_press_exposed: !input off_double_press_exposed
remote_devices: !input remote_devices
remote_devices_names: "{{ remote_devices | map('device_attr', 'name') | list }}"
zha_device_id: "{{ trigger.event.data.device_id if is_zha }}"
condition:
- condition: template
value_template: >-
{{
(trigger.event.data.device_id in remote_devices if is_zha) or
(trigger.topic.split('/')[1] in remote_devices_names if is_mqtt)
}}
actions:
- choose:
- conditions:
- condition: trigger
id:
- press-on-zha-e1743-e2201
- press-on-z2m-e1743-e2201
- press-dots1-zha-e2213
- press-dots1-z2m-e2213
sequence:
- if:
- condition: template
value_template: "{{ on_double_press_exposed }}"
then:
- choose:
- conditions:
- condition: trigger
id:
- press-on-zha-e1743-e2201
sequence:
- wait_for_trigger:
- trigger: event
event_type: zha_event
event_data:
device_id: "{{ zha_device_id }}"
command: "on"
cluster_id: 6
endpoint_id: 1
timeout:
milliseconds: !input helper_double_press_delay
continue_on_timeout: true
- if:
- condition: template
value_template: "{{ wait.trigger.idx is defined }}"
then: !input on_double_press_action
else: !input on_press_action
- conditions:
- condition: trigger
id:
- press-on-z2m-e1743-e2201
sequence:
- wait_for_trigger:
- trigger: mqtt
topic: "{{ mqtt_topic }}"
payload: "on"
timeout:
milliseconds: !input helper_double_press_delay
continue_on_timeout: true
- if:
- condition: template
value_template: "{{ wait.trigger.idx is defined }}"
then: !input on_double_press_action
else: !input on_press_action
default: !input on_press_action
else: !input on_press_action
- conditions:
- condition: trigger
id:
- press-off-zha-e1743-e2201
- press-off-z2m-e1743-e2201
- press-dots2-zha-e2213
- press-dots2-z2m-e2213
sequence:
- if:
- condition: template
value_template: "{{ off_double_press_exposed }}"
then:
- choose:
- conditions:
- condition: trigger
id:
- press-off-zha-e1743-e2201
sequence:
- wait_for_trigger:
- trigger: event
event_type: zha_event
event_data:
device_id: "{{ zha_device_id }}"
command: "off"
cluster_id: 6
endpoint_id: 1
timeout:
milliseconds: !input helper_double_press_delay
continue_on_timeout: true
- if:
- condition: template
value_template: "{{ wait.trigger.idx is defined }}"
then: !input off_double_press_action
else: !input off_press_action
- conditions:
- condition: trigger
id:
- press-off-z2m-e1743-e2201
sequence:
- wait_for_trigger:
- trigger: mqtt
topic: "{{ mqtt_topic }}"
payload: "off"
timeout:
milliseconds: !input helper_double_press_delay
continue_on_timeout: true
- if:
- condition: template
value_template: "{{ wait.trigger.idx is defined }}"
then: !input off_double_press_action
else: !input off_press_action
default: !input off_press_action
else: !input off_press_action
- conditions:
- condition: trigger
id:
- double-press-dots1-zha-e2213
- double-press-dots1-z2m-e2213
sequence: !input on_double_press_action
- conditions:
- condition: trigger
id:
- double-press-dots2-zha-e2213
- double-press-dots2-z2m-e2213
sequence: !input off_double_press_action
#
# Actions for up button long press
- conditions:
- condition: trigger
id:
- hold-on-zha-e1743-e2201
- hold-on-z2m-e1743-e2201
- hold-dots1-zha-e2213
- hold-dots1-z2m-e2213
sequence:
- repeat:
count: !input helper_max_loops
sequence:
- parallel:
- sequence: !input on_hold_action
- sequence:
- choose:
- conditions:
- condition: trigger
id:
- hold-on-zha-e1743-e2201
- hold-dots1-zha-e2213
sequence:
- wait_for_trigger:
- trigger: event
event_type: zha_event
event_data:
device_id: "{{ zha_device_id }}"
command: "stop_with_on_off"
cluster_id: 8
endpoint_id: 1
timeout:
milliseconds: !input helper_hold_delay
continue_on_timeout: true
- if:
- condition: template
value_template: "{{ wait.trigger.idx is defined }}"
then:
- stop: button released
- conditions:
- condition: trigger
id:
- hold-on-z2m-e1743-e2201
- hold-dots1-z2m-e2213
sequence:
- wait_for_trigger:
- trigger: mqtt
topic: "{{ mqtt_topic }}"
payload: "brightness_stop"
- trigger: mqtt
topic: "{{ mqtt_topic }}"
payload: "1_long_release"
timeout:
milliseconds: !input helper_hold_delay
continue_on_timeout: true
- if:
- condition: template
value_template: "{{ wait.trigger.idx is defined }}"
then:
- stop: button released
- conditions:
- condition: trigger
id:
- hold-off-zha-e1743-e2201
- hold-off-z2m-e1743-e2201
- hold-dots2-zha-e2213
- hold-dots2-z2m-e2213
sequence:
- repeat:
count: !input helper_max_loops
sequence:
- parallel:
- sequence: !input off_hold_action
- sequence:
- choose:
- conditions:
- condition: trigger
id:
- hold-off-zha-e1743-e2201
- hold-dots2-zha-e2213
sequence:
- wait_for_trigger:
- trigger: event
event_type: zha_event
event_data:
device_id: "{{ zha_device_id }}"
command: "stop_with_on_off"
cluster_id: 8
endpoint_id: 1
timeout:
milliseconds: !input helper_hold_delay
continue_on_timeout: true
- if:
- condition: template
value_template: "{{ wait.trigger.idx is defined }}"
then:
- stop: button released
- conditions:
- condition: trigger
id:
- hold-off-z2m-e1743-e2201
- hold-dots2-z2m-e2213
sequence:
- wait_for_trigger:
- trigger: mqtt
topic: "{{ mqtt_topic }}"
payload: "brightness_stop"
- trigger: mqtt
topic: "{{ mqtt_topic }}"
payload: "2_long_release"
timeout:
milliseconds: !input helper_hold_delay
continue_on_timeout: true
- if:
- condition: template
value_template: "{{ wait.trigger.idx is defined }}"
then:
- stop: button released