deCONZ - IKEA five button remote for lights

Click the badge to import this Blueprint: (needs Home Assistant Core 2021.3 or higher)

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

This is a fork of the blueprint from Frenck, but for use with deCONZ.

This is a blueprint for the IKEA five-button remotes (the round ones), specifically for use with deCONZ.

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.

This is what the Blueprint looks like from the UI:

Blueprint, which you can import by using this forum topic URL:

blueprint:
  name: deCONZ - 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 an short and long button press action. This allows you to assign, e.g., a scene or anything else.
    '
  domain: automation
  input:
    remote:
      name: Remote
      description: IKEA remote to use
      selector:
        device:
          integration: deconz
          manufacturer: IKEA of Sweden
          model: TRADFRI remote control
    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_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: {}
mode: restart
max_exceeded: silent
variables:
  force_brightness: !input "force_brightness"
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:
          - 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:
          - "{{ event == 2002 }}"
        sequence:
          - service: light.turn_on
            target: !input "light"
            data:
              brightness_step_pct: 10
              transition: 1
      - conditions:
          - "{{ event == 2001 }}"
        sequence:
          - repeat:
              count: 10
              sequence:
                - service: light.turn_on
                  target: !input "light"
                  data:
                    brightness_step_pct: 10
                    transition: 1
                - delay: 1
      - conditions:
          - "{{ event == 3002 }}"
        sequence:
          - service: light.turn_on
            target: !input "light"
            data:
              brightness_step_pct: -10
              transition: 1
      - conditions:
          - "{{ event == 3001 }}"
        sequence:
          - repeat:
              count: 10
              sequence:
                - service: light.turn_on
                  target: !input "light"
                  data:
                    brightness_step_pct: -10
                    transition: 1
                - delay: 1
      - conditions:
          - "{{ event == 4002 }}"
        sequence: !input "button_left_short"
      - conditions:
          - "{{ event == 4001 }}"
        sequence: !input "button_left_long"
      - conditions:
          - "{{ event == 5002 }}"
        sequence: !input "button_right_short"
      - conditions:
          - "{{ event == 5001 }}"
        sequence: !input "button_right_long"
11 Likes

Thanks. Working apart the fact that I don’t have events for long messages (4001 & 5001) : are you sure they exists ? (BTW, you indicated twice 5001)

6 months or so ago I recorded the following codes :

Power toggle :
	"id": "tradfri_remote_control",
	"event": 1002

Left : 
	"id": "tradfri_remote_control",
	"event": 4002

Left Hold : 
	"id": "tradfri_remote_control",
	"event": 4003

	"id": "tradfri_remote_control",
	"event": 4001

Right : 
	"id": "tradfri_remote_control",
	"event": 5002

Right Hold :
	"id": "tradfri_remote_control",
	"event": 5003

	"id": "tradfri_remote_control",
	"event": 5001

Up : 
	"id": "tradfri_remote_control",
	"event": 2002

Up Hold : 
	"id": "tradfri_remote_control",
	"event": 2003

	"id": "tradfri_remote_control",
	"event": 2001

Down Hold :
	"id": "tradfri_remote_control",
	"event": 3003

	"id": "tradfri_remote_control",
	"event": 3001

Down button (4001) seems to be missing and “Left long press” and “right long press” are both 5001 in this blueprint.

Yes they’re all supported, I don’t know if your pairing is not perfect or what might be the cause but they should indeed work

1 Like

Awesome @Bram_Kragten :tada:

Thanks for sharing!
Helped me create my own custom deCONZ 5 Button and On/Off dimmer Trådfri remote blueprints :slight_smile:

1 Like

Thanks! Adjusted.

Hi Bram!

Great work on the blueprints feauture!!

Also on this remote! Ive been holding back on moving all my zigbee devices away from HUE and IKEA gateways becuase of my lack of coding knowledge to program the remotes!

This solves it. Sort of.
Is there a way to change the integration type? I use zigbee2mqtt. Is this a simple platform change in your blueprint, or a whole new thing?

It would be great to have this remote and I guess the other main ones like Phillips hue on the main platforms like DoCONZ, ZHA, and Zigbee2mqtt.

Again, great work.

Regards
Abraham (Pronounced a-Bram! haha)

Thanks Abraham!

Here is a blueprint for this remote using Zigbee2MQTT: Zigbee2Mqtt - IKEA five button remote

You could take a look at how he did it. I don’t have any experience with Z2M myself.

1 Like

Thanks for sharing!

I would use the light entity attributes in sequence but I unable to use it.
I tried to set a variable like :

variables:
  my_light: !input 'light'

and get attribute with {{ state_attr(my_light,"effects") }} but without success!

Is it possible ?

Great Blueprint @Bram_Kragten! Thanks for sharing.

Any idea on how to include the functionality to change color temp (if light supports this feature) using left and right buttons?

I’m getting long presses on the up and down but not the left and right. They used to work on both my buttons as I had automations setup for them but recently neither have worked since a Deconz update.

update - tried this and it seems to work now -

If your Tradfri remote only shows xxx2 events HOLD on/off button. When event changes from 1002 to xxx3 (about 4 seconds) quickly RELEASE on/off button and DOUBLECLICK < or >. Check the < and > are now showing 4003 and 5003. If not try repeating the sequence, it took one of mine a few goes to catch. Repeat to put it back into non-long-click mode.

I think the numbers for left and right buttons are mixed up. The yaml says 5xxx for left and 4xxx for right but my events are showing 4xxx for left and 5xxx for right.

Loving the new blueprints, this is much nicer than my individual automations for each button! thanks.

1 Like

This is what I’ve documented earlier for device triggers https://github.com/home-assistant/core/blob/ad634a393b352b8f8b3000debad386cef0cce5b4/homeassistant/components/deconz/device_trigger.py#L180

1 Like

Oops… I should test these things before posting… Corrected, thanks!

Hi Bram,
I just can’t seem to get this blueprint to work. I am new to HA anyway.
I’ve imported this blueprint, then clicked on “create automation”
Selected the light i want to use in the UI.
Selected the button i want to use.
Clicked save.
Doesn’t work. What’s wrong here?
YAML:

description: lalala
use_blueprint:
  path: Bram_Kragten/deconz-ikea-five-button-remote-for-lights.yaml
  input:
    brightness: '50'
    remote: ee1f79b141fd3253824c97c197cf5e37
    button_left_short:
      - type: toggle
        device_id: 148110ee22782b2e2682c0bcbba7ddf1
        entity_id: light.bedroom_2
        domain: light
    button_right_short:
      - type: toggle
        device_id: 863baeead3b0b2dfe72122d3246794b0
        entity_id: light.desk_3
        domain: light
    light:
      device_id: 1034a4ba8d4bfc30c21d97b38941b4ea

Is nothing working? Are you sure the remote is working correctly?
Can you see the events if you listen to the deconz_event in the events dev tools?

1 Like

Idk what happened, luckily it was a fresh install of HA, so i just reinstalled it and then it worked. Thanks for replying anyway

1 Like

Hey, G-great Blueprint, thanks @Bram_Kragten !!

It works perfectly with a group of Ikea colour lights, I’m just trying to figure out how to

  • Change colour of the group using long press on left and right buttons
  • Change group of lights using short press on left and right button to control different lights

How could I do the 2 differents cases ?

Thanks !!

For the first, create a scene that you activate.

The second would not be possible with this blueprint, you would need to change it to use an input helper for the target, that would be set when pressing the right/left buttons