IKEA STYRBAR (E2001/E2313) - 10 Action Blueprint - ZHA (4 Short press, 4 Long press, 2 Release)

ZHA - IKEA 4-button Styrbar Full 10-Actions (White/Silver remotes)

This blueprint provides comprehensive mapping for all 10 possible interactions for the IKEA Styrbar remote series via ZHA (Zigbee Home Automation). It is compatible with both the Silver (E2001) and White (E2313) variants.

This blueprint specifically addresses the hardware quirk where Left/Right Hold triggers an “On” event. By using mode: restart, the Long Press action takes priority and cancels the initial Short Press sequence, allowing you to assign different commands to Hold actions without interference.

Compatibility

  • Model E2001: The original brushed-silver 4-button remote.
  • Model E2313: The standard white 4-button remote.
  • Integration: Specifically designed for use with ZHA.

Functionality Breakdown

  • Vertical Axis (Top/Bottom): Short presses act as standard toggles (On/Off). Long presses trigger a “Move” command for smooth dimming and fire a “Stop” command when released.
  • Horizontal Axis (Left/Right): Provides distinct “Press” (short) and “Hold” (long) events.

Best Use Cases

  • 4 Buttons, 4 Lights: Control power using short and long presses.
  • Scene Control: Use short presses for toggles and long presses to set specific scenes.

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

Blueprint Code

blueprint:
  name: ZHA - IKEA 4 button Styrbar Full 10-Action (White/Silver)
  description: >
    IKEA Styrbar 4-Button Remote Integration (ZHA)(https://www.home-assistant.io/integrations/zha/).

    This blueprint provides comprehensive mapping for all 10 possible interactions for the IKEA Styrbar remote series. It is compatible with both the Silver (E2001) and White (E2313) variants.

    This blueprint addresses the issue of Left/Right Hold triggering On events. This means you should be able to apply different to commands to Left/Right Hold actions without issue.

    This is useful for example to control a light/switch using quick fire (On actions) and Hold (Off actions) on a single button.

    Compatibility:
     * Model E2001: The original brushed-silver 4-button remote.
     * Model E2313: The standard white 4-button remote.
     * Integration: Specifically designed for use with ZHA (Zigbee Home Automation).

    Functionality Breakdown:
     * Vertical Axis (Top/Bottom): These buttons use Clusters 6 and 8. Short presses act as standard toggles (On/Off). Long presses trigger a "Move" command, ideal for smooth dimming, and fire a "Stop" command when released.
     * Horizontal Axis (Left/Right): These buttons use Cluster 5. They provide distinct "Press" (short) and "Hold" (long) events.
     * The "Pre-fire" Quirk: Note that the Styrbar hardware sends a "Short Press" signal the instant a button is pushed, followed by a "Hold" signal if it isn't released. This blueprint uses mode: restart to ensure the Long Press action takes priority and cancels the initial Short Press sequence.

    Best Use Cases:
     * 4 Buttons, 4 Lights (On/Off using short and long press).
     * 4 Buttons, 4 lights (On/Off toggle with short press, Set scenes with Long press).
  domain: automation
  input:
    remote:
      name: Remote
      description: Select your White (E2313) or Silver (E2001) 4 Button Styrbar remote.
      selector:
        device:
          integration: zha
          manufacturer: IKEA of Sweden
          model: Remote Control N2

    # --- CLICK ACTIONS ---
    button_up_short:
      name: '"Turn on" pressed (Top)'
      description: 'Quick tap of the top button.'
      default: []
      selector: { action: null }
    button_down_short:
      name: '"Turn off" pressed (Bottom)'
      description: 'Quick tap of the bottom button.'
      default: []
      selector: { action: null }
    button_left_short:
      name: '"Left" pressed'
      description: 'Quick tap of the left button.'
      default: []
      selector: { action: null }
    button_right_short:
      name: '"Right" pressed'
      description: 'Quick tap of the right button.'
      default: []
      selector: { action: null }

    # --- LONG PRESS ACTIONS ---
    button_up_long:
      name: '"Dim up" continuously pressed (Top)'
      description: 'Continuous hold of the top button.'
      default: []
      selector: { action: null }
    button_down_long:
      name: '"Dim down" continuously pressed (Bottom)'
      description: 'Continuous hold of the bottom button.'
      default: []
      selector: { action: null }
    button_left_long:
      name: '"Left" continuously pressed'
      description: 'Long press of the left button.'
      default: []
      selector: { action: null }
    button_right_long:
      name: '"Right" continuously pressed'
      description: 'Long press of the right button.'
      default: []
      selector: { action: null }

    # --- RELEASE ACTIONS ---
    button_up_release:
      name: '"Dim up" released (Top)'
      description: 'Let go after a long press on the top button.'
      default: []
      selector: { action: null }
    button_down_release:
      name: '"Dim down" released (Bottom)'
      description: 'Let go after a long press on the bottom button.'
      default: []
      selector: { action: null }

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 }}"
      args: "{{ trigger.event.data.args }}"

  - choose:
      - conditions: "{{ command == 'on' }}"
        sequence: !input "button_up_short"
      - conditions: "{{ command == 'move_with_on_off' }}"
        sequence: !input "button_up_long"
      - conditions: "{{ command == 'stop_with_on_off' }}"
        sequence: !input "button_up_release"
      - conditions: "{{ command == 'off' }}"
        sequence: !input "button_down_short"
      - conditions: "{{ command == 'move' }}"
        sequence: !input "button_down_long"
      - conditions: "{{ command == 'stop' }}"
        sequence: !input "button_down_release"
      - conditions:
          - "{{ command == 'press' }}"
          - "{{ args == [257, 13, 0] }}"
        sequence: !input "button_left_short"
      - conditions:
          - "{{ command == 'hold' }}"
          - "{{ args == [3329, 0] }}"
        sequence: !input "button_left_long"
      - conditions:
          - "{{ command == 'press' }}"
          - "{{ args == [256, 13, 0] }}"
        sequence: !input "button_right_short"
      - conditions:
          - "{{ command == 'hold' }}"
          - "{{ args == [3328, 0] }}"
        sequence: !input "button_right_long"

