Sonoff switch SNZB-01 (Zigbee) is missing entities

@Luke001IT I had the same issue as I’m not using ZHA but zigbee2mqtt, too. After trying a lot of different options that were not working, I eventually found out the following automation using templating works. I’m still working on improving this so you don’t need three automations for each button :stuck_out_tongue: .

alias: Turn on light
description: ''
trigger:
  - platform: event
    event_type: state_changed
    context: {}
    event_data:
      entity_id: sensor.sonoff_switch_01_action
condition:
  - condition: state
    entity_id: sensor.sonoff_switch_01_action
    state: single
action:
  - service: light.toggle
    data: {}
    target:
      entity_id: light.book_leds_wlightboxs_brightness
mode: single

@mmcghee and @Najam hopefully this works for you, too!

My experience with a Xiaomi WXKG11LM in Zigbee2MQTT might be similar to your SONOFF SNZB-01. I still do not have as solid an automation with this switch as I would like but two scripts below show the direction I have gone to try and use a single click as well as a double click from the Xiaomi. I am using the ‘trigger.to_state’ event as shown. I am finding that being able to capture the various ‘clicks’ and ‘twists’ of these wireless control devices is a bit hard. Good hunting!

- alias: "Kitchen Light Toggle Day"
  trigger:
  - platform: state
    entity_id: sensor.xiaomi_kitchen_light_switch_action
  condition:
    - condition: template
      value_template: >
        {{ trigger.to_state.state == 'single'}}
  action:
  - service: light.toggle
    data:
      entity_id:
        - light.galaxy_ai_plus_sink
        - light.galaxy_ai_plus_breakfast_table
      brightness: 255
      color_temp: 153
  mode: single

- alias: "Kitchen Light Toggle Night"
  trigger:
  - platform: state
    entity_id: sensor.xiaomi_kitchen_light_switch_action
  condition:
    - condition: template
      value_template: >
        {{ trigger.to_state.state == 'double'}}
  action:
  - service: light.toggle
    data:
      entity_id: light.galaxy_ai_plus_sink
      brightness: 13
      hs_color:
        - 216
        - 24
  mode: single

https://www.zigbee2mqtt.io/devices/WXKG11LM.html#xiaomi-wxkg11lm

I got this to work, thanks all, my next question is, and I could not ifnd, how can I make this event an entity that I can reuse?

I know it’s been a while since people sorted this one out, but I have a couple of these moes buttons and I can’t get them to work. I’m using a zigbee2mqtt and it pairs fine, I can see the device in HA and it only shows a batter state change, but I can’t see the click events when I listen to all events.
Not sure what is happening here, and if there is something else I need to change, but I guess without seeing an event I’m not going to be able to get it working?

thanks

So simple when you know the answer - thanks