🎮 ZHA, deCONZ, Zigbee2MQTT - IKEA E2001/E2002 STYRBAR Remote control Universal blueprint - all actions + double click events - control lights, media players and more with Hooks

Hi @easynote , Welcome!

Have you added the helper entity?
Controllers-Hooks Ecosystem | Awesome HA Blueprints (epmatt.github.io)

1 Like

Looks like your entity ID for the controller is incorrect.

I realise you are using Deconz, which I am not familiar with.
It might be worth checking the docs Controller - IKEA E2001/E2002 STYRBAR Remote control | Awesome HA Blueprints (epmatt.github.io)

1 Like

Hi, @LewisSpring. I seem to have a problem with the double click events on Z2MQTT. I’ve enabled exposing button for double click events, but it just defaults to the single click. I’m running HA 2023.11.3 and 1.33.2-1

Hi,
I found my problem:
I simply forgot to add (Required) Helper - Last Controller Event
I’m sorry, I don’t know how I could miss that !
Thanks a lot for help.

1 Like

Hi @simenad , Welcome!

Try adjusting your debounce value (set to 100), and if not, play with the double press delay. The double press is slower than you’d expect.

Trying to follow what the current version of this Blueprint is actually quite difficult even though I’v read everything a few times. Currently Im using ISISMEIRO 2023.10.30. Can anyone confirm if this is correct?

Hi @KmanOz
2023.10.30 is the latest version. If in doubt, check here: awesome-ha-blueprints/blueprints/controllers/ikea_e2001_e2002/ikea_e2001_e2002.yaml at main · lsismeiro/awesome-ha-blueprints (github.com)

Hope that helps

Cheers thanks

i dont know what i am doing wrong, but when i create an automation with the e2002 based on this blueprint, and add a hook light, when i try to dim the lights, i get continuous zigbee commands in my log, and they only stop when i delete the hook. The lights dim to 0 or full, and don’t respond to other commands anymore
Any idea?

there was a bug in blueprint, according to repository in latest version should be fixed. If not try replacing text with regex_match(...) with regex_match("^\{((\"a\": ?\".*\"|\"t\": ?\d+\.\d+)(, ?)?){2}\}$")) inside the blueprint

This is correct, cheers :slight_smile:

@sandoz.cloud Please try the latest version awesome-ha-blueprints/blueprints/controllers/ikea_e2001_e2002/ikea_e2001_e2002.yaml at main · lsismeiro/awesome-ha-blueprints (github.com) and let me know if the issue remains

can you help me to set a special brightness to a zigbee2mqtt group via that blueprint?!

Sorry have to ask, I like a resume, please?!

I got the EPMatt with his hook working sort off, but as so many extra functions on the buttons not, dimming/colour/on/off all fine.
Using a simple COBled string here thus on/off/brightness and cold white warm white.

How to procede?:
DO I need the Isismeiro blueprint and does that need the hook light from LeidenSpain or can it function without a hook light blueprint.

For I tried the Isesmeiro blueprint alone and it had on/off dim up on the up button and the dim down on the down button, setting color to bright cold white… but no setting colour to warm white?

What is needed, and could someone please share a automation they have with a WW/CW led string please?

You would be best asking elsewhere on the fourm as I do not have experience with that and it’s a bit off topic :slight_smile:

Thanks for your interest

Hello,
You should use the lsismeiro blueprint anyway as it includes latest fixes.

You will need a Hook - The light Hook from EPMatt (or lsismeiro repository to keep it from the same place) and set it to Colour Temperature Mode

Hope that helps

Just a note for anyone looking for support from me with ZHA specifically going forward, I have now moved to Zigbee2MQTT. I intend to keep my old coordinator that I can do ZHA specific tests with if needed. :slight_smile:

Please keep any queries coming.

Hi, I’m really struggling with long press with Styrbar 4 button switch. I have the latest blueprint. I have Last Controller Event per automation. I get a buffer error in z2m. I’ve tried it on a single bulb and a group of bulbs. I can kind of get a jerky brightness up on long press but it’s not reliable. On and off work fine. I’d love to know what I’m doing wrong.

