deCONZ lights blueprint for the IKEA Trådfri on/off switch, including dimming functionality (button hold). Based on poolcactus ZHA blueprint for this switch.
Get started
Click the badge to import this Blueprint: (needs Home Assistant Core 2021.3 or higher)
Or import this Blueprint by using the forum topic URL:
blueprint:
name: deCONZ - IKEA Tradfri on/off switch
description: |
"Control your deCONZ light(s) with IKEA Tradfri on/off switch
Select the Tradfri remote and your lights.
You can turn the lights On / Off, or hold the buttons to dim the lights"
domain: automation
input:
remote:
name: Remote
description: The remote that will control the lights
selector:
device:
integration: deconz
manufacturer: 'IKEA of Sweden'
model: 'TRADFRI on/off switch'
light:
name: Light
description: The lights that will be controlled
selector:
target:
entity:
domain: light
mode: restart
trigger:
- platform: event
event_type: deconz_event
event_data:
device_id: !input 'remote'
action:
- variables:
event: "{{ trigger.event.data.event }}"
- choose:
- conditions:
- "{{ event == 1002 }}"
sequence:
- service: light.turn_on
target: !input 'light'
data:
transition: 1
- conditions:
- "{{ event == 2002 }}"
sequence:
- service: light.turn_off
target: !input 'light'
data:
transition: 1
- conditions:
- "{{ event == 1001 }}"
sequence:
repeat:
while:
- condition: template
value_template: "{{ repeat.index < 10 }}"
sequence:
- service: light.turn_on
target: !input 'light'
data:
transition: 1
brightness_step_pct: 10
- delay: 1
- conditions:
- "{{ event == 2001 }}"
sequence:
repeat:
while:
- condition: template
value_template: "{{ repeat.index < 10 }}"
sequence:
- service: light.turn_on
target: !input 'light'
data:
transition: 1
brightness_step_pct: -10
- delay: 1
- conditions:
- "{{ event == 1003 }}"
sequence:
- service: light.turn_on
target: !input 'light'
- conditions:
- "{{ event == 2003 }}"
sequence:
- service: light.turn_on
target: !input 'light'
Are you getting the error when importing the blueprint? It looks like something is wrong with the trigger, do you have any IKEA switches in your deCONZ?
Just noticed in my automation, based on this blueprint, that I’ve chosen the device instead of the entity. Does your bulb show up as a device? Otherwise it looks correct!
I have a question: Short pressing “0” on the IKEA Tradfri On/Off turns it off, but: Short pressing “1” does not recover the lights as they last were (100% brightness), but at 1%.
How can I set this blueprint so that when I short-press “1” it turns on with 100% brightness?
This seems to work pretty well - thanks. Only caveat is the one vbaros also mentioned - it’s a bit slow with its dimming… I’ll have to tinker with it to see if I can change that… assuming you don’t have a fix coming anytime soon
This is working great, thanks! one question though. I’m controlling multiple lights with the switch. Sometimes not all the lights are on but I want to dim the lights that are on. When I try this the other lamps that are off at that time will go on as well.
Do you know a way to only dim the active lamps linked to the switch?
I seem to have an issue - not 100% sure if related to the blueprint.
When controlling Hue lights, when turning them on, they always turn on at a very dim setting. However, the Hue app believes they are set at the previous (high setting)
I want them to come on at the previous brightness.