Skip to content

Instantly share code, notes, and snippets.

@trilorian
Created February 4, 2025 13:53
Show Gist options
  • Select an option

  • Save trilorian/e365d49c009e56ef9062f66f472200f8 to your computer and use it in GitHub Desktop.

Select an option

Save trilorian/e365d49c009e56ef9062f66f472200f8 to your computer and use it in GitHub Desktop.
Blueprint for Ikea Rodret dimmer (ZHA/MQTT)
---
blueprint:
name: IKEA Rodret Dimmer (v2 ZHA + MQTT)
description: "## IKEA RODRET Dimmer remote (v2.0)
For use with [Zigbee Home Automation](https://www.home-assistant.io/integrations/zha/)
and Zigbee2MQTT [MQTT](https://www.home-assistant.io/integrations/mqtt/) +
[Z2M addon](https://www.zigbee2mqtt.io/guide/installation/03_ha_addon.html)
Available controls (optional):
- Click the **on** or **off** button
- Double click the **on** or **off** button
- Triple click the **on** or **off** button
- Click and hold the **on**/**off** button"
source_url: https://gist.github.com/trilorian/76fd53a94be6003ff8d00bb191688445
domain: automation
input:
remote_device:
name: Remote
description: IKEA Rodret dimmer remote to use.
default: ""
selector:
device:
filter:
- integration: zha
manufacturer: IKEA of Sweden
model: RODRET Dimmer
multiple: false
base_topic:
name: Base mqtt topic
description:
The topic configured in [Z2M addon](https://www.zigbee2mqtt.io/guide/usage/mqtt_topics_and_messages.html).
default: zigbee2mqtt
on_click_action:
name: On - Single click action
description: Choose action(s) to run when **on** button is clicked.
default: []
selector:
action: {}
off_click_action:
name: Off - Single click action
description: Choose action(s) to run when **off** button is **clicked**.
default: []
selector:
action: {}
on_double_click_action:
name: On - Double click action
description:
Choose action(s) to run when clicking the **on** button twice.
default: []
selector:
action: {}
on_triple_click_action:
name: On - Triple click action
description:
Choose action(s) to run when clicking the **on** button three times.
default: []
selector:
action: {}
off_double_click_action:
name: Off - Double click action
description:
Choose action(s) to run when clicking the **off** button twice.
default: []
selector:
action: {}
off_triple_click_action:
name: Off - Triple click action
description:
Choose action(s) to run when clicking the **off** button three
times.
default: []
selector:
action: {}
on_hold_action:
name: On - Hold action
description:
Choose action(s) to run when **on** button is **clicked and held**.
default: []
selector:
action: {}
off_hold_action:
name: Off - Hold action
description:
Choose action(s) to run when **off** button is **clicked and held**.
default: []
selector:
action: {}
helper_multi_click_delay:
name: Helper - Multi click delay
description:
Max delay between the button clicks for the **Multi click events**. Change this value if you notice that the multi click action is not triggered properly.
default: 250
selector:
number:
unit_of_measurement: milliseconds
min: 100.0
max: 5000.0
step: 10.0
mode: slider
helper_hold_delay:
name: Helper - 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: Helper - 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
mode: single
max_exceeded: silent
trigger_variables:
zha_remote: !input remote_device
z2m_base_topic: !input base_topic
z2m_controller: !input remote_name
triggers:
- trigger: event
event_type: zha_event
event_data:
device_id: "{{ zha_remote }}"
command: "on"
cluster_id: 6
endpoint_id: 1
id: click-on-zha
- trigger: event
event_type: zha_event
event_data:
device_id: "{{ zha_remote }}"
command: "off"
cluster_id: 6
endpoint_id: 1
id: click-off-zha
- trigger: event
event_type: zha_event
event_data:
device_id: "{{ zha_remote }}"
command: move_with_on_off
cluster_id: 8
endpoint_id: 1
args:
- 0
- 83
id: hold-on-zha
- trigger: event
event_type: zha_event
event_data:
device_id: "{{ zha_remote }}"
command: move
cluster_id: 8
endpoint_id: 1
args:
- 1
- 83
- 0
- 0
id: hold-off-zha
- trigger: event
event_type: zha_event
event_data:
device_id: "{{ zha_remote }}"
command: stop_with_on_off
cluster_id: 8
endpoint_id: 1
id: release-zha
trigger:
- platform: mqtt
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
payload: "on"
id: click-on-mqtt
- platform: mqtt
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
payload: "off"
id: click-off-mqtt
- platform: mqtt
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
payload: "brightness_move_up"
id: hold-on-mqtt
- platform: mqtt
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
payload: "brightness_move_down"
id: hold-off-mqtt
- platform: mqtt
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
payload: "brightness_stop"
id: release-mqtt
- platform: mqtt
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
payload: "brightness_step_up"
id: double-click-on-mqtt
- platform: mqtt
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
payload: "brightness_step_down"
id: double-click-off-mqtt
- platform: mqtt
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
payload: "brightness_step_up"
id: triple-click-on-mqtt
- platform: mqtt
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
payload: "brightness_step_down"
id: triple-click-off-mqtt
action:
- choose:
- conditions:
- condition: trigger
id:
- click-on-zha
sequence:
- wait_for_trigger:
- trigger: event
event_type: zha_event
event_data:
device_id: "{{ zha_remote }}"
command: "on"
cluster_id: 6
endpoint_id: 1
timeout:
milliseconds: !input helper_multi_click_delay
continue_on_timeout: true
- choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger == none and on_click_action != none }}"
sequence: !input on_click_action
default:
- wait_for_trigger:
- trigger: event
event_type: zha_event
event_data:
device_id: "{{ zha_remote }}"
command: "on"
cluster_id: 6
endpoint_id: 1
timeout:
milliseconds: !input helper_multi_click_delay
continue_on_timeout: true
- choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger == none }}"
sequence:
- choose:
- conditions:
- condition: template
value_template:
"{{ on_double_click_action != none }}"
sequence: !input on_double_click_action
default:
- choose:
- conditions:
- condition: template
value_template:
"{{ on_triple_click_action != none }}"
sequence: !input on_triple_click_action
- choose:
- conditions:
- condition: trigger
id:
- click-off-zha
sequence:
- wait_for_trigger:
- trigger: event
event_type: zha_event
event_data:
device_id: "{{ zha_remote }}"
command: "off"
cluster_id: 6
endpoint_id: 1
timeout:
milliseconds: !input helper_multi_click_delay
continue_on_timeout: true
- choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger == none and off_click_action != none }}"
sequence: !input off_click_action
default:
- wait_for_trigger:
- trigger: event
event_type: zha_event
event_data:
device_id: "{{ zha_remote }}"
command: "off"
cluster_id: 6
endpoint_id: 1
timeout:
milliseconds: !input helper_multi_click_delay
continue_on_timeout: true
- choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger == none }}"
sequence:
- choose:
- conditions:
- condition: template
value_template: "{{ off_double_click_action != none }}"
sequence: !input off_double_click_action
default:
- choose:
- conditions:
- condition: template
value_template:
"{{ off_triple_click_action != none }}"
sequence: !input off_triple_click_action
- conditions:
- condition: trigger
id:
- hold-on-zha
sequence:
- repeat:
count: !input helper_max_loops
sequence:
- parallel:
- sequence: !input on_hold_action
- sequence:
- choose:
- conditions:
- condition: trigger
id:
- hold-on-zha
sequence:
- wait_for_trigger:
- trigger: event
event_type: zha_event
event_data:
device_id: "{{ zha_remote }}"
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-zha
sequence:
- repeat:
count: !input helper_max_loops
sequence:
- parallel:
- sequence: !input off_hold_action
- sequence:
- choose:
- conditions:
- condition: trigger
id:
- hold-off-zha
sequence:
- wait_for_trigger:
- trigger: event
event_type: zha_event
event_data:
device_id: "{{ zha_remote }}"
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
- choose:
- conditions:
- condition: trigger
id: click-on
sequence: !input on_click_action
- conditions:
- condition: trigger
id: click-off
sequence: !input off_click_action
- conditions:
- condition: trigger
id: hold-on
sequence: !input on_hold_action
- conditions:
- condition: trigger
id: hold-off
sequence: !input off_hold_action
- conditions:
- condition: trigger
id: double-click-on
sequence: !input on_double_click_action
- conditions:
- condition: trigger
id: double-click-off
sequence: !input off_double_click_action
- conditions:
- condition: trigger
id: triple-click-on-off
sequence: !input on_triple_click_action
- choose:
- conditions:
- condition: trigger
id: click-on-mqtt
sequence: !input on_click_action
- conditions:
- condition: trigger
id: click-off-mqtt
sequence: !input off_click_action
- conditions:
- condition: trigger
id: hold-on-mqtt
sequence: !input on_hold_action
- conditions:
- condition: trigger
id: hold-off-mqtt
sequence: !input off_hold_action
- conditions:
- condition: trigger
id: double-click-on-mqtt
sequence: !input on_double_click_action
- conditions:
- condition: trigger
id: double-click-off-mqtt
sequence: !input off_double_click_action
- conditions:
- condition: trigger
id: triple-click-on-mqtt
sequence: !input on_triple_click_action
- conditions:
- condition: trigger
id: triple-click-off-mqtt
sequence: !input off_triple_click_action
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment