deConz - IKEA Tradfri on/off switch

Hey there,

i did a Deconz blueprint of Xelloss99 “ZHA - IKEA Tradfri On/Off Switch”

You can use following events:

  • On short press
  • Off short press
  • On long press
  • Off long press
  • On long press release
  • Off long press release
blueprint:
  name: deConz - IKEA wireless on/off switch
  description: Control anything using IKEA wireless on/off switch

  domain: automation
  input:
    remote:
      name: switch
      description: IKEA wireless on/off switch to use
      selector:
        device:
          integration: deconz
          manufacturer: IKEA of Sweden
          model: TRADFRI on/off switch
    button_on_short:
      name: On button press
      description: Action to run on press of On button
      default: []
      selector:
        action:
    button_off_short:
      name: Off button press
      description: Action to run on press of Off button
      default: []
      selector:
        action:
    button_on_long:
      name: On button hold
      description: Action to run on long press of On button
      default: []
      selector:
        action:
    button_off_long:
      name: Off button hold
      description: Action to run on long press of Off button
      default: []
      selector:
        action:
    button_on_release:
      name: On button release
      description: Action to run on release long press of On button
      default: []
      selector:
        action:
    button_off_release:
      name: Off button release
      description: Action to run on release long press of Off button
      default: []
      selector:
        action:

mode: restart
max_exceeded: silent

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: !input button_on_short

      - conditions:
          - "{{ event == 2002 }}"
        sequence: !input button_off_short

      - conditions:
          - "{{ event == 1001 }}"
        sequence: !input button_on_long

      - conditions:
          - "{{ event == 2001 }}"
        sequence: !input button_off_long

      - conditions:
          - "{{ event == 1003 }}"
        sequence: !input button_on_release

      - conditions:
          - "{{ event == 2003 }}"
        sequence: !input button_off_release

Have fun with it.

2 Likes

This blueprint works with no issues for me.

I’m controlling a mix of Z-Wave modules and Zigbee lights (IKEA), and no issues. I replaced all my other automations (one for each button/action), so this is a nice way to clean up!

Thank you!

Hi,

I have added the blueprint and tried to create a simple automation the would toggle my ikea tradfri power outlet when “ikea tradfri on/off switch” on button is pressed.

I can toggle the switch from UI but the automation doesnt seem to detect events from the “on/off switch”.

I did add the “on/off switch” as a switch of brand “Other” inside Phoscon.

Any thoughts of what might be wrong is appreciated.

Thanks!

//Martin

in this case I would delete the two lines:
in “input”->“remote”

          manufacturer: IKEA of Sweden
          model: TRADFRI on/off switch

then it should work with all deconz elements

ok i’m wrong, i thought your switch is not recognized. but i think since you added your switch differently the events (in the coog for example “2002”) are different.

You can trigger a certain event (short press) and see in the supervisor in the Decons add-on log what the command is called there and change it accordingly in the blueprint

@Lasse_R Thanks!

I am a bit curious. How would you add the “Ikea Tradfri On/Off Switch” to Phoscon if not by Other brand?
The only ones listed are “remote control” and “dimmer”.

I did add some extra debug output to deconz add-on log but still not able to find events from the switch.

Inside Deconz my “On/Off Switch” turns green when i press the On button. See image below.
Perhaps this can help solve it :slight_smile:

i add it like a “remote” or “dimmer”. i tested it with both. just use one of them. deConz get it right.

edit: i add the switch in the Phoscon GUI

check the event-code there:

http://hassio.local/hassio/addon/core_deconz/logs

trigger the button -> refresh the log -> got something like “13:25:55:014 [INFO] - Button 2002 Off TRADFRI on/off switch”