private@homelab: ~/latest
Home Assistant · Zigbee2MQTT · local control
private@homelab:~$ cat guides/article.md
·
· ·
8–12 minutes
read

Sonoff SNZB-01 Wireless Button: Zigbee2MQTT + Home Assistant

Pair a Sonoff SNZB-01 button with Zigbee2MQTT or ZHA, write press automations that survive the Zigbee2MQTT 2.0 action change, and buy the right coin cell.

Disclosure: This post contains affiliate links. If you buy through them, we earn a small commission at no extra cost to you.

The SONOFF SNZB-01 is a battery-powered Zigbee button with single, double and long presses. It can join Zigbee2MQTT or ZHA directly, using a compatible coordinator, without a SONOFF hub or eWeLink account. Zigbee2MQTT also lists the eWeLink RHK07 as a white-label device under the same definition; check the identifiers reported by your unit rather than assuming every similar-looking button is identical.

There are two details to check before setting it up. The SNZB-01 and SNZB-01P take different batteries, and older Home Assistant automation examples often depend on an action sensor that Zigbee2MQTT no longer enables by default. The button may be reporting perfectly while an old trigger listens to the wrong entity.

The steps below follow the manufacturer’s instructions and the integration projects’ documentation. They are not a record of a physical test of these buttons.

What the SNZB-01 actually is

The current Zigbee2MQTT definition exposes battery as a percentage, voltage in millivolts, and action for the press type. Link quality can also appear in MQTT messages. These are reports and events, not three settings you can write: action cannot be fetched with /get or changed with /set. Battery and voltage support reads, but the sleepy device must be awake to answer.

Note · compatibility

The released ZHA handler also maps the supported button identifiers to short, double and long press triggers. ZHA’s trigger names and YAML differ from MQTT’s. Use the trigger picker for the device you actually paired.

The original SNZB-01 also supports direct Zigbee binding to compatible individual devices or groups through the OnOff cluster. Zigbee2MQTT documents the binding commands as toggle for a single press, on for a double press, and off for a long press. This can control a light without an MQTT automation, although it does not add Home Assistant conditions or scenes.

A bound press still needs a working Zigbee network and reachable targets. The button’s parent can be a router rather than the coordinator; the coordinator helps set up the network and binding but is not necessarily in the path of each bound command. Direct binding can reduce dependence on Home Assistant’s automation engine during a restart. Test that behavior on your own network before relying on it. The SNZB-01P’s device notes report different binding behavior on firmware 2.2.0, so do not assume the same route works on the newer button.

Pairing the SNZB-01 with Zigbee2MQTT

  1. Check the label says SNZB-01, install the specified battery with the correct polarity, and enable permit join in the Zigbee2MQTT frontend.
  2. Remove the back cover to reach the original model’s reset button. Hold that button for five seconds, until the LED flashes three times. This is the reset/join control, not an ordinary long press of the main button.
  3. Wait for the interview to finish and check the identified model and exposes. Give it a friendly name, then try each of the three gestures with permit join turned off.

SONOFF’s instructions for the SNZB-01P use its pairing control; consult that model’s manual rather than copying the original’s cover-removal step. The supported SNZB-01 identifiers do not need an external converter in the released Zigbee2MQTT definition.

Illustrative MQTT payload: zigbee2mqtt/<friendly_name>
{
  "battery": 94,
  "voltage": 3000,
  "action": "single",
  "linkquality": 126
}

This example shows the message shape, not a capture from a tested unit. Battery reports need not arrive with every press. The device sleeps between activity and reporting periods; a short button press can wake it for an interaction. An action describes a momentary gesture even if a cached MQTT state still contains the last value.

If it does not join, check the cell and contacts, the reset indication, distance, interference and the interview log before changing hardware. If several unrelated devices also fail to join, our ZBDongle-E vs ZBDongle-P comparison covers coordinator choices. A failed interview on this one button does not by itself prove the coordinator is at fault.

Reading button actions: single, double, long

The SNZB-01 device page lists single, double and long. Its action mapping describes a single press after release and a short wait, a double press as two presses, and a long press held for about two seconds. There is no separate release action in this definition, so a hold-to-dim automation cannot depend on one.

Tuya’s multi-button scene switches have more combinations to map; our TS0043 three-button and TS0042 two-button guides cover those. The SNZB-01 suits a simpler job, such as a doorbell announcement or a goodnight scene, where one button and three gestures are enough.

SNZB-01 vs SNZB-01P: check the battery before you buy a spare

Both models currently expose the same named battery, voltage and action properties in Zigbee2MQTT, including the same three gestures. They are separate devices, however. Replacing one means pairing the replacement and checking its device ID, entity IDs, bindings and automation targets.

Model Current exposed properties Battery Vendor battery-life figure
SNZB-01 battery, voltage, action (single/double/long) 1 × CR2450 No comparable runtime figure used here
SNZB-01P battery, voltage, action (single/double/long) 1 × CR2477 Up to five years; SONOFF’s laboratory estimate

The device pages for SNZB-01 and SNZB-01P confirm the cell types. The original is 43 × 43 × 16 mm; SONOFF lists the 01P at 45 × 45 × 17.7 mm with a larger button area and an external pairing control. The 01P also has OTA support in the current Zigbee2MQTT definition; the original does not have that update route enabled.

SONOFF qualifies the five-year figure as a result from its internal laboratory and asks users to judge actual use. It does not establish how long your unit will last at your press frequency, signal conditions and reporting settings. Both cells are nominally 3 V, but their dimensions differ. Use the specified size rather than trying to make another coin cell fit.

