ZHA - IKEA five button remote

ONLY WORKS FOR ZHA INTEGRATION!

Blank version of the IKEA five button remote for lights in order to use it for other things. Personally I use it for controlling my Sonos. Brightness = vol up + down. Right/left steps through available radio presets while using TTS to tell which channel is selected.

Get started

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

blueprint:
  name: ZHA - 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: zha
          manufacturer: IKEA of Sweden
          model: TRADFRI remote control
    button_on_off:
      name: On off button press
      description: Action to run on press of 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_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_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: zha_event
    event_data:
      device_id: !input remote

action:
  - variables:
      command: "{{ trigger.event.data.command }}"
      cluster_id: "{{ trigger.event.data.cluster_id }}"
      endpoint_id: "{{ trigger.event.data.endpoint_id }}"
      args: "{{ trigger.event.data.args }}"
  - choose:
      - conditions:
          - "{{ command == 'toggle' }}"
          - "{{ cluster_id == 6 }}"
          - "{{ endpoint_id == 1 }}"
        sequence: !input button_on_off

      - conditions:
          - "{{ command == 'step_with_on_off' }}"
          - "{{ cluster_id == 8 }}"
          - "{{ endpoint_id == 1 }}"
          - "{{ args == [0, 43, 5] }}"
        sequence: !input button_brightness_up_short

      - conditions:
          - "{{ command == 'move_with_on_off' }}"
          - "{{ cluster_id == 8 }}"
          - "{{ endpoint_id == 1 }}"
          - "{{ args == [0, 84] }}"
        sequence: !input button_brightness_up_long

      - conditions:
          - "{{ command == 'move_with_on_off' }}"
          - "{{ cluster_id == 8 }}"
          - "{{ endpoint_id == 1 }}"
          - "{{ args == [0, 83] }}"
        sequence: !input button_brightness_up_long

      - conditions:
          - "{{ command == 'step' }}"
          - "{{ cluster_id == 8 }}"
          - "{{ endpoint_id == 1 }}"
          - "{{ args == [1, 43, 5] }}"
        sequence: !input button_brightness_down_short

      - conditions:
          - "{{ command == 'move' }}"
          - "{{ cluster_id == 8 }}"
          - "{{ endpoint_id == 1 }}"
          - "{{ args == [1, 84] }}"
        sequence: !input button_brightness_down_long

      - conditions:
          - "{{ command == 'move' }}"
          - "{{ cluster_id == 8 }}"
          - "{{ endpoint_id == 1 }}"
          - "{{ args == [1, 83] }}"
        sequence: !input button_brightness_down_long


      - conditions:
          - "{{ command == 'press' }}"
          - "{{ cluster_id == 5 }}"
          - "{{ endpoint_id == 1 }}"
          - "{{ args == [257, 13, 0] }}"
        sequence: !input button_left_short

      - conditions:
          - "{{ command == 'hold' }}"
          - "{{ cluster_id == 5 }}"
          - "{{ endpoint_id == 1 }}"
          - "{{ args == [3329, 0] }}"
        sequence: !input button_left_long

      - conditions:
          - "{{ command == 'press' }}"
          - "{{ cluster_id == 5 }}"
          - "{{ endpoint_id == 1 }}"
          - "{{ args == [256, 13, 0] }}"
        sequence: !input button_right_short

      - conditions:
          - "{{ command == 'hold' }}"
          - "{{ cluster_id == 5 }}"
          - "{{ endpoint_id == 1 }}"
          - "{{ args == [3328, 0] }}"
        sequence: !input button_right_long

8 Likes

Yaml for volume up:

data_template:
  volume_level: |
    {{ state_attr('media_player.badevaerelse', 'volume_level') | float + 0.1 }}
entity_id: media_player.badevaerelse
service: media_player.volume_set

yaml for next preset (requires a user defined input select which I use to filter in what stations I want to choose from):

  1. Select next station in input select
service: input_select.select_previous
data: {}
entity_id: input_select.bad_radio_stationer
  1. Speak stationname using TTS
data_template:
  message: |
    {{ states('input_select.bad_radio_stationer') }}
entity_id: media_player.badevaerelse
service: tts.google_translate_say
  1. Delay to wait for TTS
delay: '00:00:01.5'
  1. Set input
data_template:
  source: |
    {{ states('input_select.bad_radio_stationer') }}
