Blueprint: IKEA E2001/E2002 Styrbar Remote Control for Lights (Zigbee2MQTT Compatible)

Would be perfect for me if you are also able to select the colour scenes (red, purple, blue, orange, yellow, purple, green) that are offered by default on the IKEA Tradfri colour bulbs when you press the left/right arrows including the cool and warm white options.

Sorry for a question not directly related to the template, but this seemed a good place to ask as you are all using Styrbar on Z2M:

Can you use the left/right button long press action without also triggering a dim up button short press action?

I am using Styrbar remotes through ZHA and wondering whether the above behavior is a bug in the hardware/firmware or in the ZHA quirk/driver…

I will take a look on it, but I dont have color bulb so I will try to make it maybe more general for user with RGB bulb also.

@Mayhem_SWE TBH sometimes It happens also to me, when trying to hold left or right It tries to dim up. When I was checking the state of the styrbar it seems like I’m pressing top button. Looks like to me a hardware/firmaware problem.

Good job ! Color temp adjustment would be a great idea indeed.
I’m having an issue with the on button though :confused:
Error: expected int for dictionary value @ data[‘brightness’]

I also get the same error regarding the expected int. So not a once off issue.

@DaniLecx, @BigJoeFour It should be fixed by now. Thanks for letting me know.

Hi guys!
Unfortunately this integration doesn’t work correctly. Delays and now it doesn’t work at all.
If i downloaded it some time ago, should i download a new vwersion or it upgrades automatically? Htank you for reply

@Romario Try to reimport and let me know If it works.

1 Like

Yep. Thank you for reply. Works but not all the time correctly. Dimming doesn’t work at all (only on and off)/ Color temp has also 2 positions (white and yellow).
I just wanted to exclude IKEA HUB Tradfri, but it worked perfectly.
I am trying to undersdtand what’s wrong(

Not sure what could be wrong. Dimming works for me correctly. About the changing the colors, read my post. As I said there I will add this feature in some time. For now it changes only cold and warm light.

1 Like

Perfect, thank you!

Hello, nice blueprint!
One problem: brightness step adjustment does not seem to work, I think it defaults to 5 regardless of set value?
Even if I set it to “100”, the step size is always 5.
I’m not familiar with writing code, and find it quite hard to fix this only by Google searching…

I will take a look

I managed to get it working by searching Google and testing for a couple hours, here’s my take.
Again, I am not familiar with writing code so there might be a simpler/better way.
I am also new to HA and this community, hope the code comes out readable in this comment.
Edit: also removed color changing for personal use, my fingers are too fumbly with the remote and colors were changed without wanting it happening :smiley:

variables:
  brightness_step: !input 'brightness_step'
trigger:
- platform: device
  device_id: !input mqtt_device
  domain: mqtt
  type: action
  subtype: 'on'
  id: light_on
- platform: device
  device_id: !input mqtt_device
  domain: mqtt
  type: action
  subtype: 'off'
  id: light_off
- platform: device
  device_id: !input mqtt_device
  domain: mqtt
  type: action
  subtype: brightness_move_down
  id: dim_down
- platform: device
  device_id: !input mqtt_device
  domain: mqtt
  type: action
  subtype: brightness_move_up
  id: dim_up
- platform: device
  device_id: !input mqtt_device
  domain: mqtt
  type: action
  subtype: brightness_stop
  id: dim_stop
action:
- choose:
  - conditions:
    - condition: trigger
      id: light_on
    sequence:
    - service: light.turn_on
      target:
        entity_id: !input light_entity
  - conditions:
    - condition: trigger
      id: light_off
    sequence:
    - service: light.turn_off
      target:
        entity_id: !input light_entity
  - conditions:
    - condition: trigger
      id: dim_down
    sequence:
    - repeat:
        sequence:
        - service: light.turn_on
          target:
            entity_id: !input light_entity
          data:
            brightness_step_pct: "-{{ brightness_step | int}}"
            transition: !input transition_seconds
        - delay:
            milliseconds: !input delay_ms
        until:
        - condition: trigger
          id: dim_stop
  - conditions:
    - condition: trigger
      id: dim_up
    sequence:
    - repeat:
        sequence:
        - service: light.turn_on
          target:
            entity_id: !input light_entity
          data:
            brightness_step_pct: !input brightness_step
            transition: !input transition_seconds
        - delay:
            milliseconds: !input delay_ms
        until:
        - condition: trigger
          id: dim_stop
mode: restart

Thank you for providing this blueprint.
I recently purchased the IKEA Styrbar E2002 dimmer, as my Philips Hue one gave up after years of use.
I had a hard time to find a blueprints which supports the Styrbar with MQTTs actual release.
I looking forward on updates of this blueprint with even more color adjusting possibilities…

Great work …

it would be awesome that we can program the left and right button or add more light entities. i.e. switch scenes with the left and right buttons. Or do some other things.

Edit:
I changed something in your blueprint, so the right button will be a scene switcher.
herefor you need a input switch helper where you put in your scenes you ant to toggle. You can also add multiple lights to control with the styrbar. The right button is connected to the sceneswitcher hard coded. Using !input scene_switcher gave errors.

blueprint:
  name: Styrbar Remote Control for Lights
  description:
    "Provides integration and control for the IKEA E2001/E2002 Styrbar
    remote control. Allows for turning lights on/off, adjusting brightness, and changing
    color temperature. Designed for a Zigbee2MQTT group of light bulbs.

    "
  domain: automation
  input:
    light_entity:
      name: Light Entity
      description: The light to control.
      selector:
        entity:
          domain:
            - light
          multiple: true
    scene_entity:
      name: Scene Entity
      description: The scene to control.
      selector:
        entity:
          multiple: false
    mqtt_device:
      name: Styrbar Remote Control
      description: The IKEA E2001/E2002 remote control.
      selector:
        device:
          multiple: false
    brightness_step:
      name: Brightness Step
      description: Brightness adjustment step (slider percentage, 1-100%).
      default: 5
      selector:
        number:
          min: 1.0
          max: 100.0
          step: 1.0
          unit_of_measurement: "%"
          mode: slider
    delay_ms:
      name: Delay (ms) Between Steps
      description: Delay in milliseconds between brightness adjustment steps.
      default: 300
      selector:
        number:
          min: 100.0
          max: 2000.0
          step: 100.0
          unit_of_measurement: ms
          mode: slider
    transition_seconds:
      name: Transition Time (Seconds)
      description: The duration in seconds for the light transition effect.
      default: 1
      selector:
        number:
          min: 0.1
          max: 9999.0
          step: 0.1
          unit_of_measurement: s
          mode: slider
  source_url: https://github.com/ouhlar/home_assistant/blob/main/blueprints/styrbar_light_remote_control.yaml
trigger:
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: "on"
    id: light_on
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: "off"
    id: light_off
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: arrow_left_click
    id: change_color_left
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: arrow_right_click
    id: switch_scene
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: brightness_move_down
    id: dim_down
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: brightness_move_up
    id: dim_up
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: brightness_stop
    id: dim_stop
action:
  - choose:
      - conditions:
          - condition: trigger
            id: light_on
        sequence:
          - service: light.turn_on
            target:
              entity_id: !input light_entity
      - conditions:
          - condition: trigger
            id: light_off
        sequence:
          - service: light.turn_off
            target:
              entity_id: !input light_entity
      - conditions:
          - condition: trigger
            id: switch_scene
        sequence:
          - service: input_select.select_next
            target:
              entity_id: !input scene_entity
          - service: scene.turn_on
            target:
              entity_id: "{{ states('input_select.sceneswitch') }}"
      - conditions:
          - condition: trigger
            id: change_color_right
        sequence:
          - service: light.turn_on
            target:
              entity_id: !input light_entity
            data:
              kelvin: 2000
      - conditions:
          - condition: trigger
            id: dim_down
        sequence:
          - repeat:
              sequence:
                - service: light.turn_on
                  target:
                    entity_id: !input light_entity
                  data:
                    brightness_step_pct: -{{ states('input.brightness_step') | int(5) }}
                    transition: !input transition_seconds
                - delay:
                    milliseconds: !input delay_ms
              until:
                - condition: trigger
                  id: dim_stop
      - conditions:
          - condition: trigger
            id: dim_up
        sequence:
          - repeat:
              sequence:
                - service: light.turn_on
                  target:
                    entity_id: !input light_entity
                  data:
                    brightness_step_pct: "{{ states('input.brightness_step') | int(5) }}"
                    transition: !input transition_seconds
                - delay:
                    milliseconds: !input delay_ms
              until:
                - condition: trigger
                  id: dim_stop
mode: restart

Hi everybody! Here is a small code enhancement that adds incremental colour temperature adjustment (single click as coarse adjustment as well as continuous press as a little bit more refined increments). Feel free to adopt it if you want - I just feel I have to give something back to the community :slight_smile:

blueprint:
  name: Styrbar Remote Control for Lights - adjusted
  description: >
    Provides integration and control for the IKEA E2001/E2002 Styrbar remote control.
    Allows for turning lights on/off, adjusting brightness, and changing color temperature.
    Designed for a Zigbee2MQTT group of light bulbs.
    Added incremental color temperature adjustment.
  domain: automation
  input:
    light_entity:
      name: Light Entity
      description: The light to control.
      selector:
        entity:
          domain: light
    mqtt_device:
      name: Styrbar Remote Control
      description: The IKEA E2001/E2002 remote control.
      selector:
        device: {}
    brightness_step:
      name: Brightness Step
      description: "Brightness adjustment step (slider percentage, 1-100%)."
      default: 5
      selector:
        number:
          min: 1
          max: 100
          step: 1
          unit_of_measurement: "%"
    delay_ms:
      name: Delay (ms) Between Steps
      description: "Delay in milliseconds between brightness adjustment steps."
      default: 300
      selector:
        number:
          min: 100
          max: 2000
          step: 100
          unit_of_measurement: "ms"
    transition_seconds:
      name: Transition Time (Seconds)
      description: "The duration in seconds for the light transition effect."
      default: 1
      selector:
        number:
          min: 0.1
          max: 9999
          step: 0.1
          unit_of_measurement: "s"

trigger:
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: "on"
    id: light_on
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: "off"
    id: light_off
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: arrow_left_click
    id: change_color_left
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: arrow_left_hold
    id: change_color_left_hold
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: arrow_left_release
    id: change_color_left_release
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: arrow_right_click
    id: change_color_right
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: arrow_right_hold
    id: change_color_right_hold
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: arrow_right_release
    id: change_color_right_release
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: brightness_move_down
    id: dim_down
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: brightness_move_up
    id: dim_up
  - platform: device
    device_id: !input mqtt_device
    domain: mqtt
    type: action
    subtype: brightness_stop
    id: dim_stop

variables:
  light_entity: !input light_entity

action:
  - choose:
      - conditions:
          - condition: trigger
            id: light_on
        sequence:
          - service: light.turn_on
            target:
              entity_id: !input light_entity
      - conditions:
          - condition: trigger
            id: light_off
        sequence:
          - service: light.turn_off
            target:
              entity_id: !input light_entity
      - conditions:
          - condition: trigger
            id: change_color_left
        sequence:
          - service: light.turn_on
            target:
              entity_id: !input light_entity
            data:
              color_temp_kelvin: "{{ state_attr(light_entity, 'color_temp_kelvin') - 200 }}"
      - conditions:
          - condition: trigger
            id: change_color_left_hold
        sequence:
          - repeat:
              sequence:
                - service: light.turn_on
                  target:
                    entity_id: !input light_entity
                  data:
                    color_temp_kelvin: "{{ state_attr(light_entity, 'color_temp_kelvin') - 100 }}"
                - delay:
                    milliseconds: !input delay_ms
              until:
                - condition: trigger
                  id: change_color_left_release
      - conditions:
          - condition: trigger
            id: change_color_right
        sequence:
          - service: light.turn_on
            target:
              entity_id: !input light_entity
            data:
              color_temp_kelvin: "{{ state_attr(light_entity, 'color_temp_kelvin') + 200 }}"
      - conditions:
          - condition: trigger
            id: change_color_right_hold
        sequence:
          - repeat:
              sequence:
                - service: light.turn_on
                  target:
                    entity_id: !input light_entity
                  data:
                    color_temp_kelvin: "{{ state_attr(light_entity, 'color_temp_kelvin') + 100 }}"
                - delay:
                    milliseconds: !input delay_ms
              until:
                - condition: trigger
                  id: change_color_right_release
      - conditions:
          - condition: trigger
            id: dim_down
        sequence:
          - repeat:
              sequence:
                - service: light.turn_on
                  target:
                    entity_id: !input light_entity
                  data:
                    brightness_step_pct: "-{{ states('input.brightness_step') | int(5) }}"
                    transition: !input transition_seconds
                - delay:
                    milliseconds: !input delay_ms
              until:
                - condition: trigger
                  id: dim_stop
      - conditions:
          - condition: trigger
            id: dim_up
        sequence:
          - repeat:
              sequence:
                - service: light.turn_on
                  target:
                    entity_id: !input light_entity
                  data:
                    brightness_step_pct: "{{ states('input.brightness_step') | int(5) }}"
                    transition: !input transition_seconds
                - delay:
                    milliseconds: !input delay_ms
              until:
                - condition: trigger
                  id: dim_stop
mode: restart
1 Like

Just implementet Your code (when I found out how to😉) seems to work perfectly - will report back if any issues - ideas
Thanks

Hi,
one question:
How did you implement the code?
I’m actually struggling to do so…