humbertogontijo / homeassistant-roborock

Roborock integration for Home Assistant. This integration uses your devices from the Roborock App
GNU General Public License v3.0
664 stars 69 forks source link

[Roborock S8 Pro Ultra] Detected that custom integration 'roborock' calls async_write_ha_state #641

Open w1Ngx opened 5 months ago

w1Ngx commented 5 months ago

Hi,

I am getting the following error in the log. Version 1.0.13 used

Logger: roborock.cloud_api Source: /usr/local/lib/python3.12/site-packages/roborock/api.py:326 First occurred: 12:39:48 PM (4 occurrences) Last logged: 1:06:36 PM

[Roborock S8 Pro Ultra] Detected that custom integration 'roborock' calls async_write_ha_state from a thread at custom_components/roborock/device.py, line 129: self.async_write_ha_state(). Please report it to the author of the 'roborock' custom integration. Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/roborock/api.py", line 283, in on_message_received listener(status) File "/config/custom_components/roborock/device.py", line 129, in _update_from_listener self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1008, in async_write_ha_state self.hass.verify_event_loop_thread("async_write_ha_state") File "/usr/src/homeassistant/homeassistant/core.py", line 440, in verify_event_loop_thread frame.report( File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 162, in report _report_integration(what, integration_frame, level, error_if_integration) File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 203, in _report_integration raise RuntimeError( RuntimeError: Detected that custom integration 'roborock' calls async_write_ha_state from a thread at custom_components/roborock/device.py, line 129: self.async_write_ha_state(). Please report it to the author of the 'roborock' custom integration.

thomaspalmdk commented 5 months ago

This is typically the last thing I see in my home assistant logs right before a crash. Guess the message is true, at least for me: RuntimeError: Detected that custom integration 'roborock' 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 at custom_components/roborock/device.py, line 129: self.async_write_ha_state(). Please report it to the author of the 'roborock' custom integration.

liamlain commented 5 months ago

same after updated core 2024.6.2


Source: /usr/local/lib/python3.12/site-packages/roborock/api.py:326
First occurred: 12:27:33 AM (1 occurrences)
Last logged: 12:27:33 AM

[Roborock S8 MaxV Ultra] Detected that custom integration 'roborock' 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 at custom_components/roborock/device.py, line 129: self.async_write_ha_state(). Please report it to the author of the 'roborock' custom integration.
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/roborock/api.py", line 283, in on_message_received
    listener(status)
  File "/config/custom_components/roborock/device.py", line 129, in _update_from_listener
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 999, in async_write_ha_state
    self.hass.verify_event_loop_thread("async_write_ha_state")
  File "/usr/src/homeassistant/homeassistant/core.py", line 447, in verify_event_loop_thread
    frame.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 'roborock' 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 at custom_components/roborock/device.py, line 129: self.async_write_ha_state(). Please report it to the author of the 'roborock' custom integration.```
SlightlyGrumpyArchitect commented 5 months ago

I am seeing this on 2024.6.3 as well:

2024-06-17 19:47:45.678 WARNING (Thread-3 (_thread_main)) [homeassistant.helpers.frame] Detected that custom integration 'roborock' 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 at custom_components/roborock/device.py, line 129: self.async_write_ha_state(), please report it to the author of the 'roborock' custom integration
2024-06-17 19:47:45.679 ERROR (Thread-3 (_thread_main)) [roborock.cloud_api] [Roborock S5 Max] Detected that custom integration 'roborock' 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 at custom_components/roborock/device.py, line 129: self.async_write_ha_state(). Please report it to the author of the 'roborock' custom integration.
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/roborock/api.py", line 283, in on_message_received
listener(status)
File "/config/custom_components/roborock/device.py", line 129, in _update_from_listener
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 999, in async_write_ha_state
self.hass.verify_event_loop_thread("async_write_ha_state")
File "/usr/src/homeassistant/homeassistant/core.py", line 447, in verify_event_loop_thread
frame.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 'roborock' 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 at custom_components/roborock/device.py, line 129: self.async_write_ha_state(). Please report it to the author of the 'roborock' custom integration.

Let me know if you require extra information/logs

kuchar91 commented 4 months ago

Is this project abandoned?

Lash-L commented 4 months ago

There is a note in the readme, it's recommended you use the core integration. PRs are accepted but all of my time goes towards adding more features and bug fixes for the core integration, not the custom

w1Ngx commented 4 months ago

What is the easiest way to migrate from this one to core?

Lash-L commented 4 months ago

Uninstall it from hacs, restart and then you can just install it like a normal integration

kuchar91 commented 4 months ago

Have you already include your calibration points in core integration?

mindgam3s commented 1 month ago

I can confirm this happens for me as well

2024-10-08 14:00:41.685 ERROR (Thread-2 (_thread_main)) [roborock.cloud_api] [Mr. Kaplan] Detected that custom integration 'roborock' 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 at custom_components/roborock/device.py, line 129: self.async_write_ha_state(). Please report it to the author of the 'roborock' custom integration.
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/roborock/api.py", line 283, in on_message_received
    listener(status)
  File "/config/custom_components/roborock/device.py", line 129, in _update_from_listener
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in async_write_ha_state
    report_non_thread_safe_operation("async_write_ha_state")
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 229, in report_non_thread_safe_operation
    report(
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 163, in report
    _report_integration(what, integration_frame, level, error_if_integration)
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 201, in _report_integration
    raise RuntimeError(
RuntimeError: Detected that custom integration 'roborock' 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 at custom_components/roborock/device.py, line 129: self.async_write_ha_state(). Please report it to the author of the 'roborock' custom integration.