ZHA - IKEA four button remote (Styrbar) for lights (E2001, E2002)

I watched the button events in the developer tools. Seems as if this remote doesn’t support double click. So I would have to rewrite the parts for single click to only trigger if no second click appears.
For doubleclicks I’d have to do manual timing to catch the second click. Something like this:

only when the light is on and the second click is less than 0,2s old.

      - conditions:
          - "{{ command == 'off' }}"
          - "{{ cluster_id == 6 }}"
          - "{{ endpoint_id == 1 }}"
          - "{{ is_state(!input 'light', 'on')}}"
          - "{{ utcnow() - states.light.{!input 'light'}.last_changed < timedelta(seconds=0.2)  }}"

but I don’t think this would compile :wink:
Is there a way to test these kind of templates? And how can I get one into HA without an URL?

working great for me thanks - would love to use the left and right buttons to cycle through some preset colours but no idea how ? is it doable

I have the problem that the on/off button only turns on/off one of two lights I have placed in a single lamp. Doesn’t matter if I select both lights manually, create a HA group, create a Zigbee group – only one of them works with the remote, but I can successfully switch both lamps manually (or via the zigbee group). Did anyone notice a similar behavior?

That sounds odd. I can assure you that it works with a HA group, because that is exactly what I use the button for in my setup. So I assume it’s more of a problem on your specific configuration and not related to this blueprint.

1 Like

Thank you, I resolved the problem by reconnecting the remote with HA. There was really something off in my setup.

Thank you for the blueprint. It was very helpful in my setup.

For those that looking for how to cycle scenes using the left and right button, i created a small script that jumps to the next scene and activate it.

You have to create an input_select helper containing all the entity IDs of the desired scenes.

alias: Next Scene
fields:
  scene_select:
    name: Scene Select
    description: Input Select entity to set the next scene.
    required: true
    selector:
      entity:
        domain: input_select
  cycle:
    name: Cycle
    description: If the option should cycle from the last to the first.
    default: true
    selector:
      boolean: null
sequence:
  - service: input_select.select_next
    data:
      cycle: "{{cycle}}"
    target:
      entity_id: "{{scene_select}}"
  - service: scene.turn_on
    target:
      entity_id: "{{states(scene_select)}}"
    metadata: {}
mode: queued
max: 10

First I tried to do it by activating the scene directly when the input_select changed using an automation, but that had multiple drawbacks:

  1. Need an additional automation for every scene input_select.
  2. Tight coupling of changing the input_select and activating the scene.
  3. Sometimes feels buggy. (Fast button presses not recognized etc.)

Hope that this is useful for you.

4 Likes

Might be a silly question, I was looking at this as a repurpose by using it as a four different input switch. As in pressing up, down, left and right can perform separate actions, is this possible?

I have not tried the blueprint yet, just plain automations.
You should be able to create any automation based on the remote’s events, I set mine to toggle lights (up/down) and air purifier fan speed (left/right). Long press left/right can’t really be used on its own because it fires “turn on” too (same as pressing up), as mentioned in the first post. Other than that you can assign anything.

How can I use this so that left/right long press continuously changes white temperature (or color hue) for Ikea bulbs ?

Increasing/decreasing white temperature are not available actions. Only available action is to set a fixed value for that temperature.

Thanks

1 Like

As of now this is not something that can be done with this blueprint nor do I know of a convenient way other than switching in between different scenes with an input helper (as described earlier in this discussion).

This looks great, thanks for the hard work!

Is it possible to use the left/right buttons to cycle through a preset set of lights, and then have the other buttons act on that light only?

Please take a look at this comment.

Hi all.

I would be very happy if you could help me further.

I have been using Home Assistant for quite a while, but usually with pre-made scripts and blueprints.

e.g. I have four Ikea Tradfri lamps hanging above the dining table, I have grouped them in the “dining room” area.
For these I have created different scenes with different colors:

  • All lamps blue
  • All lamps green
  • etc.

At the moment I switch these lamps via the app on the phone in the different scenes.

Now I got myself a switch: The Ikea Styrbar.

Here I have now found the corresponding Blueprint for this switch:
https://community.home-assistant.io…-remote-styrbar-for-lights-e2001-e2002/384482

This works first as it should: with the two buttons for brightness I can make the brightness of all lamps in the area “dining room” brighter and darker, as well as off.

Now I also want to use the left and right buttons to switch between the different scenes, i.e. colors.

For this someone posted a script in this thread:
https://community.home-assistant.io…mote-styrbar-for-lights-e2001-e2002/384482/16

Now the problems start:
I don’t understand how to integrate this script.

What I have done so far:

Image 1:
Copied the script as it is there into the file “scripts.yaml”. There is nothing else in it.
This file is included in the “configuration.yaml” with: “script: !include scripts.yaml”.

Image 2:
Then the thread says: “You have to create an input_select helper containing all the entity IDs of the desired scenes.”
So I created a “helper”, a “dropdown” with the name “Change light dining room”.
Now this is where the problem starts: How should I correctly include the individual color scenes as options in this dropdown? If I look in the scene “Blue”, then it says there for example at entity ID: “scene.blue”.
So I added “scene.blue” at “add option” in the dropdown and also all other color scenes.

Image 3:
Next I go to the already created automation “You have to create an input_select helper containing all the entity IDs of the desired scenes.” from the Blueprint.
There I go to “Right button - short press” and then comes the next problem: How do I include the created dropdown helper here correctly?
I tried it via “Run service”, then “Selection field: Next”.
And then set the entity “Change light dining room”.

Saved everything and? Nothing. Nothing happens when I press the right button.

I can’t explain it, where is the error?
I must admit, I still lack some basic understanding in Home Assistant, although I have now really many hours of reading up and watching videos.

Thank you very much for your help!

Can not get dimming working with long press?

Hey there, I’ve not implemented this myself but to me it looks like you didn’t call the right action (“Dienst”) for the right button short press (last image). What you actually want to call there is the script (script.next_scene I would assume). With that you need to pass along the parameters required by the script. But being honest I have not a whole lot of experience with that. Maybe @cbodenst can clarify this.

If you want someone to help you, you definitely need to include some more info. There is questions like:

  • Does the light support dimming?
  • Which button on the remote are you pressing?
  • What setting did you use for the hold time?
  • What is your config in general?

I actually do not really know what you expect anyone to answer to your post here because it’s working for everybody else and you ask a question with zero context. Please clarify the above questions and I might be able to help you out.

I think it is very general, but yes the lights do support dimming some are ESPHome some are ZIgbee, but they all are dimmable via HA.
Actually I like to make it long press is dim up/dim down action and reversed depending on the time of keeping the button pressed, but to start with just dim up or dim down is a nice start.
Well there is a repeat action already implemented with the Bluetooth, I presume for dimming so would love to know how others use that function, now it is set to 500 repeats.
Configuration wise nothing special every button has a separate light to toggle, and thus the general idea was the same light will be dimmed with the long press, and short press is the on/off action.

Hi Malte,
I have already thought something like that!
Unfortunately I don’t have “script.next_scene” for “Dienst”. Only the 4 points on this picture:

If you did everything correct then it should show up in that drop-down.

Did you include your scripts.yaml in your configuration.yaml?

Hi, yes, there is a line: “script: !include scripts.yaml”:

5