Select your light (or multiple lights) entities and the brightness up/down short click and hold buttons will control those lights. To get Holding working, I added 2 actions “Up Release” and “Down Release” - you don’t need to put any actions here to get it working.
A quote from the original:
It was specially created for use with (any) light(s). As the basic light controls are already mapped in this blueprint.
The middle “on” button, toggle the lights on/off to the last set brightness (unless the force brightness is toggled on in the blueprint). Dim up/down buttons will change the brightness smoothly and can be pressed and hold until the brightness is satisfactory.
The “left” and “right” buttons can be assigned to a short and long button press action. This allows you to assign, e.g., a scene or anything else.
Blueprint
Import the blueprint by using the forum topic URL! Or use the button.
blueprint:
name: Z2M 2.0 - IKEA five button remote for lights
description: 'Control lights with an IKEA five button remote (the round ones).
The middle "on" button, toggle the lights on/off to the last set brightness
(unless the force brightness is toggled on in the blueprint).
Dim up/down buttons will change the brightness smoothly and can be pressed
and hold until the brightness is satisfactory.
The "left" and "right" buttons can be assigned to a short and long button
press action. This allows you to assign, e.g., a scene or anything else.
This is a fork of @Frenck''s blueprint for ZHA found here https://community.home-assistant.io/t/zha-ikea-five-button-remote-for-lights/253804
'
domain: automation
input:
remote:
name: Remote
description: IKEA remote to use
selector:
device:
integration: mqtt
manufacturer: IKEA
# model: TRADFRI remote control (E1524/E1810)
light:
name: Light(s)
description: The light(s) to control
selector:
target:
entity:
domain: light
force_brightness:
name: Force turn on brightness
description: 'Force the brightness to the set level below, when the "on" button
on the remote is pushed and lights turn on.
'
default: false
selector:
boolean: {}
brightness:
name: Brightness
description: Brightness of the light(s) when turning on
default: 50
selector:
number:
min: 0.0
max: 100.0
mode: slider
step: 1.0
unit_of_measurement: '%'
button_long_max_loop_repeats:
name: (Optional) Button long press - Maximum loop repeats
description: >-
Maximum number of repeats for the custom action, when looping is enabled.
Use it as a safety limit to prevent an endless loop in case the corresponding stop event is not received.
default: 100
selector:
number:
min: 1
max: 5000
mode: slider
step: 1
button_left_short:
name: Left button - short press
description: Action to run on short left button press
default: []
selector:
action: {}
button_left_long:
name: Left button - long press
description: Action to run on long left button press
default: []
selector:
action: {}
button_right_short:
name: Right button - short press
description: Action to run on short right button press
default: []
selector:
action: {}
button_right_long:
name: Right button - long press
description: Action to run on long right button press
default: []
selector:
action: {}
brightness_up_release:
name: Up Release
description: Action to run on up release - leave this blank for default "stop brightness move" action
default: []
selector:
action: {}
brightness_down_release:
name: Down Release
description: Action to run on down release - leave this blank for default "stop brightness move" action
default: []
selector:
action: {}
source_url: https://community.home-assistant.io/t/zigbee2mqtt-ikea-five-button-remote/255308
mode: restart
max_exceeded: silent
variables:
force_brightness: !input 'force_brightness'
trigger:
- domain: mqtt
device_id: !input remote
type: action
subtype: toggle
trigger: device
- domain: mqtt
device_id: !input remote
type: action
subtype: brightness_down_hold
trigger: device
- domain: mqtt
device_id: !input remote
type: action
subtype: brightness_down_release
trigger: device
- domain: mqtt
device_id: !input remote
type: action
subtype: brightness_down_click
trigger: device
- domain: mqtt
device_id: !input remote
type: action
subtype: arrow_left_hold
trigger: device
- domain: mqtt
device_id: !input remote
type: action
subtype: arrow_left_release
trigger: device
- domain: mqtt
device_id: !input remote
type: action
subtype: arrow_left_click
trigger: device
- domain: mqtt
device_id: !input remote
type: action
subtype: toggle_hold
trigger: device
- domain: mqtt
device_id: !input remote
type: action
subtype: brightness_up_hold
trigger: device
- domain: mqtt
device_id: !input remote
type: action
subtype: brightness_up_release
trigger: device
- domain: mqtt
device_id: !input remote
type: action
subtype: brightness_up_click
trigger: device
- domain: mqtt
device_id: !input remote
type: action
subtype: arrow_right_click
trigger: device
- domain: mqtt
device_id: !input remote
type: action
subtype: arrow_right_hold
trigger: device
- domain: mqtt
device_id: !input remote
type: action
subtype: arrow_right_release
trigger: device
action:
- variables:
command: "{{ trigger.payload }}"
button_long_max_loop_repeats: !input button_long_max_loop_repeats
- choose:
- conditions:
- '{{ command == ''toggle'' }}'
sequence:
- choose:
- conditions: '{{ force_brightness }}'
sequence:
- service: light.toggle
target: !input 'light'
data:
transition: 1
brightness_pct: !input 'brightness'
default:
- service: light.toggle
target: !input 'light'
data:
transition: 1
- conditions:
- '{{ command == ''brightness_up_click'' }}'
sequence:
- service: light.turn_on
target: !input 'light'
data:
brightness_step_pct: 10
transition: 1
- conditions:
- '{{ command == ''brightness_up_hold'' }}'
sequence:
- repeat:
while: '{{ repeat.index < button_long_max_loop_repeats | int }}'
sequence:
- service: light.turn_on
data:
brightness_step_pct: 10
transition: 1
target: !input 'light'
- delay: '1'
- conditions:
- '{{ command == ''brightness_up_release'' }}'
sequence: !input 'brightness_up_release'
- conditions:
- '{{ command == ''brightness_down_click'' }}'
sequence:
- service: light.turn_on
target: !input 'light'
data:
brightness_step_pct: -10
transition: 1
- conditions:
- '{{ command == ''brightness_down_hold'' }}'
sequence:
- repeat:
while: '{{ repeat.index < button_long_max_loop_repeats | int }}'
sequence:
- service: light.turn_on
data:
brightness_step_pct: -10
transition: 1
target: !input 'light'
- delay: '1'
- conditions:
- '{{ command == ''brightness_down_release'' }}'
sequence: !input 'brightness_down_release'
- conditions:
- '{{ command == ''arrow_left_click'' }}'
sequence: !input 'button_left_short'
- conditions:
- '{{ command == ''arrow_left_hold'' }}'
sequence: !input 'button_left_long'
- conditions:
- '{{ command == ''arrow_right_click'' }}'
sequence: !input 'button_right_short'
- conditions:
- '{{ command == ''arrow_right_hold'' }}'
sequence: !input 'button_right_long'
Edit 5/30/22: Add details about Zigbee2MQTT legacy attributes setting.
Edit 6/14/22: Remove code block formatting for previous edit, added link to documentation instead.
Edit 1/5/25: A lot - Keeping original functionality with the new Device action triggers in the blueprint
The brightness changes by clicking up and down buttons (brightness_up_click and brightness_down_click) but not when holding those buttons pressed.
Actually, in the blueprint, there is no action for brightness_up_hold or for brightness_down_hold.
I am interested to see how that can be done with an automation. So far, the smooth dimming works for me only when binding the remote to a group of lights.
Can you put the YAML of the blueprint in the post itself instead of (just) linking to the gist? That way people can use the url of this forum topic to import the blueprint.
@razvanmdobre My “office lights” are a Zigbee2Mqtt group of 4 bulbs that work smoothly together for dimming, but yeah it does take 10 clicks to get it to dim all the way down. I’ll look how @frenck did it and try to add the Hold actions!
This is working great! I have an issue tho that maybe I can get some help with:
I have an IKEA LED1732G11 light, that has the ability to adjust its color temperature. Originally I had the functionality that pressing/holding left and right increased/decreased the color temperature. Do you know by any chance how I can get that functionality back? Z2M doesnt give me an action on the lights entity to set the color temp, albeit the light card on HA does allow me to set it, so there has to be some mqtt command for it, I just don’t know how to investigate it.
Thanks!
@sztanpet My best guess would be to assign Left button - long press to a script that grabs the current color temperature, then increments along up or down. That’s a good idea, though.
Here’s some logic I’m using for holding down the brightness up/down buttons that maybe could be used in a similar way for color/temperature too.
sequence:
- repeat:
until:
- condition: state
entity_id: sensor.ikea_remote_action
state: arrow_left_release
attribute: action
sequence:
- service: light.turn_on
data:
# change color temp here by an increment instead of brightness
brightness_step_pct: 10
transition: 1
entity_id: light.target_light
- delay: '1'
So I tried multiple things, but I’m guessing this just won’t work without another variable that tracks the value of the color temperature, maybe it doesn’t update while the repeat-until is going on?
What I’m trying to do is to access the target lights state, get the current color temperature and adjust relative to it, either increasing or decreasing it.
It doesn’t work at all, maybe I’m doing it completely wrong, but there isn’t much documentation on how to access the target in the action, or I just didn’t find the relevant docs. Here is a snippet, everything else is basically the same as in the OP
It looks like you’re heading in the right direction. I’d test the templates with the /developer-tools/template section and perhaps turn the sequence into a Script to test it without the Blueprint bits. My Tradfri bulb unfortunately doesn’t support color_temp so I’m not sure how to help test your sequence.
{% if state_attr('light.bulb', "color_temp") | int - 100 < state_attr('light.bulb', "min_mireds") %}
{{- state_attr('light.bulb', "min_mireds") -}}
{% else%}
{{- state_attr('light.bulb', "color_temp") | int - 100 -}}
{% endif %}
I’ve been messing with this thing, trying to increase the speed of the repeat sequence, but it seems to me that the repeat sequence doesn’t work correctly. I changed the until-state to arrow_left_click as a test, so that the brightness should continue increasing/decreasing until I press the left button. It doesn’t work. My IKEA remotes just sends a hold message every second or so until I release the brightness buttons, and the brightness step sequence only seems to activate when a new hold message is sent. Probably because the repeat sequences are preceded by - conditions: - “{{ command == ‘brightness_up_hold’ }}”. I suspect that as soon as there isn’t a brightness hold message being received, the condition is false, and thus the repeat sequence is cut short. Maybe we should have multiple trigger-action rules. I’m going to try a few things.
I tried that first, yes. The behaviour remained the same as before that change. Just a change once every second or so. Even when I change it to 100 milliseconds.
EDIT: nevermind, I just discovered that it’s a limit in my lamps. Apparently, my Philips Hue does work smoothly now. My WiZ lights have some sort of limit. The problem is not with this blueprint.
@Revorge I’m using zigbee2mqtt for a while now and I’ve disabled the legacy triggers. I’m using the MQTT device triggers as you mentioned. For that reason I cannot use this kind of blueprints because the action attribute isn’t reset to the default value.
Do you know if it is possible to create blueprints using device triggers? I never found any examples/documentation about it.
WoW, just after the conference i thought of looking in to creating one for Zigbee2mqtt. But never got the time for it. I have imported it but not yet tested it. I was wondering is it possible to add 2 remotes to 1 blueprint. In my case i have 3 ikea lights which i can control from 2 side of the home. Not sure if this is the correct translating but compare it with a hotel switching where you can put on the light from on side of the room en turn it off on the other side of the room.
The quick and dirty way now would be to duplicate the automation but was wondering if it even is possible to add 2 remotes to 1 blueprint.
Again Thanks! This saves me already so much time setting up automations
I think you’re talking about a 2-way switch. Or is it a 3 way switch. Anyways! I imagine you could rewrite the blueprint to allow for multiple remotes. I think the point of the blueprints is to easily duplicate the automation with different settings, or in your case, the same target light. Or, use the blueprint to create an automation once, then from the automation, use “Duplicate automation” and select a different remote.
Good thinking, but when i duplicate and select edit with Yaml i don’t see the real automation but still the yaml for the blueprint. (still new to blue print so might be doing something wrong)
Oh, that’s interesting, you’re right, the Edit with YAML button on the Automation shows the blueprint yaml, but only things that I’ve configured? But the Edit with UI still seems to be normal.
In your case, I’d just use Edit with UI and after duplicating the Automation just change the remote entity. You’ll end up with two Automations but maybe that’s just a limitation of the blueprint I wrote.
That would work, but currently looking in to the blueprint yaml and found a way to select multiple remotes, but still figuring out how to connect it to the trigger. Think it has something to do with the “sequence” option but can’t find any documentation on it.