Another Deconz - Ikea 5 button remote Blueprint , this time with long press on all buttons

As the topic title, this blueprint lets you set a long or short press of all 5 buttons to do whatever you like.
v2 I’ve also added long press release for up and down buttons.
enjoy!

blueprint:
  name: deCONZ - IKEA five button remote
  description: 'Control anything using IKEA five button remote

    '
  domain: automation
  input:
    remote:
      name: Remote
      description: IKEA remote to use
      selector:
        device:
          integration: deconz
          manufacturer: IKEA of Sweden
          model: TRADFRI remote control
    button_on_off_short:
      name: On off button short press
      description: Action to run on press on off button
      default: []
      selector:
        action: {}
    button_on_off_long:
      name: On off button long press
      description: Action to run on press on off button
      default: []
      selector:
        action: {}
    button_brightness_up_short:
      name: Brightness up button - short press
      description: Action to run on short brightness up press
      default: []
      selector:
        action: {}
    button_brightness_up_long:
      name: Brightness up button - long press
      description: Action to run on long brightness up press
      default: []
      selector:
        action: {}
    button_brightness_up_long_release:
      name: Brightness up button - long press release
      description: Action to run on long brightness up release
      default: []
      selector:
        action: {}
    button_brightness_down_short:
      name: Brightness down button - short press
      description: Action to run on short brightness down press
      default: []
      selector:
        action: {}
    button_brightness_down_long:
      name: Brightness down button - long press
      description: Action to run on long brightness down press
      default: []
      selector:
        action: {}
    button_brightness_down_long_release:
      name: Brightness down button - long press release
      description: Action to run on long brightness down release
      default: []
      selector:
        action: {}
    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
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_off_short'
  - conditions:
    - '{{ event == 1001 }}'
    sequence: !input 'button_on_off_long'
  - conditions:
    - '{{ event == 2003 }}'
    sequence: !input 'button_brightness_up_long_release'
  - conditions:
    - '{{ event == 2002 }}'
    sequence: !input 'button_brightness_up_short'
  - conditions:
    - '{{ event == 2001 }}'
    sequence: !input 'button_brightness_up_long'
  - conditions:
    - '{{ event == 3003 }}'
    sequence: !input 'button_brightness_down_long_release'
  - conditions:
    - '{{ event == 3002 }}'
    sequence: !input 'button_brightness_down_short'
  - conditions:
    - '{{ event == 3001 }}'
    sequence: !input 'button_brightness_down_long'
  - 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'

1 Like

Nice one :slight_smile:

Even there are a few others yet, this one offers most flexibility by not being bind to only using it for controlling lights only. :+1:

As the remote supports 12 key events and this blueprint currently offers 10: will you add those 2 missing 2 button events?

  1. Button up long press release: 2003
  2. Button down long press release: 3003

And the long press event on the middle (big) button can´t be used because the short press action is always executed before. This is how the remote works, nothing the blueprint can work around. So basically long press events can only be used when there´s no short press event (or it´s OK or even desired to have the short press event fired before).

I’ll look into adding them for you.

I’ve added these for you. Let me know if all wors as expected.

1 Like

Yep, this seems to be an issue but isnt always, i use it in the following way:

Entering a room that is dark: Short press turns on lights
Long press also turns on heating and music.
So a single long press turns on lights, then heating and music.

How do you get 4001 and 5001 to work? When I long-press the arrow keys I just get a repeat of the short-short press (4002 and 5002) every second…I tested on all my remotes, same. They have the latest firmware but are a few years old…

They do work for me. i think there is an issue with the remote that if you do a long middle press, the long side presses no longer work for a short period.
see the issue here on their github https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3756

i dont use the long side press for anything currently, i just checked it and it is doing what you said now, even if i havent long pressed the middle button recently. ive added a comment on the github issue, hopefully someone can help. My remote firware was 1.3.x, I’m trying to update it to the latest, hopefully that fixes it.
I was under the misconception that deconz automatically updated device firmwares.

1 Like

I discovered a strange behaviour when one button has more than one action:

(example for Right button - long press event):

      - conditions:
          - '{{ event == 5001 }}'
        sequence:
          - service: cover.set_cover_position
            data:
              position: 71
            target:
              entity_id: cover.rollladen
          - delay:
              hours: 0
              minutes: 0
              seconds: 20
              milliseconds: 0
          - service: cover.stop_cover
            target:
              entity_id: cover.rollladen
            data: {}

When the button is normally pressed (for maybe a second), only the first action is performed. The second (here a wait for 20 seconds action) is not:

When the button is pressed for an extremely long time (longer than all actions including wait would take in total), all actions are performed:

I believe this is due to the fact, that the next deconz event sent when releasing the long press button (after 5001/long press right button it is 5003/long press right button release) some kind of aborts the execution of the action queue for the former 5001/long press right button event.

(Sidenote: Interestingly, the blueprint does not provide the 5003/long press right button release event nor the 4003/long press left button release event. Therefore, the blueprint does nothing:)

MAIN QUESTIONS:

  1. Why does pressing another button cancel/kill the execution of the commands from a former button event?
    ==> Update: I think I found the answer to this:


    ==> According to Automation Modes - Home Assistant this means restart: Start a new run after first stopping previous run. - that’s exactly the problem when having more than one quick action on a button!

  2. How to solve this?

First ideas:

  1. (Workaround) Using scripts for all long press button events, so the execution can not be aborted by the blueprint/automation. Big downside: gets quite complicated to manage, not everything in one place.
  2. (Workaround) For all long press button events, put all actions after the first one (so 2nd, 3rd, 4th and so on) in the corresponding long press release button event.
  3. Set the automation mode from restart to parallel.

I’m going to try #3 first.


Request @samnewman86: could you please update this blueprint and
a) set a less problematic automation mode (like parallel) and/or explain, why the automation mode is set to restart
b) add the 5003/long press right button release and 4003/long press left button release button events


Update: #3 was successful. I also added the two missing long press release button events (left + right button). Now all actions from a button are performed (due to the automation mode change):

This is what I used temporarily until this official blueprint gets updated:

blueprint:
  name: deCONZ - IKEA five button remote (optimized)
  description: 'Control anything using IKEA five button remote - based on the blueprint of samnewman86'
  domain: automation
  input:
    remote:
      name: Remote
      description: IKEA remote to use
      selector:
        device:
          integration: deconz
          manufacturer: IKEA of Sweden
          model: TRADFRI remote control
    button_on_off_short:
      name: On off button short press
      description: Action to run on press on off button
      default: []
      selector:
        action: {}
    button_on_off_long:
      name: On off button long press
      description: Action to run on press on off button
      default: []
      selector:
        action: {}
    button_brightness_up_short:
      name: Brightness up button - short press
      description: Action to run on short brightness up press
      default: []
      selector:
        action: {}
    button_brightness_up_long:
      name: Brightness up button - long press
      description: Action to run on long brightness up press
      default: []
      selector:
        action: {}
    button_brightness_up_long_release:
      name: Brightness up button - long press release
      description: Action to run on long brightness up release
      default: []
      selector:
        action: {}
    button_brightness_down_short:
      name: Brightness down button - short press
      description: Action to run on short brightness down press
      default: []
      selector:
        action: {}
    button_brightness_down_long:
      name: Brightness down button - long press
      description: Action to run on long brightness down press
      default: []
      selector:
        action: {}
    button_brightness_down_long_release:
      name: Brightness down button - long press release
      description: Action to run on long brightness down release
      default: []
      selector:
        action: {}
    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_left_long_release:
      name: Left button - long press release
      description: Action to run on long left button release
      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: {}
    button_right_long_release:
      name: Right button - long press release
      description: Action to run on long right button release
      default: []
      selector:
        action: {}
  source_url: https://community.home-assistant.io/t/another-deconz-ikea-5-button-remote-blueprint-this-time-with-long-press-on-all-buttons/258743/4
mode: parallel
max: 10
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_off_short'
  - conditions:
    - '{{ event == 1001 }}'
    sequence: !input 'button_on_off_long'
  - conditions:
    - '{{ event == 2003 }}'
    sequence: !input 'button_brightness_up_long_release'
  - conditions:
    - '{{ event == 2002 }}'
    sequence: !input 'button_brightness_up_short'
  - conditions:
    - '{{ event == 2001 }}'
    sequence: !input 'button_brightness_up_long'
  - conditions:
    - '{{ event == 3003 }}'
    sequence: !input 'button_brightness_down_long_release'
  - conditions:
    - '{{ event == 3002 }}'
    sequence: !input 'button_brightness_down_short'
  - conditions:
    - '{{ event == 3001 }}'
    sequence: !input 'button_brightness_down_long'
  - conditions:
    - '{{ event == 4003 }}'
    sequence: !input 'button_left_long_release'
  - conditions:
    - '{{ event == 4002 }}'
    sequence: !input 'button_left_short'
  - conditions:
    - '{{ event == 4001 }}'
    sequence: !input 'button_left_long'
  - conditions:
    - '{{ event == 5003 }}'
    sequence: !input 'button_right_long_release'
  - conditions:
    - '{{ event == 5002 }}'
    sequence: !input 'button_right_short'
  - conditions:
    - '{{ event == 5001 }}'
    sequence: !input 'button_right_long'