Niko Battery switch multi button (Z2M / ZHA) Custom and Light mode [552-720X1][552-720X2][552-720X4]

GitHub Code Release

This blueprint enables comprehensive control of Niko Battery switches (models 552-720X1, 552-720X2, 552-720X4) through Zigbee2MQTT or ZHA integration, supporting both custom actions and light automation.

:iphone: Supported Models

  • 552-720X1: Battery switch with 1 button
  • 552-720X2: Battery switch with 2 buttons (Left, Right)
  • 552-720X4: Battery switch with 4 buttons (Top Left, Bottom Left, Top Right, Bottom Right)

:sparkles: Key Features

  • Multiple Integration Options: Choose Zigbee2MQTT (Z2M), ZHA, or both
  • Custom Mode: Program the buttons to execute your personalized home automation routines, from controlling your shades to activating security modes.
  • Lights Mode: Dim, brighten, and change the color of your lights depending on day and time of day with the intuitive buttons and a schedule.
  • Adaptive Lighting Support: Integrates with Home Assistant schedule helpers and adaptive lighting sensors for dynamic brightness and color temperature adjustments throughout the day.
  • Auto-Adjust: Optionally enable automatic light adjustment when your schedule changes - lights will smoothly transition to match the current schedule settings.

Each configuration option below includes detailed instructions in the automation editor.

:control_knobs: Button Mapping

  • 1-Button (552-720X1)
    • Button 1: The single button
  • 2-Button (552-720X2)
    • Button 1: Left button
    • Button 2: Right button
  • 4-Button (552-720X4)
    • Button 1: Top Left button
    • Button 2: Bottom Left button
    • Button 3: Top Right button
    • Button 4: Bottom Right button

:gear: Button Functions

  • Short Press On/Off: Each button alternates between On and Off commands
  • Long Press: Built-in dimming functionality (increase/decrease brightness)
  • Double Press: Custom command (not built into the switch, implemented by blueprint)

:clipboard: Requirements

  • Home Assistant: Version 2024.10.0 or later
  • Zigbee Integration: Zigbee2MQTT (Z2M) and/or Zigbee Home Automation (ZHA)
  • Compatible Models: 552-720X1, 552-720X2, or 552-720X4
  • Text Helper: One per switch (for double-click guard)

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

New update:

  • 2025.12.1 Add configurable dimming speed and reorganize blueprint documentation
  • Add dimming speed control (1-10 scale) with automatic step size calculation
  • Add per-action reset control for on/off/dimmer button presses
  • Add auto-adjust feature to automatically update lights when schedule changes
  • Reorganize inputs into logical sections (Light Mode, Custom Actions, Auto-Adjust)
  • Streamline blueprint description and improve input labels
  • Add support for optional schedules with proper empty value handling

:warning: New Update Available (2025.12.3)

What’s New:

  • Add Zigbee2MQTT (Z2M) support alongside existing ZHA
  • Add integration type selector to choose Z2M, ZHA, or both
  • Add Z2M configuration section (base topic, device friendly name)
  • Unify button action handling for both ZHA and Z2M triggers
  • Fix single entity/device/area selection handling
  • Fix schedule attribute handling when schedule state is “off”
  • Add styled description tags for all inputs
  • Rename blueprint to reflect dual integration support
  • Fix naming consistency in Niko blueprint

Upgrade Instructions:

Please re-import the blueprint and reconfigure your automations.

The blueprint has been renamed from zha-niko-battery-switch-with-1-button.yaml to niko-battery-switch-with-1-button.yaml. To keep your existing settings:

  1. Open your automation in the YAML editor
  2. Change the blueprint path from: danielpetrovic/zha-niko-battery-switch-with-1-button.yaml to: danielpetrovic/niko-battery-switch-with-1-button.yaml
  3. Save and reload

This preserves all your current configuration without needing to reconfigure from scratch.

:warning: New Update Available (2025.12.4)

What’s New:

Simply set the Light Adjustment Mode to “Adaptive” and point to the helpers updated by the scheduler!

