Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
w1Ngx opened this issue Jun 2, 2024 · 10 comments

Comments

@w1Ngx
Copy link

w1Ngx commented Jun 2, 2024

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
Copy link

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
Copy link

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

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
Copy link

Is this project abandoned?

@Lash-L
Copy link
Collaborator

Lash-L commented Jun 27, 2024

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
Copy link
Author

w1Ngx commented Jun 27, 2024

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

@Lash-L
Copy link
Collaborator

Lash-L commented Jun 28, 2024

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

@kuchar91
Copy link

Have you already include your calibration points in core integration?

@mindgam3s
Copy link

mindgam3s commented Oct 8, 2024

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.

@j0sp0r
Copy link

j0sp0r commented Dec 10, 2024

I can also confirm, I still have this issue. Always when my Robo is offline or not reachable, HA crashes after some time when the plugin is on and active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants