calling hass.services.async_register from a thread other than the event loop, may cause crash or data corruption
Detected that custom integration 'zha_toolkit' calls hass.services.async_register from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#hassservicesasync_register at custom_components/zha_toolkit/init.py, line 853: hass.services.async_register(, please report it to the author of the 'zha_toolkit' custom integration
Same for me:
Logger: homeassistant.setup Source: setup.py:404 First occurred: 9:39:51 AM (1 occurrences) Last logged: 9:39:51 AM
Error during setup of component zha_toolkit Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 404, in _async_setup_component result = await task ^^^^^^^^^^ File "/config/custom_components/zha_toolkit/init.py", line 660, in async_setup await hass.async_add_executor_job(register_services, hass) File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/zha_toolkit/init.py", line 853, in register_services hass.services.async_register( File "/usr/src/homeassistant/homeassistant/core.py", line 2515, in async_register self._hass.verify_event_loop_thread("hass.services.async_register") File "/usr/src/homeassistant/homeassistant/core.py", line 463, in verify_event_loop_thread frame.report_non_thread_safe_operation(what) File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 225, in report_non_thread_safe_operation report( File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 159, in report _report_integration(what, integration_frame, level, error_if_integration) File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 197, in _report_integration raise RuntimeError( RuntimeError: Detected that custom integration 'zha_toolkit' calls hass.services.async_register from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#hassservicesasync_register at custom_components/zha_toolkit/init.py, line 853: hass.services.async_register(. Please report it to the author of the 'zha_toolkit' custom integration.
Same Here
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 404, in _async_setup_component result = await task ^^^^^^^^^^ File "/config/custom_components/zha_toolkit/init.py", line 660, in async_setup await hass.async_add_executor_job(register_services, hass) File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/zha_toolkit/init.py", line 853, in register_services hass.services.async_register( File "/usr/src/homeassistant/homeassistant/core.py", line 2515, in async_register self._hass.verify_event_loop_thread("hass.services.async_register") File "/usr/src/homeassistant/homeassistant/core.py", line 463, in verify_event_loop_thread frame.report_non_thread_safe_operation(what) File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 225, in report_non_thread_safe_operation report( File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 159, in report _report_integration(what, integration_frame, level, error_if_integration) File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 197, in _report_integration raise RuntimeError( RuntimeError: Detected that custom
I have the same error. Are you all on the 2024.8 beta for HA Core? I wonder whether it is related to that and HA's apparent efforts to stamp out programming practices that weaken HA (my understanding from the errors, change logs, etc).
Edit: Not saying zha_toolkit was programmed poorly, but rather that HA is strengthening how things are done, thus requiring changes in integrations such as zha_toolkit.
No I'm on 2024.7.4
I have the same error. Are you all on the 2024.8 beta for HA Core? I wonder whether it is related to that and HA's apparent efforts to stamp out programming practices that weaken HA (my understanding from the errors, change logs, etc).
Edit: Not saying zha_toolkit was programmed poorly, but rather that HA is strengthening how things are done, thus requiring changes in integrations such as zha_toolkit.
No, i am on Core 2024.7.4
Also same error. Running 2024.7.4.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 404, in _async_setup_component
result = await task
^^^^^^^^^^
File "/config/custom_components/zha_toolkit/__init__.py", line 660, in async_setup
await hass.async_add_executor_job(register_services, hass)
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/zha_toolkit/__init__.py", line 853, in register_services
hass.services.async_register(
File "/usr/src/homeassistant/homeassistant/core.py", line 2515, in async_register
self._hass.verify_event_loop_thread("hass.services.async_register")
File "/usr/src/homeassistant/homeassistant/core.py", line 463, in verify_event_loop_thread
frame.report_non_thread_safe_operation(what)
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 225, in report_non_thread_safe_operation
report(
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 159, in report
_report_integration(what, integration_frame, level, error_if_integration)
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 197, in _report_integration
raise RuntimeError(
RuntimeError: Detected that custom integration 'zha_toolkit' calls hass.services.async_register from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#hassservicesasync_register at custom_components/zha_toolkit/__init__.py, line 853: hass.services.async_register(. Please report it to the author of the 'zha_toolkit' custom integration.
Same but on 2024.8
Solved with 1.1.16
I've refactored some code - hopefully that's fine by the HomeAssistant team's rules. It start fine for me on 2024.07.4 v1.1.15 is released
The update fixed the previous error, but now I have this in the logs:
Logger: homeassistant.setup Source: setup.py:271 First occurred: 23:45:47 (1 occurrences) Last logged: 23:45:47
Setup failed for custom integration 'zha_toolkit': Requirements for zha_toolkit not found: ['pytz>=>2016.10'].
I'm on Core 2024.7.4
v1.1.16 is the latest version I saw and installed. The issue seems to have been fixed. I am running 2024.8 HA Core.
The update fixed the previous error, but now I have this in the logs: Logger: homeassistant.setup Source: setup.py:271 First occurred: 23:45:47 (1 occurrences) Last logged: 23:45:47 Setup failed for custom integration 'zha_toolkit': Requirements for zha_toolkit not found: ['pytz>=>2016.10']. I'm on Core 2024.7.4
1.1.16 have fixed the pytz error.
Thanks