Publish 'set' 'brightness' to 'Snug Lights' failed: 'Error: Command 1 genLevelCtrl.moveToLevelWithOnOff({"level":104,"transtime":0}) failed (SREQ '--> AF - dataRequestExt - {"dstaddrmode":1,"dstaddr":"0x0000000000000001","destendpoint":255,"dstpanid":0,"srcendpoint":1,"clusterid":8,"transid":244,"options":0,"radius":30,"len":6,"data":{"type":"Buffer","data":[17,6,4,104,0,0]}}' failed with status '(0x11: BUFFER_FULL)' (expected '(0x00: SUCCESS)'))'

Hi @RGx01, welcome!

I’ve not seen this buffer full issue before - (especially since I am so new to Z2M!)

Can you share your automations please?
I’d like to get a better idea of this.

Cheers

Hi @LewisSpring here is the config. I’m new to this too. probably doing it all wrong.

variables:
  integration: Zigbee2MQTT
  button_left_long_loop: false
  button_left_long_max_loop_repeats: 500
  button_left_double_press: false
  button_right_long_loop: false
  button_right_long_max_loop_repeats: 500
  button_right_double_press: false
  button_up_long_loop: true
  button_up_long_max_loop_repeats: 500
  button_up_double_press: false
  button_down_long_loop: true
  button_down_long_max_loop_repeats: 500
  button_down_double_press: false
  helper_last_controller_event: input_text.last_controller_event
  helper_double_press_delay: 500
  helper_debounce_delay: 100
  integration_id: '{{ integration | lower }}'
  adjusted_double_press_delay: '{{ [helper_double_press_delay - helper_debounce_delay, 100] | max }}'
  actions_mapping:
    deconz:
      button_left_short:
        - '3002'
      button_left_long:
        - '3001'
      button_left_release:
        - '3003'
      button_right_short:
        - '4002'
      button_right_long:
        - '4001'
      button_right_release:
        - '4003'
      button_up_short:
        - '1002'
      button_up_long:
        - '1001'
      button_up_release:
        - '1003'
      button_down_short:
        - '2002'
      button_down_long:
        - '2001'
      button_down_release:
        - '2003'
    zha:
      button_left_short:
        - press_257_13_0
      button_left_long:
        - hold_3329_0
      button_left_release:
        - release
      button_right_short:
        - press_256_13_0
      button_right_long:
        - hold_3328_0
      button_right_release:
        - release
      button_up_short:
        - 'on'
      button_up_long:
        - move_with_on_off_MoveMode.Up_83
      button_up_release:
        - stop_with_on_off
      button_down_short:
        - 'off'
      button_down_long:
        - move_MoveMode.Down_83_0_0
      button_down_release:
        - stop_with_on_off
    zigbee2mqtt:
      button_left_short:
        - arrow_left_click
      button_left_long:
        - arrow_left_hold
      button_left_release:
        - arrow_left_release
      button_right_short:
        - arrow_right_click
      button_right_long:
        - arrow_right_hold
      button_right_release:
        - arrow_right_release
      button_up_short:
        - 'on'
      button_up_long:
        - brightness_move_up
      button_up_release:
        - brightness_stop
      button_down_short:
        - 'off'
      button_down_long:
        - brightness_move_down
      button_down_release:
        - brightness_stop
  button_left_short: '{{ actions_mapping[integration_id]["button_left_short"] }}'
  button_left_long: '{{ actions_mapping[integration_id]["button_left_long"] }}'
  button_left_release: '{{ actions_mapping[integration_id]["button_left_release"] }}'
  button_right_short: '{{ actions_mapping[integration_id]["button_right_short"] }}'
  button_right_long: '{{ actions_mapping[integration_id]["button_right_long"] }}'
  button_right_release: '{{ actions_mapping[integration_id]["button_right_release"] }}'
  button_up_short: '{{ actions_mapping[integration_id]["button_up_short"] }}'
  button_up_long: '{{ actions_mapping[integration_id]["button_up_long"] }}'
  button_up_release: '{{ actions_mapping[integration_id]["button_up_release"] }}'
  button_down_short: '{{ actions_mapping[integration_id]["button_down_short"] }}'
  button_down_long: '{{ actions_mapping[integration_id]["button_down_long"] }}'
  button_down_release: '{{ actions_mapping[integration_id]["button_down_release"] }}'
  integrations_with_prev_event_storage:
    - zha
    - zigbee2mqtt
  controller_entity: sensor.bedroom_ikea_button_action
  controller_device: ''
  controller_id: >-
    {% if integration_id=="zigbee2mqtt" %}{{controller_entity}}{% else
    %}{{controller_device}}{% endif %}
