Sonoff Button Quirk

I have this problem as well. Devices bought last year work flawlessly and 2 new ones which I received last week don’t work out-of-a-box. I agree this is because of these devices signatures differ in output_clusters:

The old one (working):

{
  "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=0, maximum_buffer_size=80, maximum_incoming_transfer_size=160, server_mask=0, maximum_outgoing_transfer_size=160, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)",
  "endpoints": {
    "1": {
      "profile_id": "0x0104",
      "device_type": "0x0000",
      "input_clusters": [
        "0x0000",
        "0x0001",
        "0x0003"
      ],
      "output_clusters": [
        "0x0003",
        "0x0006"
      ]
    }
  },
  "manufacturer": "eWeLink",
  "model": "WB01",
  "class": "zhaquirks.sonoff.button.SonoffButton"
}

The new one (not working):

{
  "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=0, maximum_buffer_size=80, maximum_incoming_transfer_size=160, server_mask=0, maximum_outgoing_transfer_size=160, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)",
  "endpoints": {
    "1": {
      "profile_id": "0x0104",
      "device_type": "0x0000",
      "input_clusters": [
        "0x0000",
        "0x0001",
        "0x0003"
      ],
      "output_clusters": [
        "0x0006"
      ]
    }
  },
  "manufacturer": "eWeLink",
  "model": "WB01",
  "class": "zigpy.device.Device"
}

Quirk for these buttons requires 2 values in output_clusters: zha-device-handlers/zhaquirks/sonoff/snzb06p.py at 9ccb69ad64da9bcbaae28201cc9efa6589565300 · zigpy/zha-device-handlers · GitHub

I’m not sure what Sonoff can do for owners of “faulty” units. If I had to e.g. flash a new firmware, I’d probably break the device, because of how its built.

Meanwhile, as a workaround, it’s possible to use the “old-fashioned” way of working with these devices, via zha_event events. They map:

  • toggle: single click
  • on: double click
  • off: hold button

I’m using this blueprint to avoid writing a custom yaml: ZHA - Sonoff SNZB-01