Skip to content

Instantly share code, notes, and snippets.

@trilorian
Created May 7, 2024 13:57
Show Gist options
  • Select an option

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

Select an option

Save trilorian/64a2b7f3217981a82a0c4efa597edb7e to your computer and use it in GitHub Desktop.
blueprint:
name: IKEA Rodret Dimmer
description: "## IKEA RODRET Dimmer remote (v1.2)
Only for use with [ZHA](https://www.home-assistant.io/integrations/zha/)
Available controls:
- Click the **on** or **off** buttons
- Click and hold the **on**/**off** buttons
- Double click the **on** or **off** buttons
- Triple click the **on** or **off** buttons
All actions are optional.
"
source_url: https://github.com/trilorian/zha/blob/main/ikea/rodret/ikea-rodret_E2201_ZHA.yaml
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
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: {}
light_entity:
name: Light entity
selector:
entity:
domain: light
dimming_lights:
name: Dimming lights
description:
Choose lights to dim (if any)
default: []
selector:
entity:
domain: light
multiple: true
minimum_light_level:
name: Minimum light level when decreasing brightness
default: 20
selector:
number:
min: 1.0
max: 99.0
step: 1.0
mode: slider
brightness_step_pct:
name: Brightness step
description:
Choose a step to increase/decrease brightness, default is 10%.
default: 10
selector:
number:
min: 1.0
max: 50.0
step: 1.0
mode: slider
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: {}
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
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: "{{ zha_remote }}"
command: "on"
cluster_id: 6
endpoint_id: 1
id: click-on-zha
- platform: event
event_type: zha_event
event_data:
device_id: "{{ zha_remote }}"
command: "off"
cluster_id: 6
endpoint_id: 1
id: click-off-zha
- platform: 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
- platform: 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
- platform: 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
action:
- variables:
brightness_step_pct: !input brightness_step_pct
minimum_light_level: !input minimum_light_level
helper_hold_delay: !input helper_hold_delay
light: !input light_entity
- choose:
- conditions:
- condition: trigger
id:
- click-on-zha
sequence:
- wait_for_trigger:
- platform: 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: !input on_click_action
default:
- wait_for_trigger:
- platform: 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:
# Double click, check if on_double_click_action is defined
- condition: template
value_template: "{{ on_double_click_action != none }}"
sequence: !input on_double_click_action
default: !input on_click_action
default:
- choose:
- conditions:
# Triple click, check if on_triple_click_action is defined
- condition: template
value_template: "{{ on_triple_click_action != none }}"
sequence: !input on_triple_click_action
default: !input on_click_action
- choose:
- conditions:
- condition: trigger
id:
- click-off-zha
sequence:
- wait_for_trigger:
- platform: 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: !input off_click_action
default:
- wait_for_trigger:
- platform: 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:
# Double click, check if off_double_click_action is defined
- condition: template
value_template: "{{ off_double_click_action != none }}"
sequence: !input off_double_click_action
default: !input off_click_action
default:
- choose:
- conditions:
# Triple click, check if off_triple_click_action is defined
- condition: template
value_template: "{{ off_triple_click_action != none }}"
sequence: !input off_triple_click_action
default: !input off_click_action
- choose:
- conditions:
- condition: trigger
id:
- hold-on-zha
sequence:
- repeat:
count: !input helper_max_loops
sequence:
- parallel:
- service: light.turn_on
target:
entity_id: light
data:
brightness_step_pct: "{{ brightness_step_pct }}"
- delay: "{{ helper_hold_delay }}"
# - sequence:
# - choose:
# - conditions:
# - condition: trigger
# id:
# - hold-on-zha
# sequence:
# - wait_for_trigger:
# - platform: 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:
- hold-off-zha
sequence:
- repeat:
count: !input helper_max_loops
sequence:
- parallel:
- sequence:
- choose:
- conditions:
- condition: trigger
id:
- hold-off-zha
sequence:
- wait_for_trigger:
- platform: 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment