566 lines
21 KiB
YAML
566 lines
21 KiB
YAML
blueprint:
|
|
homeassistant:
|
|
min_version: 2024.10.0
|
|
author: damru
|
|
domain: automation
|
|
name: Ikea's Rodret, Somrig or Tradfri ⚙️ Controls
|
|
description: >
|
|
## ⚙️ 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: TRADFRI on/off switch
|
|
- 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: mqtt
|
|
manufacturer: IKEA
|
|
model: TRADFRI on/off switch
|
|
- integration: mqtt
|
|
manufacturer: IKEA
|
|
model: RODRET wireless dimmer/power switch
|
|
- integration: mqtt
|
|
manufacturer: IKEA
|
|
model: SOMRIG shortcut button
|
|
# DEPRECATED - for removal, keeping for z2m v1 backward compatibility
|
|
- integration: mqtt
|
|
manufacturer: IKEA
|
|
model: TRADFRI on/off switch (E1743)
|
|
# 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)
|
|
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
|
|
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
|