Upgrade Instructions:

Please re-import the blueprint. Your existing settings will be preserved - the new options default to “Static” mode for backwards compatibility.

Hi,

As you asked in the private message i send to you, i was going to post the request here, so others could enjoy it too.

This blueprint is for the niko zigbee swtiches with 1 button.
I however have only 4gang zigbee switches from niko.

I tried adjusting your blueprint, i tried (with the help of ai) to make my own blueprint, but i was not able to create a well working blueprint (there was always an issue, ether it was the dim button not working anymore, or the double click not working…)

I have the following model: Niko 552-721X2 control via MQTT | Zigbee2MQTT

You said in private message that you wanted to include 2 gang and 4 gang switches, so i would be glad to be a test case for you :slight_smile:
Currently i have 22 switches, 21 of them are configured in zha and do actions from the zha events.
However, since a few days i’m setting up z2m, so step by step i’ll be migrating all switches to Z2M
Currently on zha i’m only to have a “on” action, an “off” action and an “hold” action.
Where your blueprint has “on”, “off”, “dim up”, “dim down”, “double click on” and “double click off”, so that are way more actions i would be able to use.
a quick question, is it the “goal” of your dim up/dim down that if you hold the button the light dims up/down by a certain percentage for each (lets say) 0.5 seconds you hold it?


Another question you might have an solution for (or maby you could build in):
My house has 4 floors.
On each floor i have a 4gang switch.
On each switch 1 button is programmed to turn on/off a light on floor A, one button for floor B, one for floor C and one for floor D.
But the downside is that (atleast in my config currently) a button has an “on” action and an “off” action.
But those actions are not synced between different switches/floors.
So it happens to many times that when i go upstairs i have to push a button 2 times because the button on that floor was in the wrong “action”.

For example when i go upstairs i turn on the light on floor 1, when i’m at floor 2 i press the button and the light turns off.
This means that for the button on floor 1 the next “action” is “off” and for the button on floor 2 the next “action” is “on”.
But lets say it sunny, i don’t need a light to go downstairs.
Later that day i want to go up the stairs again and i need ligth, so i click the button on floor 1.
But his next action was “off”, but the light already was off, so i need to click a second time so the actions is “on”, then i arrive at the second floor and i click the button, but this button next action was “on”, but the light needs to turn off, so i need to press a second time.
Combine this with a wife that doens’t yet remember the “which button controls which floor” (because we just moved in to our house) and it makes that my staircase turns in the a christmas tree sometimes because my wife is clicking multiple times on multiple buttons because she thinks she pressed the wrong button, but actually it was the right button but the “next action” was wrong/not synced…

I tried (with ai) to make a fix for this, i tested it in the toilet on the ground floor and this seems to work, but mayby you have a better solution.
Right now i have adjust the zha automation for those buttons and i have the following yaml’s for it:
A central button handler for this lighting point:

alias: AAAAAAtest V0 - Toilet - central button handler
description: Central handler voor toilet lamp endpoints 1 en 4
triggers:
  - event_type: zha_event
    event_data:
      device_ieee: 00:3c:84:ff:fe:8b:e9:11
      endpoint_id: 1
    trigger: event
  - event_type: zha_event
    event_data:
      device_ieee: 00:3c:84:ff:fe:8b:e9:11
      endpoint_id: 4
    trigger: event
