Zigbee2MQTT - Sonoff Wireless Switch (SNZB-01)

Tags: #<Tag:0x00007fc404225ab8> #<Tag:0x00007fc4042259f0> #<Tag:0x00007fc404225928> #<Tag:0x00007fc404225860>

This is the blueprint for the Sonoff Zigbee Wireless Switch (SNZB-01):

Supported actions:

  1. Single press
  2. Double press
  3. Long press (4 seconds)
blueprint:
  name: Zigbee2MQTT - Sonoff SNZB-01 Zigbee Wireless Switch
  description: Automate your Sonoff SNZB-01 Zigbee Wireless Switch via Zigbee2MQTT.
  domain: automation
  input:
    switch:
      name: Sonoff SNZB-01 Zigbee Wireless Switch
      description: Sonoff SNZB-01 Zigbee Wireless Switch to use
      selector:
        entity:
          integration: mqtt
          domain: sensor
    single_press:
      name: Single Press
      description: Action to run on single press
      default: []
      selector:
        action: {}
    double_press:
      name: Double Press
      description: Action to run on double press
      default: []
      selector:
        action: {}
    long_press:
      name: Long Press
      description: Action to run on long press (4 seconds)
      default: []
      selector:
        action: {}
  source_url: https://github.com/AramidX/ha-blueprint/blob/dc4b846bc4dfa8725526606b07c051947bfc9687/blueprints/sonoff/sonoff_snzb01_wireless_switch_z2m.yaml
mode: restart
max_exceeded: silent
trigger:
- platform: state
  entity_id: !input "switch"
  attribute: action
action:
- variables:
    command: "{{ trigger.to_state.state }}"
- choose:
  - conditions: 
    - "{{ command == 'single' }}"
    sequence: !input "single_press"
  - conditions: 
    - "{{ command == 'double' }}"
    sequence: !input "double_press"
  - conditions: 
    - "{{ command == 'long' }}"
    sequence: !input "long_press"
1 Like

Hi, thank you for sharing this, I really appreciate it as I was able to get my Sonoff to work. The only problem is … when I press the Sonoff button and turn on the light, the log reports (every time) this error.

Can you kindly tell me how to solve this problem? Thank you very much, Andrea from Italy

This is due to Zigbee2MQTT. A fix is on the way as discussed here: Add default on all HA templates for attributes by mdegat01 · Pull Request #6988 · Koenkk/zigbee2mqtt · GitHub