ZHA - Sonoff SNZB-01

Blueprint for the Sonoff SNZB-01.

You can set functions for single press, double press and hold. This allows you to assign, e.g., a scene or anything else.

Blueprint screen:

Blueprint to import:

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

blueprint:
  name: ZHA - Sonoff SNZB-01
  description: 'Perform actions with the Sonoff SNZB-01 Button.

    You can set functions for single press, double press and hold. This allows you to assign, 
    e.g., a scene or anything else.'

  domain: automation
  input:
    remote:
      name: Remote
      description: Sonoff Button to use
      selector:
        device:
          integration: zha
          manufacturer: eWeLink
          model: WB01
    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: {}
    hold:
      name: Hold
      description: Action to run on hold
      default: []
      selector:
        action: {}
  source_url: https://gist.github.com/seamus65/2be0f8c665ac8c1e011fbd1a0937f9e1
mode: restart
max_exceeded: silent
trigger:
- platform: event
  event_type: zha_event
  event_data:
    device_id: !input 'remote'
action:
- variables:
    command: '{{ trigger.event.data.command }}'
    cluster_id: '{{ trigger.event.data.cluster_id }}'
    endpoint_id: '{{ trigger.event.data.endpoint_id }}'
- choose:
  - conditions:
    - '{{ command == "toggle" }}'
    - '{{ cluster_id == 6 }}'
    - '{{ endpoint_id == 1 }}'
    sequence: !input 'single_press'
  - conditions:
    - '{{ command == "on" }}'
    - '{{ cluster_id == 6 }}'
    - '{{ endpoint_id == 1 }}'
    sequence: !input 'double_press'
  - conditions:
    - '{{ command == "off" }}'
    - '{{ cluster_id == 6 }}'
    - '{{ endpoint_id == 1 }}'
    sequence: !input 'hold'

5 Likes

How can I import this blueprint? It gives an error because the name not end with .YAML

1 Like

This is what worked for me:

  1. Copy the above source code
  2. Follow the steps under the section ‘Keeping blueprints up to date’ on this page Using Automation Blueprints - Home Assistant
  3. Instead of directly following step 2, create your own folder, then create your own empty yaml file in that folder.

I have corrected this now.

Sorry, I missed that when I created it.

1 Like

I have a Snzb-01 connected through Z2M and when using this blueprint it says no matching devices found.

Any suggestions?

1 Like

This blueprint is for devices through ZHA, but there shouldn’t be any reason you couldn’t update the blueprint YAML to suit your devices through Z2M.

i dont know what im doing wrong but it doesn’t work at my automation…

alias: ZHA - Sonoff SNZB-01
description: ""
use_blueprint:
  path: seamus65/ZHA - Sonoff SNZB-01.yaml
  input:
    remote: ca1970d941f9f6b6a5faf6a240e104ad
    single_press:
      - type: toggle
        device_id: 18766ba1f1d08ef8059f3f97b2891d03
        entity_id: light.signify_netherlands_b_v_lca001_huelight
        domain: light
    hold: []

Works perfectly for me!

Thank you for this beautiful Blueprint :heart_eyes:

  • Core 2023.11.3
  • Supervisor 2023.11.6
  • Operating System 11.2

Hi,
If you’re using Sonofflan, try this :

platform: state
entity_id:
  - sensor.sonoff_a44XXXXX #YourSensorID
to: single

This trigger works well for me Home Assistant 2024.3.0 (docker container)

You can use those 3 events:

  • single
  • double
  • hold