ZHA Help, please. How to use a Zigbee button in an automation

There are a couple of blueprints floating around for ZHA:

https://community.home-assistant.io/t/zha-sonoff-snzb-01/317850

https://community.home-assistant.io/t/zha-sonoff-button-press-double-press-hold-actions/300080

They should just require updating the model to SNZB-01P to match your devices.

  • ZHA compat versus Z2M compat; Z2M wins (~2x) except for a few specific devices better supported by ZHA.
  • ZHA requires fewer steps to setup and is part of HA “out-of-the-box”.
  • Other “details” like running Z2M outside of HA (not as an addon) means the Zigbee network remains operational if you update/reboot HA.

With a quick search you should be able to find more information on the two.

Regarding your device with Z2M, you would be able to use something like this:

mode: queued
max: 10
trigger:
  - platform: state
    entity_id:
      - sensor.button_office_light_action
    to: single
    id: SINGLE
  - platform: state
    entity_id:
      - sensor.button_office_light_action
    to: double
    id: DOUBLE
  - platform: state
    entity_id:
      - sensor.button_office_light_action
    to: long
    id: LONG
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - SINGLE
        sequence: []
      - conditions:
          - condition: trigger
            id:
              - DOUBLE
        sequence: []
      - conditions:
          - condition: trigger
            id:
              - LONG
        sequence: []
1 Like