hon
hon copied to clipboard
RuntimeError on HA 2025.4.2
Describe the bug Detected code that calls async_write_ha_state from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt.
Screenshots
Environment (please complete the following information):
- Home Assistant Version (Core): 2025.4.2
- hOn Integration Version: 0.14.0
Home Assistant Logs
Exception ignored in: <class 'RuntimeError'>
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/awscrt/mqtt5.py", line 1471, in _on_publish
self._on_publish_cb(PublishReceivedData(publish_packet=publish_packet))
File "/usr/local/lib/python3.13/site-packages/pyhon/connection/mqtt.py", line 105, in _on_publish_received
self._hon.notify()
File "/usr/local/lib/python3.13/site-packages/pyhon/hon.py", line 130, in notify
self._notify_function(None)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 515, in async_set_updated_data
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 178, in async_update_listeners
update_callback()
File "/config/custom_components/hon/sensor.py", line 849, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1022, in async_write_ha_state
report_non_thread_safe_operation("async_write_ha_state")
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 402, in report_non_thread_safe_operation
report_usage(
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 202, in report_usage
future.result()
File "/usr/local/lib/python3.13/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
File "/usr/local/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/src/homeassistant/homeassistant/util/async_.py", line 68, in run_callback
future.set_result(callback(*args))
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 243, in _report_usage
_report_usage_no_integration(what, core_behavior, breaks_in_ha_version, err)
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 373, in _report_usage_no_integration
raise RuntimeError(msg) from err
RuntimeError: Detected code that calls async_write_ha_state 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/#async_write_ha_state](https://developers.home-assistant.io/docs/asyncio_thread_safety/#async_write_ha_state) . Please report this issue
Same problem. Can't receive device status updates :(