actions:
  - variables:
      ep: "{{ trigger.event.data.endpoint_id | int }}"
      next_helper: |-
        {% if ep == 1 %}
          input_boolean.toilet_ep1_next_on
        {% elif ep == 4 %}
          input_boolean.toilet_ep4_next_on
        {% else %}
          input_boolean.toilet_ep1_next_on
        {% endif %}
      next_is_on: "{{ states(next_helper) == 'on' }}"
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ next_is_on }}"
        sequence:
          - target:
              entity_id: light.v0_toilet_licht_light
            action: light.turn_on
          - target:
              entity_id:
                - input_boolean.toilet_ep1_next_on
                - input_boolean.toilet_ep4_next_on
            action: input_boolean.turn_off
          - target:
              entity_id: input_boolean.toilet_virtual_state_on
            action: input_boolean.turn_on
      - conditions:
          - condition: template
            value_template: "{{ not next_is_on }}"
        sequence:
          - target:
              entity_id: light.v0_toilet_licht_light
            action: light.turn_off
          - target:
              entity_id:
                - input_boolean.toilet_ep1_next_on
                - input_boolean.toilet_ep4_next_on
            action: input_boolean.turn_on
          - target:
              entity_id: input_boolean.toilet_virtual_state_on
            action: input_boolean.turn_off
mode: single

and i had to make booleans and put them in my configuration.yaml:

# configuration.yaml (of input_boolean.yaml)
input_boolean:
  # Virtuele lampstatus
  toilet_virtual_state_on:
    name: Toilet virtuele status
    initial: off
    icon: mdi:lightbulb

  # Endpoint 1: volgende actie ON?
  toilet_ep1_next_on:
    name: Toilet endpoint 1 volgende actie ON
    initial: on
    icon: mdi:toggle-switch

  # Endpoint 4: volgende actie ON?
  toilet_ep4_next_on:
    name: Toilet endpoint 4 volgende actie ON
    initial: on
    icon: mdi:toggle-switch

But i hope there is a “quicker/cleaner” way.
Because if i have to create boolean records for each of my 126 innr lightbulbs, i’ll have some timeconsuming job ahead :smiley:

Ok, good to know you have the four button version in ZHA currently, as there is 0 information online what the events are.

Can you check which evens you get when you press each button? If you could map it like the example below, that way I can alter the blueprint to also support the four button version and also implement the two button version, based on what we see with the four button version.

endpoint_id: is probably used to identify which button is pressed? Can you check and let me know which button is which?

Current triggers in the single button:

Event Mapping Table

Action ZHA Event Z2M MQTT Action
Short Press On command: "on" "on"
Short Press Off command: "off" "off"
Long Press (Brightness Up) command: "move" or "move_with_on_off"
args: [0]
"brightness_move_up"
Long Press (Brightness Down) command: "move"
args: [1]
"brightness_move_down"
Long Press Release command: "stop" "brightness_stop"

ZHA Event Structure

event_type: zha_event
event_data:
  device_id: <your_device_id>
  command: "on"  # or "off", "move", "move_with_on_off", "stop"
  endpoint_id: x
  args: [0]      # Only for move commands: 0 = up, 1 = down

Z2M MQTT Payload

{
  "action": "on"  // or "off", "brightness_move_up", "brightness_move_down", "brightness_stop"
}

Notes

  • The button alternates between on and off commands on consecutive short presses
  • Double press is NOT a native switch feature - it is implemented in the blueprint by detecting two quick presses within ~300ms
  • Long press for dimming:
    • ZHA uses move command with direction argument (0 = increase, 1 = decrease)
    • Z2M provides descriptive action names directly
  • Release after long press triggers stop command in both integrations

Hi,

I’m gonna try to work in bullet points, this will be more easy to read (i think)

  • I currently have most of them on ZHA, but i want to migrate them to Z2M (my second coordinator arrived 3 days ago, so i can migrate step by step).
    Mainly because i was told dat z2m is more stable, better and has more possibilities in more devices (and it can upgrade firmware).

  • i currently have the following events (if i check in developer tools=> events):

action zha event z2m mqtt action
short press on command: “on” “on”
short press off command: “off” “off”
long press (brightness up) command: move_with_on_off brightness_move_up
long press (brightness down) command: move brightness_move_down
long press release command: stop brightness_stop

so as you can see there is no exact brightness up or down command.
important to notice is that it requires the device id and unique id, the device_ieee is the “identifier” for the switch, where the unique_id is the “identifier” for which button on the switch it is.
in front of the “0x0006” is a 1, 2, 3 or 4, this is:
1=> left top
2=> left bottom
3=> right top
4=> right bottom