How can we use this blueprint to dim light, with continuously holding a button? Just press up/on and it will make steps of x% as an example.

will be light turned off when using “dim down” or will be on with minimum %?

@Casperdroid5 @flega AFAIK this automation only gives you the ability to implement your own actions based on the button that is pressed.

Since I want this button to control multiple lights, I created a Dropdown (input_select) helper called selected_lamp. There I added all my lights without the light. prefix. Next, I used this blueprint with the following configuration:

alias: IKEA Styrbar Kitchen
description: ""
use_blueprint:
  path: >-
    southwalesboy/ikea-styrbar-e2001-e2313-10-action-blueprint-zha-4-short-press-4-long-press-2-release.yaml
  input:
    remote: ba45ab57c33fedfa478fbe94e713033b
    button_down_release:
      - action: script.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: script.light_manager
    button_down_short:
      - alias: Turn off
        action: script.turn_on
        metadata: {}
        data:
          variables:
            action: turn_off
            selector_entity: input_select.selected_lamp
        target:
          entity_id: script.light_manager
    button_left_short:
      - action: input_select.select_previous
        metadata: {}
        data:
          cycle: true
        target:
          entity_id:
            - input_select.selected_lamp
      - alias: Flash
        action: script.turn_on
        metadata: {}
        data:
          variables:
            action: flash
            selector_entity: input_select.selected_lamp
        target:
          entity_id: script.light_manager
    button_right_short:
      - action: input_select.select_next
        metadata: {}
        data:
          cycle: true
        target:
          entity_id:
            - input_select.selected_lamp
      - alias: Flash
        action: script.turn_on
        metadata: {}
        data:
          variables:
            action: flash
            selector_entity: input_select.selected_lamp
        target:
          entity_id: script.light_manager
    button_up_release:
      - action: script.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: script.light_manager
    button_up_long:
      - action: script.turn_on
        metadata: {}
        data:
          variables:
            action: dim_up
            selector_entity: input_select.selected_lamp
        target:
          entity_id: script.light_manager
        alias: Dim up
    button_up_short:
      - alias: Turn on
        action: script.turn_on
        metadata: {}
        data:
          variables:
            action: turn_on
            selector_entity: input_select.selected_lamp
        target:
          entity_id: script.light_manager
    button_down_long:
      - alias: Dim up
        action: script.turn_on
        metadata: {}
        data:
          variables:
            action: dim_down
            selector_entity: input_select.selected_lamp
        target:
          entity_id: script.light_manager

