device_registryasync_update_device

I couldn't find any reports of this in the channel - sorry if it has been reported before. HA keeps reporting the following in logs: Exception in updated when handling msg on 'hass.agent/devices/xxx': '{"serial_number":"xxx","device":{"identifiers":"hass.agent-xxx","manufacturer":"HASS.Agent Team","model":"Microsoft Windows NT 10.0.19045.0","name":"xxx","sw_version":"2.0.1"},"apis":{"notifications":true,"media_player":true}}' Traceback (most recent call last): File "/config/custom_components/hass_agent/init.py", line 144, in updated update_device_info(hass, entry, payload) File "/config/custom_components/hass_agent/init.py", line 29, in update_device_info device_registry.async_get_or_create( File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 834, in async_get_or_create device = self.async_update_device( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 1066, in async_update_device self.hass.verify_event_loop_thread("device_registry.async_update_device") File "/usr/src/homeassistant/homeassistant/core.py", line 462, 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 'hass_agent' calls device_registry.async_update_device 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/#device_registryasync_update_device at custom_components/hass_agent/init.py, line 29: device_registry.async_get_or_create
Thread safety with asyncio | Home Assistant Developer Docs
Developing with asyncio requires careful attention to thread safety, as nearly all asyncio objects are not thread-safe. If you are just getting started with asyncio, review Python's documentation on Developing with asyncio for tips to avoid pitfalls.
Solution:
It was this version that was producing the errors. I switched to the forked version as suggested here: https://github.com/LAB02-Research/HASS.Agent/issues/411...
GitHub
Bug: Detected that custom integration 'hass_agent' calls async_crea...
Hi! In the logs I have a lot of errors like this: 2024-05-05 19:20:47.751 ERROR (SyncWorker_18) [homeassistant.util.logging] Exception in updated when handling msg on 'hass.agent/devices/DELL-X...
No description
Jump to solution
5 Replies
DrR0x
DrR0x2mo ago
Scrshot of integration name in hacs please
Solution
PepsiMax
PepsiMax2mo ago
It was this version that was producing the errors. I switched to the forked version as suggested here: https://github.com/LAB02-Research/HASS.Agent/issues/411 and the errors stopped.
GitHub
Bug: Detected that custom integration 'hass_agent' calls async_crea...
Hi! In the logs I have a lot of errors like this: 2024-05-05 19:20:47.751 ERROR (SyncWorker_18) [homeassistant.util.logging] Exception in updated when handling msg on 'hass.agent/devices/DELL-X...
No description
DrR0x
DrR0x2mo ago
Yep, assumed so, everything working properly now?
PepsiMax
PepsiMaxOP2mo ago
Indeed, but is this integration supposed to replace the previous one - that wasn't my impression?
DrR0x
DrR0x2mo ago
Yes, the original workflow was separate integrations for each part(notifications, tts, etc.). Then they culminated into 1. Recently along with our client/app and docs fork we also forked the integration So our integration is an upgrade, ie, replacement of the previous ond Same with docs and client
Want results from more Discord servers?
Add your server