zigpy / zha-device-handlers

ZHA device handlers bridge the functionality gap created when manufacturers deviate from the ZCL specification, handling deviations and exceptions by parsing custom messages to and from Zigbee devices.
Apache License 2.0
751 stars 688 forks source link

[BUG] Sonoff ZBMINI classified as light instead of switch #654

Closed malfroid closed 3 years ago

malfroid commented 3 years ago

Describe the bug After adding Sonoff ZBMINI = 01MINIZB to ZHA, the entity is classified as a light. This device is not a light, but a switch. It does not seem possible to change the domain of an entity from light to switch. See also my post on the HA forum.

To Reproduce Steps to reproduce the behavior:

  1. Add Sonoff ZBMINI to Home Assistant via ZHA integration
  2. Look at entity ID: shows light.

Expected behavior Entity should be have the domain switch, ID should show switch.

Screenshots

Screenshot 2020-12-20 at 17 39 35

Additional context Running Home Assistant 2020.12.1 + ZHA on Raspberry Pi 4 with Conbee II zigbee gateway.

Sonoff ZBMINI device signature:

{
  "node_descriptor": "NodeDescriptor(byte1=1, byte2=64, mac_capability_flags=142, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=0)",
  "endpoints": {
    "1": {
      "profile_id": 260,
      "device_type": "0x0100",
      "in_clusters": [
        "0x0000",
        "0x0003",
        "0x0004",
        "0x0005",
        "0x0006",
        "0x1000"
      ],
      "out_clusters": [
        "0x1000"
      ]
    },
    "242": {
      "profile_id": 41440,
      "device_type": "0x0061",
      "in_clusters": [],
      "out_clusters": [
        "0x0021"
      ]
    }
  },
  "manufacturer": "SONOFF",
  "model": "01MINIZB",
  "class": "zigpy.device.Device"
}
dmulcahey commented 3 years ago

This can be overridden in configuration.yaml in zha leveraging device config. There are examples on the forum. I don’t have any off hand.

Adminiuga commented 3 years ago

the device_type = 0x0100 and per Zigbee Home Automation Profile, the device with type id 0x0100 is an on/off Light. image

to override, add to configuration.yaml

zha:
  device_config:
    00:0b:57:ff:de:ad:be:ef-1:
       type: 'switch'
dmulcahey commented 3 years ago

Closing as work around supplied and the device is being treated correctly by ZHA.

malfroid commented 3 years ago

I looked up the ZBMINI hardware address in the UI:

Screenshot 2020-12-22 at 12 18 51

I then added the proposed configuration by @Adminiuga to my configuration.yaml. Full configuration.yaml:

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

zha:
  zigpy_config:
    ota:
      ikea_provider: true         # Auto update Trådfri devices
      ledvance_provider: true     # Auto update LEDVANCE devices
  device_config:
    84:71:27:ff:fe:93:17:24:      # Reclassify ZBMINI (kitchen ceiling light) as switch instead of light
      type: 'switch'
    84:71:27:ff:fe:93:10:ce:      # Reclassify ZBMINI (kitchen fan) as switch instead of light
      type: 'switch'

After saving configuration.yaml and restarting HA, the entity is still a light:

Screenshot 2020-12-22 at 12 21 06

I tried clicking the button "Reconfigure device" in the UI, but that didn't help. Any suggestions?

dmulcahey commented 3 years ago

You need {ieee}-{endpoint_id} not just ieee. Add -1 to both ieee addresses before the :

Adminiuga commented 3 years ago
00:0b:57:ff:de:ad:be:ef-1:
                       ^^^ your Endpoint ID
malfroid commented 3 years ago

Thanks, by adding the endpoint it works as expected!

As I did not find anything related to this in the ZHA documentation, I made a suggestion to improve the documentation in https://github.com/home-assistant/home-assistant.io/pull/15989

ilovesmart commented 4 months ago

Hi all. I followed the instructions for this the other day and it worked 100%. But for some strange reason the switch it created is now greyed out and when you click into it this is the message. This entity is no longer being provided by the zha integration. If the entity is no longer in use, delete it in settings.

The light entity that was the original entity is re-enabled and working but its a light not a switch so it turns of when I say turn off lights .

Not sure how to reverse this back to a switch. Anyone have this issue ?