Basically:

  • Left/Right buttons cycle the chosen lamp from the dropdown
  • Every button, apart for "Left/Right" continuously pressed then call a script I created which is called light_manager

The light_manager script takes two variables:

  1. The action you want to take: flash, turn_on, turn_off, dim_up, dim_down
  2. The selector_entity ID, in my case input_select.selected_lamp

The flashaction is used in conjunction with the Left/Right buttons cycle in order to give a visual cue as to which light the remote will control.

Here is the script:

alias: Light Manager
description: ""
mode: parallel
fields:
  action:
    selector:
      select:
        options:
          - flash
          - turn_on
          - turn_off
          - dim_up
          - dim_down
        multiple: false
  selector_entity:
    name: Selector entity
    description: The input_select entity to get the lamp from
    selector:
      entity:
        domain: input_select
sequence:
  - variables:
      selected_lamp: light.{{ states(selector_entity) }}
  - variables:
      was_on: "{{ is_state(selected_lamp, 'on') }}"
  - choose:
      - conditions:
          - alias: Flash
            condition: template
            value_template: "{{ action == 'flash' }}"
        sequence:
          - sequence:
              - repeat:
                  count: 2
                  sequence:
                    - action: light.turn_off
                      target:
                        entity_id: "{{ selected_lamp }}"
                      data:
                        transition: 0.3
                    - delay:
                        milliseconds: 300
                    - action: light.turn_on
                      target:
                        entity_id: "{{ selected_lamp }}"
                      data:
                        transition: 0.3
                    - delay:
                        milliseconds: 300
                enabled: true
              - if:
                  - condition: template
                    value_template: "{{ not was_on }}"
                    alias: Was off
                then:
                  - action: light.turn_off
                    target:
                      entity_id: "{{ selected_lamp }}"
                    data: {}
      - conditions:
          - alias: Turn on
            condition: template
            value_template: "{{ action == 'turn_on' }}"
        sequence:
          - if:
              - alias: Is Off
                condition: template
                value_template: "{{ is_state(selected_lamp, 'off')  }}"
            then:
              - action: light.turn_on
                target:
                  entity_id: "{{ selected_lamp }}"
                data: {}
                alias: Turn on
            else:
              - alias: Dim up
                action: light.turn_on
                target:
                  entity_id: "{{ selected_lamp }}"
                data:
                  brightness_step_pct: 25
      - conditions:
          - alias: Turn off
            condition: template
            value_template: "{{ action == 'turn_off' and is_state(selected_lamp, 'on') }}"
            enabled: true
        sequence:
          - action: light.turn_off
            target:
              entity_id: "{{ selected_lamp }}"
            data: {}
            alias: Turn off
      - conditions:
          - condition: template
            value_template: "{{ action == 'dim_up' }}"
            alias: Dim up
        sequence:
          - repeat:
              while:
                - alias: Brightness <100%
                  condition: template
                  value_template: "{{ (state_attr(selected_lamp, 'brightness') or 0) <= 254 }}"
              sequence:
                - action: light.turn_on
                  target:
                    entity_id: "{{ selected_lamp }}"
                  data:
                    brightness_step_pct: 10
                  alias: Dim up
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 0
                    milliseconds: 100
      - conditions:
          - alias: Dim down
            condition: template
            value_template: "{{ action == 'dim_down' }}"
        sequence:
          - if:
              - alias: Is Off
                condition: template
                value_template: "{{ is_state(selected_lamp, 'on') }}"
            then:
              - repeat:
                  while:
                    - alias: Brightness >0%
                      condition: template
                      value_template: >-
                        {{ (state_attr(selected_lamp, 'brightness') or 0) >= 3
                        }}
                  sequence:
                    - action: light.turn_on
                      target:
                        entity_id: "{{ selected_lamp }}"
                      data:
                        brightness_step_pct: -10
                      alias: Dim down
                    - delay:
                        hours: 0
                        minutes: 0
                        seconds: 0
                        milliseconds: 100
            else:
              - action: light.turn_on
                target:
                  entity_id: "{{ selected_lamp }}"
                data:
                  brightness_pct: 1
                alias: Turn on at 1%

In essence you can use the blueprint with multiple buttons, while keeping the same script. It is enough to pass another input_select entity.

Thank you for explaining.

I’ll look into it.

It does seem however that the long button press on the right and left button is not working as it should. It triggers the “brighten” short press at my automation and thén it will do the long press event (while holding it longer)…