mode: restart
max_exceeded: silent
trigger:
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: sensor.bedroom_ikea_button_action
  - platform: event
    event_type:
      - deconz_event
      - zha_event
    event_data:
      device_id: ''
condition:
  - condition: and
    conditions:
      - >-
        {%- set trigger_action -%} {%- if integration_id == "zigbee2mqtt" -%} {{
        trigger.event.data.new_state.state }} {%- elif integration_id ==
        "deconz" -%} {{ trigger.event.data.event }} {%- elif integration_id ==
        "zha" -%} {{ trigger.event.data.command }}{{"_" if
        trigger.event.data.args|length > 0}}{{ trigger.event.data.args|join("_")
        }} {%- endif -%} {%- endset -%} {{ trigger_action not in ["","None"] }}
      - >-
        {{ integration_id != "zigbee2mqtt" or trigger.event.data.new_state.state
        != trigger.event.data.old_state.state }}
action:
  - delay:
      milliseconds: 100
  - variables:
      trigger_action: >-
        {%- if integration_id == "zigbee2mqtt" -%} {{
        trigger.event.data.new_state.state }} {%- elif integration_id ==
        "deconz" -%} {{ trigger.event.data.event }} {%- elif integration_id ==
        "zha" -%} {{ trigger.event.data.command }}{{"_" if
        trigger.event.data.args|length > 0}}{{ trigger.event.data.args|join("_")
        }} {%- endif -%}
      trigger_delta: >-
        {{ (as_timestamp(now()) - ((states(helper_last_controller_event) |
        from_json).t if helper_last_controller_event is not none and
        (states(helper_last_controller_event) |
        regex_match("^\{((\"a\":\".*\"|\"t\":\d+\.\d+)(,)?){2}\}$")) else
        as_timestamp("1970-01-01 00:00:00"))) * 1000 }}
      last_controller_event: >-
        {{ (states(helper_last_controller_event) | from_json).a if
        helper_last_controller_event is not none and
        (states(helper_last_controller_event) |
        regex_match("^\{((\"a\":\".*\"|\"t\":\d+\.\d+)(,)?){2}\}$")) else "" }}
  - service: input_text.set_value
    data:
      entity_id: input_text.last_controller_event
      value: '{{ {"a":trigger_action,"t":as_timestamp(now())} | to_json }}'
  - choose:
      - conditions: '{{ trigger_action | string in button_left_short }}'
        sequence:
          - choose:
              - conditions: '{{ button_left_double_press }}'
                sequence:
                  - choose:
                      - conditions: >-
                          {{ trigger_action | string in
                          states(helper_last_controller_event) and trigger_delta
                          | int <= helper_double_press_delay | int }}
                        sequence:
                          - service: input_text.set_value
                            data:
                              entity_id: input_text.last_controller_event
                              value: >-
                                {{ {"a":"double_press","t":as_timestamp(now())}
                                | to_json }}
                          - event: ahb_controller_event
                            event_data:
                              controller: '{{ controller_id }}'
                              action: button_left_double
                          - choose:
                              - conditions: []
                                sequence: []
                    default:
                      - delay:
                          milliseconds: '{{ adjusted_double_press_delay }}'
                      - event: ahb_controller_event
                        event_data:
                          controller: '{{ controller_id }}'
                          action: button_left_short
                      - choose:
                          - conditions: []
                            sequence: []
            default:
              - event: ahb_controller_event
                event_data:
                  controller: '{{ controller_id }}'
                  action: button_left_short
              - choose:
                  - conditions: []
                    sequence: []
      - conditions: '{{ trigger_action | string in button_left_long }}'
        sequence:
          - event: ahb_controller_event
            event_data:
              controller: '{{ controller_id }}'
              action: button_left_long
          - choose:
              - conditions: '{{ button_left_long_loop }}'
                sequence:
                  - repeat:
                      while: >-
                        {{ repeat.index < button_left_long_max_loop_repeats |
                        int }}
                      sequence: []
            default: []
      - conditions:
          - >-
            {% if integration_id == "zha" %} {{ trigger_action[:7] | string in
            button_left_release }} {% else %} {{ trigger_action | string in
            button_left_release }} {% endif %}
          - >-
            {{ not integration_id in integrations_with_prev_event_storage or
            last_controller_event | string in button_left_long }}
        sequence:
          - event: ahb_controller_event
            event_data:
              controller: '{{ controller_id }}'
              action: button_left_release
          - choose:
              - conditions: []
                sequence: []
      - conditions: '{{ trigger_action | string in button_right_short }}'
        sequence:
          - choose:
              - conditions: '{{ button_right_double_press }}'
                sequence:
                  - choose:
                      - conditions: >-
                          {{ trigger_action | string in
                          states(helper_last_controller_event) and trigger_delta
                          | int <= helper_double_press_delay | int }}
                        sequence:
                          - service: input_text.set_value
                            data:
                              entity_id: input_text.last_controller_event
                              value: >-
                                {{ {"a":"double_press","t":as_timestamp(now())}
                                | to_json }}
                          - event: ahb_controller_event
                            event_data:
                              controller: '{{ controller_id }}'
                              action: button_right_double
                          - choose:
                              - conditions: []
                                sequence: []
                    default:
                      - delay:
                          milliseconds: '{{ adjusted_double_press_delay }}'
                      - event: ahb_controller_event
                        event_data:
                          controller: '{{ controller_id }}'
                          action: button_right_short
                      - choose:
                          - conditions: []
                            sequence: []
            default:
              - event: ahb_controller_event
                event_data:
                  controller: '{{ controller_id }}'
                  action: button_right_short
              - choose:
                  - conditions: []
                    sequence: []
      - conditions: '{{ trigger_action | string in button_right_long }}'
        sequence:
          - event: ahb_controller_event
            event_data:
              controller: '{{ controller_id }}'
              action: button_right_long
          - choose:
              - conditions: '{{ button_right_long_loop }}'
                sequence:
                  - repeat:
                      while: >-
                        {{ repeat.index < button_right_long_max_loop_repeats |
                        int }}
                      sequence: []
            default: []
      - conditions:
          - >-
            {% if integration_id == "zha" %} {{ trigger_action[:7] | string in
            button_right_release }} {% else %} {{ trigger_action | string in
            button_right_release }} {% endif %}
          - >-
            {{ not integration_id in integrations_with_prev_event_storage or
            last_controller_event | string in button_right_long }}
        sequence:
          - event: ahb_controller_event
            event_data:
              controller: '{{ controller_id }}'
              action: button_right_release
          - choose:
              - conditions: []
                sequence: []
      - conditions: '{{ trigger_action | string in button_up_short }}'
        sequence:
          - choose:
              - conditions: '{{ button_up_double_press }}'
                sequence:
                  - choose:
                      - conditions: >-
                          {{ trigger_action | string in
                          states(helper_last_controller_event) and trigger_delta
                          | int <= helper_double_press_delay | int }}
                        sequence:
                          - service: input_text.set_value
                            data:
                              entity_id: input_text.last_controller_event
                              value: >-
                                {{ {"a":"double_press","t":as_timestamp(now())}
                                | to_json }}
                          - event: ahb_controller_event
                            event_data:
                              controller: '{{ controller_id }}'
                              action: button_up_double
                          - choose:
                              - conditions: []
                                sequence: []
                    default:
                      - delay:
                          milliseconds: '{{ adjusted_double_press_delay }}'
                      - event: ahb_controller_event
                        event_data:
                          controller: '{{ controller_id }}'
                          action: button_up_short
                      - choose:
                          - conditions: []
                            sequence:
                              - type: turn_on
                                device_id: 55e6463957f3e4013e4a56585baa66c6
                                entity_id: 8d3fe2bf27d970fd0cc26cda5bd4d562
                                domain: light
            default:
              - event: ahb_controller_event
                event_data:
                  controller: '{{ controller_id }}'
                  action: button_up_short
              - choose:
                  - conditions: []
                    sequence:
                      - type: turn_on
                        device_id: 55e6463957f3e4013e4a56585baa66c6
                        entity_id: 8d3fe2bf27d970fd0cc26cda5bd4d562
                        domain: light
      - conditions: '{{ trigger_action | string in button_up_long }}'
        sequence:
          - event: ahb_controller_event
            event_data:
              controller: '{{ controller_id }}'
              action: button_up_long
          - choose:
              - conditions: '{{ button_up_long_loop }}'
                sequence:
                  - repeat:
                      while: >-
                        {{ repeat.index < button_up_long_max_loop_repeats | int
                        }}
                      sequence:
                        - service: light.turn_on
                          data:
                            brightness_step: 15
                          target:
                            entity_id: light.bedroom_lights
            default:
              - service: light.turn_on
                data:
                  brightness_step: 15
                target:
                  entity_id: light.bedroom_lights
      - conditions:
          - '{{ trigger_action | string in button_up_release }}'
          - >-
            {{ not integration_id in integrations_with_prev_event_storage or
            last_controller_event | string in button_up_long }}
        sequence:
          - event: ahb_controller_event
            event_data:
              controller: '{{ controller_id }}'
              action: button_up_release
          - choose:
              - conditions: []
                sequence: []
      - conditions: '{{ trigger_action | string in button_down_short }}'
        sequence:
          - choose:
              - conditions: '{{ button_down_double_press }}'
                sequence:
                  - choose:
                      - conditions: >-
                          {{ trigger_action | string in
                          states(helper_last_controller_event) and trigger_delta
                          | int <= helper_double_press_delay | int }}
                        sequence:
                          - service: input_text.set_value
                            data:
                              entity_id: input_text.last_controller_event
                              value: >-
                                {{ {"a":"double_press","t":as_timestamp(now())}
                                | to_json }}
                          - event: ahb_controller_event
                            event_data:
                              controller: '{{ controller_id }}'
                              action: button_down_double
                          - choose:
                              - conditions: []
                                sequence: []
                    default:
                      - delay:
                          milliseconds: '{{ adjusted_double_press_delay }}'
                      - event: ahb_controller_event
                        event_data:
                          controller: '{{ controller_id }}'
                          action: button_down_short
                      - choose:
                          - conditions: []
                            sequence:
                              - type: turn_off
                                device_id: 55e6463957f3e4013e4a56585baa66c6
                                entity_id: 8d3fe2bf27d970fd0cc26cda5bd4d562
                                domain: light
            default:
              - event: ahb_controller_event
                event_data:
                  controller: '{{ controller_id }}'
                  action: button_down_short
              - choose:
                  - conditions: []
                    sequence:
                      - type: turn_off
                        device_id: 55e6463957f3e4013e4a56585baa66c6
                        entity_id: 8d3fe2bf27d970fd0cc26cda5bd4d562
                        domain: light
      - conditions: '{{ trigger_action | string in button_down_long }}'
        sequence:
          - event: ahb_controller_event
            event_data:
              controller: '{{ controller_id }}'
              action: button_down_long
          - choose:
              - conditions: '{{ button_down_long_loop }}'
                sequence:
                  - repeat:
                      while: >-
                        {{ repeat.index < button_down_long_max_loop_repeats |
                        int }}
                      sequence:
                        - service: light.turn_on
                          data:
                            brightness_step: -15
                          target:
                            entity_id: light.bedroom_lights
            default:
              - service: light.turn_on
                data:
                  brightness_step: -15
                target:
                  entity_id: light.bedroom_lights
      - conditions:
          - '{{ trigger_action | string in button_down_release }}'
          - >-
            {{ not integration_id in integrations_with_prev_event_storage or
            last_controller_event | string in button_down_long }}
        sequence:
          - event: ahb_controller_event
            event_data:
              controller: '{{ controller_id }}'
              action: button_down_release
          - choose:
              - conditions: []
                sequence: []
id: '1704037256684'
alias: Bedroom ikea switch
description: ''

A bit more experimenting. If I use a single bulb (that is not in a group) long presses seem to work. As soon as groups are introduced I get this buffer issue.

Beginning to think it’s something to do with my sonoff zigbee 3.0 USB Dongle. Going to try flashing it with the latest firmware later.