this for example is the readout from the developer tools:

event_type: zha_event
data:
  device_ieee: 00:3c:84:ff:fe:8b:e6:bf
  device_id: 1ad08b5cd06fbcd4ab646738d911e42d
  unique_id: 00:3c:84:ff:fe:8b:e6:bf:1:0x0006
  endpoint_id: 1
  cluster_id: 6
  command: "off"
  args: []
  params: {}
origin: LOCAL
time_fired: "2025-12-26T10:33:13.389971+00:00"
context:
  id: 01KDD3GEXDQW8BGC4JWB9NB65H
  parent_id: null
  user_id: null

I use this in the following way to make it work in my automations (:

alias: V-1 - mancave - knop links boven push off
description: ""
triggers:
  - event_type: zha_event
    event_data:
      device_ieee: 00:3c:84:ff:fe:8b:e6:bf
      unique_id: 00:3c:84:ff:fe:8b:e6:bf:1:0x0006
      command: "off"
    trigger: event
conditions: []
actions:
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: light.v_1_wasplaatst_light_group
mode: single

This for example is the output for the long presses in the developer tools:

event_type: zha_event
data:
  device_ieee: 00:3c:84:ff:fe:8b:e6:bf
  device_id: 1ad08b5cd06fbcd4ab646738d911e42d
  unique_id: 00:3c:84:ff:fe:8b:e6:bf:1:0x0008
  endpoint_id: 1
  cluster_id: 8
  command: move_with_on_off
  args:
    - 0
    - 50
  params:
    move_mode: 0
    rate: 50
origin: LOCAL
time_fired: "2025-12-26T10:41:57.423723+00:00"
context:
  id: 01KDD40ENFDYY109PR7XAEWM72
  parent_id: null
  user_id: null
event_type: zha_event
data:
  device_ieee: 00:3c:84:ff:fe:8b:e6:bf
  device_id: 1ad08b5cd06fbcd4ab646738d911e42d
  unique_id: 00:3c:84:ff:fe:8b:e6:bf:1:0x0008
  endpoint_id: 1
  cluster_id: 8
  command: stop
  args:
    - 255
    - 255
  params:
    options_mask: 255
    options_override: 255
origin: LOCAL
time_fired: "2025-12-26T10:41:57.616213+00:00"
context:
  id: 01KDD40EVGSMGBW74PMY5J423H
  parent_id: null
  user_id: null
event_type: zha_event
data:
  device_ieee: 00:3c:84:ff:fe:8b:e6:bf
  device_id: 1ad08b5cd06fbcd4ab646738d911e42d
  unique_id: 00:3c:84:ff:fe:8b:e6:bf:1:0x0008
  endpoint_id: 1
  cluster_id: 8
  command: move
  args:
    - 1
    - 50
    - 255
    - 255
  params:
    move_mode: 1
    rate: 50
    options_mask: 255
    options_override: 255
origin: LOCAL
time_fired: "2025-12-26T10:41:58.628383+00:00"
context:
  id: 01KDD40FV4PBM8E1A6C5B64KCM
  parent_id: null
  user_id: null

event_type: zha_event
data:
  device_ieee: 00:3c:84:ff:fe:8b:e6:bf
  device_id: 1ad08b5cd06fbcd4ab646738d911e42d
  unique_id: 00:3c:84:ff:fe:8b:e6:bf:1:0x0008
  endpoint_id: 1
  cluster_id: 8
  command: stop
  args:
    - 255
    - 255
  params:
    options_mask: 255
    options_override: 255
origin: LOCAL
time_fired: "2025-12-26T10:41:58.856557+00:00"
context:
  id: 01KDD40G28Y9XQNQ3WV64KZVH8
  parent_id: null
  user_id: null

Considering your notes:

  • The button alternates between on and off commands on consecutive short presses
    So this means the only way to sync them is that script that ai provide?
  • Double press is NOT a native switch feature - it is implemented in the blueprint by detecting two quick presses within ~300ms
    This i tried to implement myself, but it seemed to not work, but i’m offcourse new to home assistant and blueprints :stuck_out_tongue:

Normally the endpoint_id is used to differentiate the button presses. The extra values behind the device_ieee in unique_id should represent the endpoint_id and cluster_id.

Can you check for each button press if they all follow:

endpoint_id: 1
cluster_id: 6

I am expexting that button 2/3/4 will change the endpoint_id .

Can you check for each long press if they all follow:

endpoint_id: 1
cluster_id: 8

I am expexting that button 2/3/4 will change the endpoint_id .

As my button only has 1 button, it always gives endpoint_id: 1.

Z2M on command:

event_type: zha_event
data:
  device_ieee: 00:3c:84:ff:fe:8c:02:2f
  device_id: 9255ccd79b61c364a3a8319ded5a4447
  unique_id: 00:3c:84:ff:fe:8c:02:2f:1:0x0006
  endpoint_id: 1
  cluster_id: 6
  command: "on"
  args: []
  params: {}

Z2M off command:

event_type: zha_event
data:
  device_ieee: 00:3c:84:ff:fe:8c:02:2f
  device_id: 9255ccd79b61c364a3a8319ded5a4447
  unique_id: 00:3c:84:ff:fe:8c:02:2f:1:0x0006
  endpoint_id: 1
  cluster_id: 6
  command: "off"
  args: []
  params: {}

Z2M brightness_move_up command:

event_type: zha_event
data:
  device_ieee: 00:3c:84:ff:fe:8c:02:2f
  device_id: 9255ccd79b61c364a3a8319ded5a4447
  unique_id: 00:3c:84:ff:fe:8c:02:2f:1:0x0008
  endpoint_id: 1
  cluster_id: 8
  command: move_with_on_off
  args:
    - 0
    - 50
  params:
    move_mode: 0
    rate: 50

Z2M brightness_move_down command:

event_type: zha_event
data:
  device_ieee: 00:3c:84:ff:fe:8c:02:2f
  device_id: 9255ccd79b61c364a3a8319ded5a4447
  unique_id: 00:3c:84:ff:fe:8c:02:2f:1:0x0008
  endpoint_id: 1
  cluster_id: 8
  command: move
  args:
    - 1
    - 50
    - 255
    - 255
  params:
    move_mode: 1
    rate: 50
    options_mask: 255
    options_override: 255

Z2M brightness_stop command:

event_type: zha_event
data:
  device_ieee: 00:3c:84:ff:fe:8c:02:2f
  device_id: 9255ccd79b61c364a3a8319ded5a4447
  unique_id: 00:3c:84:ff:fe:8c:02:2f:1:0x0008
  endpoint_id: 1
  cluster_id: 8
  command: stop
  args:
    - 255
    - 255
  params:
    options_mask: 255
    options_override: 255

What you are saying is correct.
If i check the automations for the switches i added last, i never used the
endpoint_id: 1
cluster_id: 8
I only used
device_ieee: 00:3c:84:ff:fe:8c:02:2f
unique_id: 00:3c:84:ff:fe:8c:02:2f:1:0x0008

Do you know if there is a way (or how i do it) to make my button sync work in your blueprint?

Because now in my test case (the toilet on the ground floor) i disabled the following 4 automations:

alias: V0 - toilet - knop links boven push off
description: ""
triggers:
  - event_type: zha_event
    event_data:
      device_ieee: 00:3c:84:ff:fe:8b:e9:11
      unique_id: 00:3c:84:ff:fe:8b:e9:11:1:0x0006
      endpoint_id: 1
      command: "off"
    trigger: event
conditions: []
actions:
  - action: automation.trigger
    metadata: {}
    data:
      skip_condition: true
    target:
      entity_id: automation.v0_toilet_licht_schakelaar_command_off
mode: single

alias: V0 - toilet - knop links boven push on
description: ""
triggers:
  - event_type: zha_event
    event_data:
      device_ieee: 00:3c:84:ff:fe:8b:e9:11
      unique_id: 00:3c:84:ff:fe:8b:e9:11:1:0x0006
      endpoint_id: 1
      command: "on"
    trigger: event
conditions: []
actions:
  - action: automation.trigger
    metadata: {}
    data:
      skip_condition: true
    target:
      entity_id: automation.v0_toilet_licht_schakelaar_command_on
mode: single

alias: V0 - toilet - knop links boven push on
description: ""
triggers:
  - event_type: zha_event
    event_data:
      device_ieee: 00:3c:84:ff:fe:8b:e9:11
      unique_id: 00:3c:84:ff:fe:8b:e9:11:1:0x0006
      endpoint_id: 1
      command: "on"
    trigger: event
conditions: []
actions:
  - action: automation.trigger
    metadata: {}
    data:
      skip_condition: true
    target:
      entity_id: automation.v0_toilet_licht_schakelaar_command_on
mode: single

alias: V0 - toilet - knop rechts onder push on
description: ""
triggers:
  - event_type: zha_event
    event_data:
      device_ieee: 00:3c:84:ff:fe:8b:e9:11
      unique_id: 00:3c:84:ff:fe:8b:e9:11:4:0x0006
      endpoint_id: 4
      command: "on"
    trigger: event
conditions: []
actions:
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      area_id: toilet_gelijksvloer
mode: single

and had the following created by ai, so the buttons sync (the goal is to use this for hallways etc):

alias: AAAAAAtest V0 - Toilet - central button handler
description: Central handler voor toilet lamp endpoints 1 en 4
triggers:
  - event_type: zha_event
    event_data:
      device_ieee: 00:3c:84:ff:fe:8b:e9:11
      endpoint_id: 1
    trigger: event
  - event_type: zha_event
    event_data:
      device_ieee: 00:3c:84:ff:fe:8b:e9:11
      endpoint_id: 4
    trigger: event
actions:
  - variables:
      ep: "{{ trigger.event.data.endpoint_id | int }}"
      next_helper: |-
        {% if ep == 1 %}
          input_boolean.toilet_ep1_next_on
        {% elif ep == 4 %}
          input_boolean.toilet_ep4_next_on
        {% else %}
          input_boolean.toilet_ep1_next_on
        {% endif %}
      next_is_on: "{{ states(next_helper) == 'on' }}"
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ next_is_on }}"
        sequence:
          - target:
              entity_id: light.v0_toilet_licht_light
            action: light.turn_on
          - target:
              entity_id:
                - input_boolean.toilet_ep1_next_on
                - input_boolean.toilet_ep4_next_on
            action: input_boolean.turn_off
          - target:
              entity_id: input_boolean.toilet_virtual_state_on
            action: input_boolean.turn_on
      - conditions:
          - condition: template
            value_template: "{{ not next_is_on }}"
        sequence:
          - target:
              entity_id: light.v0_toilet_licht_light
            action: light.turn_off
          - target:
              entity_id:
                - input_boolean.toilet_ep1_next_on
                - input_boolean.toilet_ep4_next_on
            action: input_boolean.turn_on
          - target:
              entity_id: input_boolean.toilet_virtual_state_on
            action: input_boolean.turn_off
mode: single

And i had to put the following in configuration.yaml:

# configuration.yaml (of input_boolean.yaml)
input_boolean:
  # Virtuele lampstatus
  toilet_virtual_state_on:
    name: Toilet virtuele status
    initial: off
    icon: mdi:lightbulb

  # Endpoint 1: volgende actie ON?
  toilet_ep1_next_on:
    name: Toilet endpoint 1 volgende actie ON
    initial: on
    icon: mdi:toggle-switch

  # Endpoint 4: volgende actie ON?
  toilet_ep4_next_on:
    name: Toilet endpoint 4 volgende actie ON
    initial: on
    icon: mdi:toggle-switch

Ok, i will implement the changes to support the 2/4 button models as well based on this.

You can also use light.toggle for both on/off presses. That way you don’t need to sync it like you are doing now.

:warning: New Update Available (2025.12.5)

What’s New:

  • Add multi-button support for 1-button, 2-button, and 4-button Niko switches in single blueprint
  • Add independent configuration for each button (custom actions, light mode, settings)
  • Add button-specific schedule and adaptive lighting support
  • Add per-button auto-adjust functionality
  • Rename blueprint to niko-battery-switch-multi-button.yaml to reflect multi-button capability, this should be the final name change.
  • Maintain full feature parity across all buttons

Button Mapping:

  • 1-button (552-720X1): Button 1
  • 2-button (552-720X2): Button 1 = Left, Button 2 = Right
  • 4-button (552-720X4): Button 1 = Top Left, Button 2 = Bottom Left, Button 3 = Top Right, Button 4 = Bottom Right

Upgrade Instructions:
Please re-import the blueprint and reconfigure your automations.

The blueprint has been renamed from niko-battery-switch-with-1-button.yaml to niko-battery-switch-multi-button.yaml. To keep your existing settings:

  1. Open your automation in the YAML editor
  2. Change the blueprint path from: danielpetrovic/niko-battery-switch-with-1-button.yaml to: danielpetrovic/niko-battery-switch-multi-button.yaml
  3. Save and reload

This preserves all your current configuration without needing to reconfigure from scratch.


As I don’t have the 2-button or 4-button versions myself, please test it and let me know if you encounter errors. If you do, please provide some logs/traces so I can diagnose it.

1 Like

The reason i don’t like/use the toggle function is because most of our lights have 2 or 3 ledbulbs in them.
If one of the reacts slowly and you push again on the button, they are out of sync and you end up with 1/3 on/off and you have to manual fix this by going into settings->devices → search the device and adjust it

You should put those lights into a Zigbee Group and target the group entities. ZHA and Z2M both support this. That way they are always controlled as one entity.

