Skip to content

Instantly share code, notes, and snippets.

@eudaldca
Last active October 17, 2025 17:11
Show Gist options
  • Select an option

  • Save eudaldca/2d45a81e1604810ba4379a240a3068ed to your computer and use it in GitHub Desktop.

Select an option

Save eudaldca/2d45a81e1604810ba4379a240a3068ed to your computer and use it in GitHub Desktop.
Home assistant blueprint to control light with Rodret (205.281.28) button
blueprint:
name: MQTT IKEA RODRET Light Control
author: Eudaldca
description: >
Control a light using the IKEA RODRET MQTT button.
"on" and "off" toggle the light.
"brightness_move_up" and "brightness_move_down" adjust brightness until "brightness_stop".
domain: automation
input:
light_target:
name: Light
description: The target light entity to control.
selector:
target:
entity:
- domain: light
button_device:
name: IKEA RODRET wireless dimmer
description: Select the IKEA RODRET MQTT button
selector:
device:
filter:
- integration: mqtt
manufacturer: IKEA
model: RODRET wireless dimmer/power switch
multiple: false
interval_ms:
name: Brightness step interval (ms)
description: Time between brightness updates while dimming.
default: 300
selector:
number:
min: 10
max: 200
step: 1
unit_of_measurement: ms
step_pct:
name: Brightness step percentage
description: Percentage change per brightness step.
default: 5
selector:
number:
min: 1
max: 10
step: 1
unit_of_measurement: "%"
mode: restart
max_exceeded: silent
variables:
interval: !input interval_ms
step: !input step_pct
light_target: !input light_target
trigger:
- trigger: device
domain: mqtt
device_id: !input button_device
type: action
subtype: "on"
id: "on"
- trigger: device
domain: mqtt
device_id: !input button_device
type: action
subtype: "off"
id: "off"
- trigger: device
domain: mqtt
device_id: !input button_device
type: action
subtype: "brightness_move_up"
id: "up"
- trigger: device
domain: mqtt
device_id: !input button_device
type: action
subtype: "brightness_move_down"
id: "down"
- trigger: device
domain: mqtt
device_id: !input button_device
type: action
subtype: "brightness_stop"
id: "stop"
action:
- choose:
- conditions: "{{ trigger.id == 'on' }}"
sequence:
- service: light.turn_on
target: "{{ light_target }}"
- conditions: "{{ trigger.id == 'off' }}"
sequence:
- service: light.turn_off
target: "{{ light_target }}"
- conditions: "{{ trigger.id == 'up' }}"
sequence:
- repeat:
while:
- condition: template
value_template: "{{ trigger.id == 'up' }}"
sequence:
- service: light.turn_on
target: "{{ light_target }}"
data:
brightness_step_pct: "{{ step }}"
- delay:
milliseconds: "{{ interval }}"
- conditions: "{{ trigger.id == 'down' }}"
sequence:
- repeat:
while:
- condition: template
value_template: "{{ trigger.id == 'down' }}"
sequence:
- variables:
current_brightness_pct: >
{% set entities = light_target.entity_id %}
{% if entities is string %}
{% set brightness = state_attr(entities, 'brightness') | int(0) %}
{% else %}
{% set brightness = state_attr(entities[0], 'brightness') | int(0) %}
{% endif %}
{{ (brightness / 255 * 100) | int }}
- if:
- condition: template
value_template: "{{ current_brightness_pct <= 10 }}"
then:
- service: light.turn_on
target: "{{ light_target }}"
data:
brightness_pct: 1
- stop: "Brightness reached minimum threshold, set to 1%"
else:
- service: light.turn_on
target: "{{ light_target }}"
data:
brightness_step_pct: "{{ -step }}"
- delay:
milliseconds: "{{ interval }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment