mdeweerd / zha-toolkit

🧰 Zigbee Home Assistant Toolkit - service for "rare" Zigbee operations using ZHA on Home Assistant
GNU General Public License v3.0
171 stars 17 forks source link

ZHAData is not subscriptable after upgrade to 2023.10.0 #205

Closed fuzzysteve closed 9 months ago

fuzzysteve commented 9 months ago

Updated to Home Assistant 2023.10.0

using ZHA-Toolkit 1.0.0

When using attr_read in an automation, the automation is failing with 'ZHAData' object is not subscriptable

It's a VINDSTYRKA air quality sensor, pulling the tvoc sensor. was working on 2023.9.0 endpoint: 1 cluster: 1066 attribute: 0

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 655, in async_trigger
    await self.action_script.async_run(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1578, in async_run
    return await asyncio.shield(run.async_run())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 420, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 470, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 493, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2012, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2049, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/zha_toolkit/__init__.py", line 672, in toolkit_service
    zha_gw = hass_ref.data["zha"]["zha_gateway"]
             ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
TypeError: 'ZHAData' object is not subscriptable
MattWestb commented 9 months ago

Yep the same here on my production system and one RCP test system (Armbian 32) but 2 RCP test system (Armbian 32 and 64) is loading it OK that i think its little strange.

luke7101 commented 9 months ago

Same here with a Lixee zlinky

bendikrb commented 9 months ago

https://github.com/home-assistant/core/pull/100127

mdeweerd commented 9 months ago

I have some other urgencies to handle, I commented on one of the PRs.

lamastikoh commented 9 months ago

Same for me with the Zlinky, rolled back to the previous version, it works again. Inm waiting for a fix or an other solution to re-update.

mdeweerd commented 9 months ago

I've made a pre-release which is installable using HACS by enabling Beta versions.

You'll have to restart HA after the update.

When confirmed for 2023.10.X, I'll make this a normal release.

mdeweerd commented 9 months ago

There were some issues releasing the file correctly - v1.1.2 is the latest (beta)

luke7101 commented 9 months ago

Installed v1.1.2 and now working again for me with ZLinky and 2023.10.0 👍 Thanks

mdeweerd commented 9 months ago

Thank you for confirming. I changed the status from beta to release.