Core: ZHA light entities not loading

Created on 16 Mar 2020  路  13Comments  路  Source: home-assistant/core

The problem


ZHA does not initialize any light entities upon start with 0.107.b3 and 107.b4 - Reverting back to 106.6 works fine. Sensor and other domains in ZHA seem to work without issue.

NWK 0x5b75 is a Ecosmart lightblub.

Environment

  • Home Assistant release with the issue: 0.107.0b3
  • Last working Home Assistant release (if known): 0.106.6
  • Operating environment (Hass.io/Docker/Windows/etc.): Docker
  • Integration causing this issue: zha
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/zha/

Problem-relevant configuration.yaml

zha:
  usb_path: /dev/ttyUSB1
  database_path: /config/zigbee.db

Traceback/Error logs

2020-03-15 17:13:23 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x5b75:1:0x0008]: received attribute: 0 update with value: 254
2020-03-15 17:13:23 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x5b75:1:0x1000]: initializing channel: from_cache: False
2020-03-15 17:13:23 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x5b75:1:0x0000]: initializing channel: from_cache: False
File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 165, in async_load_devices
    *[_throttle(dev) for dev in zigpy_devices if dev.node_desc.is_mains_powered]
  File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 150, in _throttle
  File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 475, in async_device_restored
    zha_device = self._async_get_or_create_device(device, restored=True)
  File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 381, in _async_get_or_create_device
    zha_device = ZHADevice.new(self._hass, zigpy_device, self, restored)
  File "/usr/src/homeassistant/homeassistant/components/zha/core/device.py", line 278, in new
    zha_dev.channels = channels.Channels.new(zha_dev)
  File "/usr/src/homeassistant/homeassistant/components/zha/core/channels/__init__.py", line 100, in new
  File "/usr/src/homeassistant/homeassistant/components/zha/core/channels/__init__.py", line 107, in add_pool
  File "/usr/src/homeassistant/homeassistant/components/zha/core/channels/__init__.py", line 238, in new
  File "/usr/src/homeassistant/homeassistant/components/zha/core/channels/__init__.py", line 258, in add_all_channels
  File "/usr/src/homeassistant/homeassistant/components/zha/core/channels/base.py", line 88, in __init__
  File "/usr/local/lib/python3.7/site-packages/zigpy/zcl/__init__.py", line 410, in __getattr__

Additional information

Full log from zha is here:
https://paste.ubuntu.com/p/PNwM8QSDJn/

Light bulb in question:
Screen Shot 2020-03-15 at March 15, 2020 - 8 27 06 PM

zha

All 13 comments

Log file with modified channels/__init__.py modified on line 258:

            try:         
              channel = channel_class(cluster, self)
            except:      
              _LOGGER.debug("Channel class: %s, class name: %s cluster: %s", channel_class, channel_class.__name__, cluster)

Log:
https://paste.ubuntu.com/p/ZwrW2hSVzr/

Relevant section (only hit):
2020-03-15 20:25:51 DEBUG (MainThread) [homeassistant.components.zha.core.channels] Channel class: <class 'homeassistant.components.zha.core.channels.general.BinaryValue'>, class name: BinaryValue cluster: <zhaquirks.xbee.XBeeCommon.SerialDataCluster object at 0x7f8352ad42d0>

Wait, How does Ecosmart Bulb gets a zhaquirks.xbee.XBeeCommon.SerialDataCluster ???
Do you have any XBee devices joined to your netowkork?

@dmulcahey but as we discussed, SerialDataCluster should have ep_attribute. We need to figure out a way to enforce it for all CustomCluster's

I do have a xbee: (offline currently)

https://paste.ubuntu.com/p/MNyGzgTk5n/

Hey there @dmulcahey, mind taking a look at this issue as its been labeled with a integration (zha) you are listed as a codeowner for? Thanks!

Wait, How does Ecosmart Bulb gets a zhaquirks.xbee.XBeeCommon.SerialDataCluster ???
Do you have any XBee devices joined to your netowkork?

it isn't... logging was misleading at first

@dmulcahey but as we discussed, SerialDataCluster should have ep_attribute. We need to figure out a way to enforce it for all CustomCluster's

this is interesting.. it isn't a zigpy or quirks requirement... just HA because of what was changed in the channels. not sure what the best approach is tbh.

It's an indirect zigpy requirement. Clusters should have ep_attribute so you could getattr them via endpoint, eg on_off_cluster = zigpy_device.endpoints[1].on_off

Zigpy requirement for standard clusters https://github.com/zigpy/zigpy/blob/69b39e770e1275939856319009982fbc8ebe8794/tests/test_zcl_clusters.py#L54
I say we keep ep_attribute for custom clusters. Alternatively we could fallback to cluster class name, but I'd rather not go that way

Zigpy requirement for standard clusters https://github.com/zigpy/zigpy/blob/69b39e770e1275939856319009982fbc8ebe8794/tests/test_zcl_clusters.py#L54
I say we keep ep_attribute for custom clusters. Alternatively we could fallback to cluster class name, but I'd rather not go that way

I'm not suggesting that we don't define it... just not sure the best way to test for it.

gotcha. Currently no easy way to test for it. Would require changes on zigpy side. Something similar to ZCL cluster registry.

@walthowd thx for the help debugging and fixing this issue!

@walthowd and thanks for running beta.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sibbl picture sibbl  路  3Comments

sogeniusio picture sogeniusio  路  3Comments

Konstigt picture Konstigt  路  3Comments

neonandu picture neonandu  路  3Comments

piitaya picture piitaya  路  3Comments