AlexxIT / XiaomiGateway3

Home Assistant custom component for control Xiaomi Multimode Gateway (aka Gateway 3), Xiaomi Multimode Gateway 2, Aqara Hub E1 on default firmwares over LAN
https://github.com/AlexxIT/Blog
MIT License
2.42k stars 339 forks source link

Unexpected error 'ZCLAttributeDef' object is not subscriptable #1031

Closed OKchesterOK closed 1 year ago

OKchesterOK commented 1 year ago

I get this error about 30 times a day.

Logger: homeassistant
Source: custom_components/xiaomi_gateway3/core/converters/silabs.py:251
Integration: Xiaomi Gateway 3 (documentation, issues)
First occurred: 22:04:56 (1 occurrences)
Last logged: 22:04:56

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/xiaomi_gateway3/core/entity.py", line 301, in update_state
    await self.async_update()
  File "/config/custom_components/xiaomi_gateway3/switch.py", line 47, in async_update
    await self.device_read(self.subscribed_attrs)
  File "/config/custom_components/xiaomi_gateway3/core/entity.py", line 273, in device_read
    payload = self.device.encode_read(attrs)
  File "/config/custom_components/xiaomi_gateway3/core/device.py", line 415, in encode_read
    conv.read(self, payload)
  File "/config/custom_components/xiaomi_gateway3/core/converters/zigbee.py", line 62, in read
    cmd = zcl_read(device.nwk, self.ep, self.zigbee, self.zattr)
  File "/config/custom_components/xiaomi_gateway3/core/converters/silabs.py", line 303, in zcl_read
    attrs = [get_attr(cluster.attributes, attr) for attr in attrs]
  File "/config/custom_components/xiaomi_gateway3/core/converters/silabs.py", line 303, in <listcomp>
    attrs = [get_attr(cluster.attributes, attr) for attr in attrs]
  File "/config/custom_components/xiaomi_gateway3/core/converters/silabs.py", line 251, in get_attr
    return next(k for k, v in attributes.items() if v[0] == attr)
  File "/config/custom_components/xiaomi_gateway3/core/converters/silabs.py", line 251, in <genexpr>
    return next(k for k, v in attributes.items() if v[0] == attr)
TypeError: 'ZCLAttributeDef' object is not subscriptable
AlexxIT commented 1 year ago

Known bug. Fixed in latest master version

AlexxIT commented 1 year ago

https://github.com/AlexxIT/XiaomiGateway3/releases/tag/v3.3.0