Since 2023.7 (I believe), I have two custom quirks throwing this error:
‘ZCLAttributeDef’ object is not subscriptable
The full error is:
File "/config/custom_zha_quirks/ts0601_trv_beca.py", line 716, in command
(res,) = await self.write_attributes(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_zha_quirks/ts0601_trv_beca.py", line 669, in write_attributes
attr_name = self.attributes[record.attrid][0]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
TypeError: 'ZCLAttributeDef' object is not subscriptable
Both the affected quirks are very similar and have identical code blocks in the affected areas. Does anyone have any thoughts on what might of caused this ? is it a bug in the release, or an intended change that will need the quirks modifying ? (And if the latter, does anyone have any clues as to where to start).
having read up on the error, I kinda understand what the issue is, and have modified the quirk so that every instance of
self.attributes[record.attrid][0]
Has been changed to
self.attributes[record.attrid]
This has removed the errors from being thrown in the logs, but changing any of the settings for the device no longer work. Switches for instance, just return to their previous state (after a couple of seconds) if I click them.
thank you for your solution.
Somehow it is not working for me.
I have only one occurrence of “self.attributes[record.attrid][0]” in my custom quirks file.
I changed that line to “self.attributes[record.attrid].name” and the error message is gone, but the switch is falling back to off state after a couple of seconds.
Maybe I got you wrong.
Is there more to do?