I even use this in the garden where we have 11 in one group. In the kitchen we have four spots, that are always 100% identical when I target the Zigbee Group (not HA Group). This worked fine in ZHA and now also in Z2M after my full move to Z2M.

Can you please check if the rest of the new update works for you? So that we know that the button mappings are working.

they are all in groups, but somehow :frowning:

Are you certain you are using Zigbee Groups? And not the Home Assistant Groups?

Home Assistant Groups still target each light as a separate entity.

Zigbee groups send a broadcast signal over the Zigbee network to all lights in the group at the same time.

that could be it, i mad them in settings=> helpers.

I tested the blue print quickly but it doens’t work (or i’m doing it it wrong).

It created the following yaml:

alias: aaaaa test multibutton
description: ""
use_blueprint:
  path: danielpetrovic/niko-battery-switch-multi-button.yaml
  input:
    device_model: 4_button
    integration_type:
      - z2m
    z2m_device_name: V-1 - mancave - schakelaar
    button_1_on_light_mode:
      - toggle
    button_1_off_light_mode:
      - toggle
    button_1_light:
      entity_id: light.v_1_wasplaatst_light_group
    button_1_double_press:
      - action: light.toggle
        metadata: {}
        target:
          entity_id: light.v_1_mancave_light_group
        data: {}

Press short on/off works
Double press doesn’t work, instead of turning on another light, it just quickly turns on/off the light from the short press.
The dim function:
If the light is on and i long press, nothing happens.
If the light is off and i long press, the light goes up 1 time but nothing happens, if i then release the button and hold it again, the light goes out.

:warning: New Update Available (2025.12.6)
Bug Fix Release

What’s Fixed:

  • Fix 4-button double-press detection for Z2M devices - buttons now correctly trigger their assigned double-press actions instead of wrong button mappings
  • Fix dimming functionality - long press now smoothly dims/brightens lights and stops immediately when button is released (previously would only dim 1-2 steps or continue indefinitely)
  • Fix dimming interference - dimming no longer stops prematurely due to unrelated device messages (battery updates, etc.)

