zha-toolkit
zha-toolkit copied to clipboard
Fixes for HA 2024.9
The PR adds fixes to get this custom component working with Home Assistant 2024.9 (tested with 2024.91. and 2024.9.2) Specifically it fixes issues #258 and #261 and bumps the required version.
Also tested these by swapping out the files and restarting zha-toolkit and it works again now.
All seems to be ok with this patch. Works fine on HA 2024.9.2. Thanks a lot.
Hey @mdeweerd, can you find some time to review this? From the reactions it looks like there are a few people waiting on these fixes.
Have just tested these files and working for me on 2024.10.0
Can this please be merged ASAP?
Tested and working for 2024.10.2
@mdeweerd hello can you please merge this? There’s a lot of people awaiting this PR.
Has anyone found another solution ?
I forked this repo and applied the fixes for myself, this works for my own use until this issue is fixed upstream. Anyone else is welcome to use my fork at https://github.com/EiNSTeiN-/zha-toolkit but be aware I'm not going to keep up with upstream so you may be missing new versions until this is resolved.
To use the fork, go to HACS and uninstall zha-toolkit, then add a custom repository and put in https://github.com/EiNSTeiN-/zha-toolkit as URL, then install the new zha-toolkit which will appear in the list. My version will have (fork) at the end of the name.
Thanks it's work for me with the fork. 👍🏻
I had the same error initially and then installed the fork from @EiNSTeiN- However, even with that the Scan Device action always fails but this time with a different error. Anyone has an idea? And @michalmo would your PR also fix that, or you think it is not related?
[140735235457232] Error handling message: Unknown error (unknown_error) Joshua from 192.168.178.57 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36)
[140733472884480] Error handling message: Unknown error (unknown_error) Joshua from 192.168.178.57 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 816, in handle_execute_script
script_result = await script_obj.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1795, in async_run
return await asyncio.shield(create_eager_task(run.async_run()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 463, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 527, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 557, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 525, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/zha_toolkit/__init__.py", line 832, in toolkit_service
raise handler_exception
File "/config/custom_components/zha_toolkit/__init__.py", line 784, in toolkit_service
handler_result = await handler(
^^^^^^^^^^^^^^
File "/config/custom_components/zha_toolkit/__init__.py", line 898, in command_handler_default
return await default.default(
^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/zha_toolkit/default.py", line 51, in default
await handler(app, listener, ieee, cmd, data, service, params, event_data)
File "/config/custom_components/zha_toolkit/scan_device.py", line 462, in scan_device
scan = await scan_results(
^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/zha_toolkit/scan_device.py", line 83, in scan_results
await scan_endpoint(ep, manufacturer, tries=tries)
File "/config/custom_components/zha_toolkit/scan_device.py", line 112, in scan_endpoint
clusters[key] = await scan_cluster(
^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/zha_toolkit/scan_device.py", line 139, in scan_cluster
attributes = await discover_attributes_extended(cluster, None, tries=tries)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/zha_toolkit/scan_device.py", line 236, in discover_attributes_extended
attr_type.type_class.__name__,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DataClass' object has no attribute '__name__'. Did you mean: '__hash__'?
@joshua-lehmann looks like a bug introduced by my PR (an incorrect application of what I was fixing), I'll update the PR later when I have a moment, and ask you to test it.
Look like a fix is to replace line 236 in scan_device.py
attr_type.type_class.__name__,
by
attr_type.type_class.name,
It work for me
Just checked and i've come to the conclusion that @claudegel's fix is correct. I've updated the PR. @EiNSTeiN- you may want to update your fork for the people that have installed it.
@claudegel I used your suggested change, and it fixed the error, thank you! @michalmo I can confirm that the fix he did worked and solved the issue so your fix should work as well. What is the ETA of merging this into the official repo? I saw its open for a longer time already.
I don't know 🤷. @mdeweerd has been unresponsive for a while.
@mdeweerd Could you approve this and push it into a release? Thank you!
This also fixed my issues, hoping for an official review/release soon...