Battery check

The original uses CR2450; the 01P uses CR2477. Confirm the printed model before ordering a spare, and follow the battery polarity markings when fitting it.

Automations: what Zigbee2MQTT 2.0 changed

The Zigbee2MQTT 2.0.0 breaking changes made the legacy action sensor disabled by default. That is a Zigbee2MQTT change, not a Home Assistant version number. The action still appears on the device’s MQTT messages; what changed was its default Home Assistant discovery.

A community thread about missing SNZB-01P gestures describes a similar symptom after an upgrade, but it does not prove the cause of every failed button automation. First watch the MQTT message while pressing the button. If the expected action arrives, check the automation’s trigger and discovery settings. If no action arrives, investigate the device and network instead.

Zigbee2MQTT recommends MQTT device triggers. Press single, double and long at least once after pairing, because discovery creates each action trigger when that action is first received. Then select the device and gesture in Home Assistant’s automation editor. This avoids depending on the deprecated action sensor; it does not guarantee compatibility with every future software change.

automations.yaml — list entry for an MQTT device trigger
- alias: "Hallway button - double press"
  triggers:
    - trigger: device
      domain: mqtt
      device_id: REPLACE_WITH_YOUR_DEVICE_ID
      type: action
      subtype: double
  actions:
    - action: light.toggle
      target:
        entity_id: light.hallway

Replace the device ID and target entity with the values from your installation. This is a list entry for an included automations.yaml. In the editor for a single automation, omit the leading list dash and its extra indentation. A list written directly inside Home Assistant’s configuration.yaml belongs under automation:; do not add that wrapper to an already included automation file.

Event entities are a separate, experimental opt-in route. Enable experimental_event_entities: true under Zigbee2MQTT’s homeassistant settings only if you intend to use them. Their state is the time of the last event; the gesture is in event_type. This example responds to a new timestamp and checks the gesture while excluding unavailable, unknown and restored states:

automations.yaml — optional event entity
- alias: "Hallway button - double press via event entity"
  triggers:
    - trigger: state
      entity_id: event.hallway_button_action
      to: null
  conditions:
    - condition: template
      value_template: >-
        {{ trigger.from_state is not none
           and trigger.to_state is not none
           and trigger.from_state.state not in ['unknown', 'unavailable']
           and trigger.to_state.state not in ['unknown', 'unavailable']
           and not trigger.from_state.attributes.get('restored', false)
           and not trigger.to_state.attributes.get('restored', false)
           and trigger.to_state.state != trigger.from_state.state
           and trigger.to_state.attributes.get('event_type') == 'double' }}
  actions:
    - action: light.toggle
      target:
        entity_id: light.hallway

Use the event entity ID shown in your installation. The guards deliberately skip initialization and recovery transitions, so the first press immediately after an unknown or unavailable state may be skipped. A second identical gesture still has a new timestamp. Triggering only when the event_type attribute changes to double would miss consecutive double presses.

Existing action-sensor automations

legacy_action_sensor: true under Zigbee2MQTT’s homeassistant settings restores the old action-sensor route. It remains deprecated. Use it as time to migrate existing automations, and check what your installation exposes before rewriting working triggers.

Skipping the boilerplate: the community blueprint

The awesome-ha-blueprints SONOFF controller offers configurable single, double and long press actions for Zigbee2MQTT, ZHA and deCONZ. Its current repository version includes MQTT device triggers for Zigbee2MQTT. Check the downloaded version and inputs before importing it: an older copy may use a different exposure pattern, and naming a blueprint here is not a promise of continuing maintenance.

For several buttons, a suitable blueprint can save repeating the same trigger blocks. After checking all gestures, choose the targets for each button. Our groups vs scenes guide explains the difference between a Zigbee group and a Home Assistant scene when you want one press to control several lights.

FAQ

What changes when I replace an SNZB-01 with an SNZB-01P? The current action names match, but the battery, casing, pairing control, update support and documented binding behavior differ. Pair the new device and check the references in existing automations.

What battery does the original use? One CR2450. The SNZB-01P uses one CR2477.

Why do double or long presses not trigger? Check the MQTT action first, then make sure each gesture has been discovered and the automation uses the right device ID and subtype. An old action-sensor trigger may need the deprecated opt-in setting or migration to a device trigger.

Does it need a SONOFF hub? A compatible Zigbee coordinator is enough for Zigbee2MQTT or ZHA. No eWeLink login is needed for those routes.

Can I use ZHA? Yes, the released handler supports the button identifiers and three gesture triggers. Create the automation from ZHA’s device trigger picker rather than copying the MQTT example unchanged.

Documentation and local operation

The model, cell and pairing details come from SONOFF’s pairing instructions, its product specifications and the two Zigbee2MQTT device references. The official SNZB-01P listing qualifies the battery-life estimate. Action discovery and the optional entity routes are documented in Zigbee2MQTT’s Home Assistant integration guide.

With Zigbee2MQTT, the button’s reports pass through your Zigbee network and local MQTT broker; ZHA uses its own Zigbee integration instead. Neither direct pairing route needs SONOFF’s cloud. A local light action can stay local, while a phone notification or another automation target may have its own internet requirement. Firmware distribution and future integration support remain separate dependencies.

Before copying a trigger, check the paired model, the action received and the device or entity ID Home Assistant actually provides. Those checks are more useful than guessing from the age of an example.


Hardware referenced:
Sonoff SNZB-01 on Amazon

local-firstHome Assistantno-cloud