Control multiple lights individually with IKEA Trådfri remote control, simulate double tap?

I’ve got the IKEA Trådfri remote control that I’d like to be able to control multiple lights individually with. What I’m thinking is that it should be possible to store the “active light” in an input component, and map one of the buttons on the controller to iterate a predefined list of lights and change the current active light.

Anyone done a similar setup and have scripts/automations in place?

I’ve just looked at it briefly, but I’m able to trigger automations by listening to deconze_event, long press, short press and hold for four of the buttons and simple press for the on/off button. So unless I’m told otherwise I think it should be possible.

Anyone know if it’s possible simulate or trigger “double tap” on a button using scripts or automations? The remote control doesn’t send double tap events itself, but unless Home Assistant scripts/automations aren’t too limiting it should be possible to simulate this behavior.

Hi!
I was wondering the exact same…
Did you manage to do it?

I saw @Robban mentioning his app daemon scripts for remote controls in some other thread shortly after I created this thread. They pretty much covered the base functionality I wanted for both the IKEA remote and the Hue Dimmer Switch so I’ve been using them.

They’re pretty self explanatory and well structured so I had no problems expanding them with the custom functionality I wanted that wasn’t already in place.

1 Like

That is in fact how I use my Tradfri remote control. With some difference though. First: I’m using zigbee2mqtt – so you have to adapt the trigger in the automation. Second: I’m using a single tap on the left arrow button to iterate the list of lights (and the right arrow button to iterate a list of predefined colors). But the mechanics should be visible.

The list of lights are an input_select (only two at the moment but the number of lights should be limited only by useability:

input_select:
  tradfri_remote_controlled_lamp:
    name: tradfri_remote_gesteuerte_lampen
    options:
      - light.vorzimmerdeckenlampe
      - light.huego
    initial: light.vorzimmerdeckenlampe

The automation action when selecting another lamp (single tap the left arrow button) consists of two parts. First is to select the next light in the defined input_select. Second is to make the selected light blink that the user can see, which lamp is selected currently:

automation:
  - alias: "Tradfri Remote: Lampe wechseln"
    initial_state: 'on'
    trigger:
      platform: mqtt
      topic: 'zigbee2mqtt/tradfriRemote'
    condition:
      condition: template
      value_template: "{{ 'arrow_left_click' == trigger.payload_json.action }}"
    action:
      - service: input_select.select_next
        data:
          entity_id: input_select.tradfri_remote_controlled_lamp
      - service: light.toggle
        data_template:
          entity_id: "{{ states.input_select.tradfri_remote_controlled_lamp.state }}"
          transition: 0
      - delay:
          milliseconds: 100
      - service: light.toggle
        data_template:
          entity_id: "{{ states.input_select.tradfri_remote_controlled_lamp.state }}"
          transition: 0

(The trigger/condition phrase above is just the zigbee2mqtt variant to recognize the button press.

This won’t help you with your deconz question but it fully works for me this way without any double tap.

… Oh – just realizing, that you already solved your problem. Hope, that my code will maybe help somebody else …

2 Likes

That’s cool @tok !
Exactly what I was thinking of.

Now I need to figure out why my Ikea remote does not pair with zigbee2mqtt.

Do you recall how you paired them?
I keep pressing 4 times the link button, nothing happens…

Oh yes, I do. It was as weird as it was fun. I had to build a zigbee network sniffer and listen the zigbee network traffic with wireshark to get the required data.

But this is long time ago. Nowadays it should be much simpler. Maybe you have to update your coordinator software as well as the zigbee2mqtt itself.

Like @tok said in the reply above, it is a lot easier nowadays. I actually paired my IKEA remote control yesterday with the instructions described here.

IKEA TRADFRI remote control (E1524)

Pair the remote to Zigbee2mqtt by holding it close to the coordinator and pressing the button next to the battery 4 times. The red light on the remote will now flash a few times.

In order for this to work I had to flash at least version 1.2.0 on the CC2531 USB stick. The current version is 1.2.1 (I currently have this version), but the version that made this pairing method possible is 1.2.0 as can be seen here.

Besides that I also updated my zigbee2mqtt Docker container to the latest version, but I’m not sure whether this was required. If you’re not using Docker you might need to update zigbee2mqtt itself in another way.

1 Like

I have setup Ikea trådfri remote with Zigbee2MQTT and can on/off light with trådfri remote. How can i adjust brightness and choose colour with trådfri remote.

- id: '1564076446387'
  alias: Table lamp trådfri switch
  trigger:
  - platform: mqtt
    topic: zigbee2mqtt/0x000d6ffffe1c9df9
  condition:
  - condition: template
    value_template: '{{ ''toggle'' == trigger.payload_json.action }}'
  action:
  - data:
      entity_id: light.light1
    service: light.toggle
  initial_state: 'on'

this is great, i can pair the ikea remote with home assisant via zibee2mqtt but how do i get zigbee2mqtt to pait with the led-controller so that i can control the under-counter lights from home assistant

You don’t. If the IKEA remote has been paired with Home Assistant through zigbee2mqtt and the lights have been paired with Home Assistant as well, all you need is an automation to control the lights with the remote.

There are a couple examples in this thread on how to do that.

I have created a AppDaemon app that allows controllers to control lights and media players for zigbee2mqtt, deconz and zha. You can download it from HACS. Here you have some details:

Let me know if you have any questions!

1 Like

I don’t know if anyone is still looking for a solution to this, but I stumbled upon this thread and it helped me put together the YAML below. Works great! No AppDaemon needed. So I’ll just leave this here for anyone to be stumbled upon.

This is the automation that switches on/off the selected light from the input_select:

alias: Switch
description: ''
trigger:
  - device_id: 75e739d13f346af8556e0ef9507ebc18
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_on
    id: on
  - device_id: 75e739d13f346af8556e0ef9507ebc18
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_off
    id: off
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: on
        sequence:
          - service: light.turn_on
            data_template:
              entity_id: '{{ states.input_select.rotation.state }}'
      - conditions:
          - condition: trigger
            id: off
        sequence:
          - service: light.turn_off
            data_template:
              entity_id: '{{ states.input_select.rotation.state }}'
    default: []
mode: single

And this is the “Rotation” automation that selects the next/previous option in the input_select list to be used in the automation above.

alias: Rotation
description: ''
trigger:
  - device_id: 75e739d13f346af8556e0ef9507ebc18
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: left
    id: left
  - device_id: 75e739d13f346af8556e0ef9507ebc18
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: right
    id: right
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: left
        sequence:
          - service: input_select.select_previous
            data: {}
            target:
              entity_id:
                - input_select.rotation
      - conditions:
          - condition: trigger
            id: right
        sequence:
          - service: input_select.select_next
            data: {}
            target:
              entity_id:
                - input_select.rotation
    default: []
  - service: tts.google_translate_say
    data:
      entity_id: media_player.woonkamer_nest
      language: nl
      message: '{{ states.input_select.rotation.state }}'
mode: single

I let Google Nest speaker say the current selected option in the input_select list so I know which light I will be controlling. Of course, the two automations can be merged together, but I like it this way for more transparency.