entity_id: media_player.badevaerelse
service: media_player.select_source

Hey there, i tried using this blueprint but it says that “No matching device found”.

I have multiple remotes from IKEA in Homeassistant. They are all integrated via zigbee2mqtt :slight_smile:

Kind regards,

dhuuk42

Same here, I have two IKEA remotes integrated through deConz and says that No matching device found.

The topic says ZHA, not zigbee2mqtt or deCONZ so I would assume it’s for… ZHA integration.

1 Like

Just about to say that.

Oh shit … you’re right, read it too quickly :pensive:!

shame on me!

… so i have a rp4 with a HUSBZB-1, i do have just this remote, with this blueprint should the remote work----i did try and its not working

If you installed the ZHA integration with HUSBZB-1 and paired your remote to ZHA then it should work

YES i have zha installed and have about 6 zigbee devices, but the batt. level for this remote is
the only thing that shows up under devices and i cant get it to work with this blueprint thanks for the response jeff

zha:
usb_path: /dev/ttyUSB1
database_path: /config/zigbee.

Nice! Thanks!

I made a version for the Tradfri On/Off remote, and for the Lutron connected remote based on this template. Will post blueprints shortly.

Hi,

I try to create a Blueprint for deconz Ikea five button remote for SONOS.
But I have a problem with thecorrect spelling of the code to change the volume.

sequence:
    - service: media_player.volume_set
      target: !input 'speaker'
      data_template:
        volume_level: |
          {{ state_attr("!input 'volume'", "volume_level") | float + 0.1 }}

I didn’t get the actual volume value from the state_attr of the selected media_player. I think there is something wrong with the " ’ ’ " . What is the correct way to get the state_attr from an input?

Thank you

For my workflow I use the volume level of the speaker. Your workflow seems to look at volume of one of the inputs instead.

My code looks like this

data_template:
  volume_level: |
    {{ state_attr('media_player.badevaerelse', 'volume_level') | float + 0.1 }}
entity_id: media_player.badevaerelse
service: media_player.volume_set

So in your case it would also be !input ‘speaker’, ‘volume_level’. I dont think you need the " " around the !input as this is already a string. Further I am unsure if you should use target. I use entity_id

I would guess that your code should read

sequence:
    - service: media_player.volume_set
      entity_id: !input 'speaker'
      data_template:
        volume_level: |
          {{ state_attr(!input 'speaker', "volume_level") | float + 0.1 }}

You could also use the media_player.volume_up service but I found it to increase volume too slowly

Oh you are right- I mean !input 'speaker'!! Sorry

But I try It in all variants with the !input 'speaker' but I didn’t get the actual volume level.
If I test it like you do it in your code with the fixed entity_id it work perfect.

The problem is to get the correct templating for the input 'speaker'

I get this log:

invalid template (TemplateSyntaxError: unexpected char ‘!’ at 14)

hello for the first thanks for this beautiful blueprint! I have a question ? is it possible to add function long press on / off button? wall this he supports thanks in advance!

I am unsure how that would work as holding the on off button results in four events
first event is the same as a press
second event is “release”
third event is “move_to_level_with_on_off”
fourth event is “press”

no then it will be difficult but thanks for the answer

I think there might be a problem with the long press of the brightness buttons. All the other actions work, just both brightness up or brightness down long presses don’t trigger. Anyone else confirm?

Long presses of the side buttons work fine too.

It works at my end see the following yaml:

alias: New Automation
description: ''
use_blueprint:
  path: wormie/zha_ikea_remote.yaml
  input:
    button_brightness_up_long:
      - service: notify.notify
        data:
          message: long up
          title: test
    remote: 2f7d4027d05c086324b495a107b86f76
    button_brightness_down_long:
      - service: notify.notify
        data:
          message: long down
          title: test
    button_left_long:
      - service: notify.notify
        data:
          message: long left
          title: test
    button_right_long:
      - service: notify.notify
        data:
          message: long right
          title: test
    button_right_short:
      - service: notify.notify
        data:
          message: short right
          title: test
    button_left_short:
      - service: notify.notify
        data:
          message: short left
          title: test
    button_brightness_up_short:
      - service: notify.notify
        data:
          message: short up
          title: test
    button_on_off:
      - service: notify.notify
        data:
          message: on off
          title: test
    button_brightness_down_short:
      - service: notify.notify
        data:
          message: short down
          title: test