Upgrade Instructions:
Simply re-import the blueprint - your existing automations will continue to work with the fixes applied automatically. No reconfiguration needed.

I’ve released a new update with some fixes, please reimport and check again.

And yes the Light group you can make as a Helper in Home Assistant is a Home Assistant Group, not a Zigbee Group. You need to make it in either Z2M or ZHA directly and target the created group instead of the separate lights. For HA it will show an extra light.groupname with what you have set within Z2M/ZHA.

You could also place one of the Zigbee groups inside a HA Group Helper object and still trigger the HA Group Helper.

1 Like

Hi,

I tested your bugfix, this time i attached a light group to each button and on double press (for each button) i added a light toggle to a light.
So i can test every button (in the previous test i tested only one button to start with).

This is the yaml it created:

alias: aaaaa test multibuton
description: ""
use_blueprint:
  path: danielpetrovic/niko-battery-switch-multi-button.yaml
  input:
    device_model: 4_button
    integration_type:
      - z2m
    z2m_device_name: V-1 - mancave - schakelaar
    button_1_light:
      entity_id: light.v_1_wasplaatst_light_group
    button_1_on_light_mode:
      - toggle
    button_1_off_light_mode:
      - toggle
    button_1_double_press:
      - action: light.toggle
        metadata: {}
        target:
          entity_id: light.v_1_mancave_light_group
        data: {}
    button_2_light:
      entity_id: light.v_1_wijnkelder_light_group
    button_2_on_light_mode:
      - toggle
    button_2_off_light_mode:
      - toggle
    button_2_double_press:
      - action: light.toggle
        metadata: {}
        target:
          entity_id: light.v_1_mancave_light_group
        data: {}
    button_3_light:
      entity_id: light.v_1_hal_light_group
    button_3_on_light_mode:
      - toggle
    button_3_off_light_mode:
      - toggle
    button_3_double_press:
      - action: light.toggle
        metadata: {}
        target:
          entity_id: light.v_1_mancave_light_group
        data: {}
    button_4_double_press:
      - action: light.toggle
        metadata: {}
        target:
          entity_id: light.v_1_wasplaatst_light_group
        data: {}
    button_4_light:
      entity_id: light.v_1_mancave_light_group
    button_4_on_light_mode:
      - toggle
    button_4_off_light_mode:
      - toggle

What is working/not working:

  • button1

    • dim function works
    • toggle on/off works
    • double click doesn’t work this acts as 2 clicks on the short press
  • button 2

    • toggle function turns on the wrong light (wasplaats instead of wijnkelder)
    • dim function doesn’t work it does completly nothing
    • double click doesn’t work this acts as 1 click on the short press
  • button 3

    • toggle function turns on the wrong light (wijnkelder instead of hal)
    • dim function doesn’t work 1 time it does nothing, the other time it turns on the light in wasplaats
    • double click doesn’t work this dims and "un"dims the light of wijnkelder
  • button 4

    • toggle function turns on the wrong light (wijnkelder instead of mancave)
    • dim function doesn’t work it does completly nothing
    • double click doesn’t work this turns on the light in wijnkelder on lowest brightnes and instantly turns it back off

:warning: New Update Available (2025.12.7)
Bug Fix Release + Enhancement

What’s Fixed:

  • Fix button mapping for 4-button switches - buttons 2, 3, and 4 were controlling wrong lights due to incorrect pattern matching order
  • Fix dimming functionality - replaced broken implementation with working parallel/stop_flag approach, all buttons now properly support long press dimming
  • Fix double-press detection - corrected button number calculation using same pattern matching fix
  • Fix “Already running” log errors - changed automation mode to queued to handle rapid button presses without rejecting them

What’s New:

  • Add configurable double-press timeout - adjust detection window from 100ms to 1000ms (default 300ms) to match your preference

Upgrade Instructions: Simply re-import the blueprint - your existing automations will continue to work with the fixes applied automatically. You’ll see the new double-press timeout setting in blueprint configuration.