WLED Presets and Effects controlled by (zigbee2mqtt) IKEA Styrbar button

Figured someone might find this useful if you have your Styrbar linked via zigbee2mqtt.

Amend your config for the sensor name of your Styrbar unit and the first option for your preferred WLED preset.

Buttons work as follows:

Up: WLED on using preferred Preset
Down: WLED off (with 1 sec transition)
Short press right: cycle to next preset
Short press left: cycle to previous preset
Long press right: cycle to next effect
Long press left: cycle to previous effect

- id: '166396696034'
  alias: Styrbar Keuken
  description: Id 3
  use_blueprint:
    path: homeassistant/Z2M - IKEA STYRBAR 4-button remote.yaml
    input:
      remote: sensor.ikea_styrbar_keuken_action
      button_on:
      - service: select.select_option
        data:
          option: Warm Wit
        target:
          entity_id: select.wled_preset_2
      button_off:
      - service: light.turn_off
        data:
          transition: 1
        target:
          entity_id: light.wled_2
      button_brightness_move_up:
      - service: light.turn_on
        data:
          brightness_step_pct: 10
        target:
          entity_id: light.wled_2
      button_brightness_move_down:
      - service: light.turn_on
        data:
          brightness_step_pct: -10
        target:
          entity_id: light.wled_2
      button_left_click:
      - service: select.select_option
        data_template:
          option: '{% set options = state_attr(''select.wled_preset_2'',''options'')
            %} {% set  current_selection = states(''select.wled_preset_2'')%} {% if
            (current_selection) == "unknown" %} {{ "Warm Wit" }} {% else %} {% set
            selection = options.index(current_selection) %} {% if (selection - 1)
            >= options | length %} {{ options[0] }} {% else %} {{ options[selection
            - 1] }} {% endif %} {% endif %}

            '
        target:
          entity_id: select.wled_preset_2
      button_left_hold:
      - service: light.turn_on
        data_template:
          effect: '{% set effects = state_attr(''light.wled_2'',''effect_list'') %}
            {% set current_selection = state_attr(''light.wled_2'',''effect'') %}
            {% set  selection = effects.index(current_selection) %} {% if (selection
            - 1) >= effects | length %} {{ effects[0] }} {% else %} {{ effects[selection
            - 1] }} {% endif %}

            '
        target:
          entity_id: light.wled_2
      button_right_click:
      - service: select.select_option
        data_template:
          option: '{% set options = state_attr(''select.wled_preset_2'',''options'')
            %} {% set  current_selection = states(''select.wled_preset_2'')%} {% if
            (current_selection) == "unknown" %} {{ "Warm Wit" }} {% else %} {% set
            selection = options.index(current_selection) %} {% if (selection + 1)
            >= options | length %} {{ options[0] }} {% else %} {{ options[selection
            + 1] }} {% endif %} {% endif %}

            '
        target:
          entity_id: select.wled_preset_2
      button_right_hold:
      - service: light.turn_on
        data_template:
          effect: '{% set effects = state_attr(''light.wled_2'',''effect_list'') %}
            {% set current_selection = state_attr(''light.wled_2'',''effect'') %}
            {% set  selection = effects.index(current_selection) %} {% if (selection
            + 1) >= effects | length %} {{ effects[0] }} {% else %} {{ effects[selection
            + 1] }} {% endif %}

            '
        target:
          entity_id: light.wled_2

3 Likes