HASS.Agent-Integration icon indicating copy to clipboard operation
HASS.Agent-Integration copied to clipboard

RuntimeError: hass_agent calls device_registry.async_update_device from a thread other than the event loop

Open baznab opened this issue 3 months ago • 4 comments

Description (English):

I get the following error multiple times in my Home Assistant logs (33 occurrences in my case). It seems related to thread safety in the device registry update.

Environment:

  • Home Assistant : 2025.8.3
  • HASS.Agent Integration: 2022.11.9
  • HASS.Agent for Windows: 2022.14.0
  • Host OS: Home Assistant OS (Raspberry Pi 5)

Error log:

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(

Steps to reproduce:

  • Start HA with HASS.Agent integration enabled.
  • Wait for startup.
  • Error appears repeatedly in logs.

Expected behavior:

The integration should update the device registry without triggering async/thread safety errors.

Résumé en français :

Lorsque j’utilise l’intégration HASS.Agent, j’ai une erreur répétée dans les journaux de Home Assistant (33 occurrences lors du dernier démarrage). Le message indique que l’intégration appelle device_registry.async_update_device depuis un thread non compatible avec la boucle événementielle, ce qui pourrait théoriquement causer un crash ou une corruption de données.

Mon environnement :

  • Home Assistant Core : 2025.8.3
  • Intégration HASS.Agent : 2022.11.9
  • Application Windows HASS.Agent : 2022.14.0
  • OS : Home Assistant OS (Raspberry Pi 5)

Thanks a lot for your work on this integration! HASS.Agent is really useful to control and monitor Windows PCs from Home Assistant.

baznab avatar Sep 03 '25 12:09 baznab