homeassistant-roborock icon indicating copy to clipboard operation
homeassistant-roborock copied to clipboard

HA very slow after internet breakdown , duo homeassistant-roborock integration

Open Androo123nl opened this issue 1 year ago • 8 comments

Version of the custom_component

1.0.12

What vacuum are you using?

Roborock S7 MaxV

Describe the bug

Last week, my internet went down. But my HA went very slow for some reason. After investigating, it seems that the RoboRock integration wants to connect that many times in a second, that my HA is very slow.

After disabling the roborock integration, HA went fast again as usual. After enabling the integration again ( when online ) everything works fine. When going offline again, HA is slow. When disabling roborock integration ( and still offline ) everything works fine again.

Debug log


Add your logs here.

`Logger: homeassistant.config_entries
Source: config_entries.py:402
First occurred: 8:03:58 PM (1 occurrences)
Last logged: 8:03:58 PM

Error setting up entry ***********@gmail.com for roborock
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/roborock/init.py", line 108, in async_setup_entry
networking = await map_client.get_networking()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/roborock/api.py", line 513, in get_networking
return await self.send_command(RoborockCommand.GET_NETWORK_INFO, return_type=NetworkInfo)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/roborock/api.py", line 404, in send_command
response = await self._send_command(method, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 207, in _send_command
return await self.send_message(roborock_message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 170, in send_message
await self.validate_connection()
File "/usr/local/lib/python3.11/site-packages/roborock/api.py", line 326, in validate_connection
await self.async_connect()
File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 158, in async_connect
(connecting, connected_future) = self.sync_connect()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 143, in sync_connect
super().connect(host=self._mqtt_host, port=self._mqtt_port, keepalive=KEEPALIVE)
File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 1044, in reconnect
sock = self._create_socket_connection()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/socket.py", line 827, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/socket.py", line 962, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -3] Try again`

`This error originated from a custom integration.

Logger: custom_components.roborock.camera
Source: custom_components/roborock/camera.py:244
Integration: Roborock (documentation, issues)
First occurred: 8:00:31 PM (4 occurrences)
Last logged: 8:05:36 PM

[Errno 101] Network unreachable
Traceback (most recent call last):
File "/config/custom_components/roborock/camera.py", line 244, in async_update
await self._handle_map_data()
File "/config/custom_components/roborock/camera.py", line 299, in _handle_map_data
map_data = await self.get_map(
^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/roborock/camera.py", line 270, in get_map
response = await self.async_map()
^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/roborock/camera.py", line 252, in async_map
map_v1 = await self.coordinator.map_api.get_map_v1()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 210, in get_map_v1
return await self.send_command(RoborockCommand.GET_MAP_V1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/roborock/api.py", line 404, in send_command
response = await self._send_command(method, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 207, in _send_command
return await self.send_message(roborock_message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 170, in send_message
await self.validate_connection()
File "/usr/local/lib/python3.11/site-packages/roborock/api.py", line 326, in validate_connection
await self.async_connect()
File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 158, in async_connect
(connecting, connected_future) = self.sync_connect()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 143, in sync_connect
super().connect(host=self._mqtt_host, port=self._mqtt_port, keepalive=KEEPALIVE)
File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 1044, in reconnect
sock = self._create_socket_connection()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/socket.py", line 851, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.11/socket.py", line 836, in create_connection
sock.connect(sa)
OSError: [Errno 101] Network unreachable`

`Logger: homeassistant.helpers.entity
Source: helpers/entity.py:698
First occurred: 8:00:31 PM (4 occurrences)
Last logged: 8:05:36 PM

Update for camera.roborock_s7_maxv_map fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 698, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 959, in async_device_update
await self.async_update()
File "/config/custom_components/roborock/camera.py", line 247, in async_update
raise err
File "/config/custom_components/roborock/camera.py", line 244, in async_update
await self._handle_map_data()
File "/config/custom_components/roborock/camera.py", line 299, in _handle_map_data
map_data = await self.get_map(
^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/roborock/camera.py", line 270, in get_map
response = await self.async_map()
^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/roborock/camera.py", line 252, in async_map
map_v1 = await self.coordinator.map_api.get_map_v1()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 210, in get_map_v1
return await self.send_command(RoborockCommand.GET_MAP_V1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/roborock/api.py", line 404, in send_command
response = await self._send_command(method, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 207, in _send_command
return await self.send_message(roborock_message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 170, in send_message
await self.validate_connection()
File "/usr/local/lib/python3.11/site-packages/roborock/api.py", line 326, in validate_connection
await self.async_connect()
File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 158, in async_connect
(connecting, connected_future) = self.sync_connect()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 143, in sync_connect
super().connect(host=self._mqtt_host, port=self._mqtt_port, keepalive=KEEPALIVE)
File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 1044, in reconnect
sock = self._create_socket_connection()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/socket.py", line 851, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.11/socket.py", line 836, in create_connection
sock.connect(sa)
OSError: [Errno 101] Network unreachable`

`and the last one:
This error originated from a custom integration.

Logger: custom_components.roborock.coordinator
Source: helpers/update_coordinator.py:332
Integration: Roborock (documentation, issues)
First occurred: 6:53:28 PM (3 occurrences)
Last logged: 8:06:06 PM

Error fetching roborock data: id=30673 Timeout after 4 seconds
Error fetching roborock data: Failed connecting to 192.168.1.76

where the 1.76 is the roborock itself.`

Androo123nl avatar Dec 27 '23 19:12 Androo123nl

I have exactly the same issue. A flood of connections attempted and home assistant becomes unusable while hitting max CPU. There are quite a few integrations that seem to suffer this issue like the deluge one which also hasnt been resolved: https://github.com/home-assistant/core/issues/96528

peregrinus avatar Jan 02 '24 01:01 peregrinus

Also same issue. I had to disable the integration for now

dochodges avatar Jan 02 '24 12:01 dochodges

Same issue

jgibson02 avatar Jan 12 '24 19:01 jgibson02

Same issue.

My roborock robot went offline by incident, and the integration created unlimited "roborock.cloud_api" connections.

After some tests, it seems to me that the problem occurs under the following situations:

  1. account change. According to HA log, even after I change my roborock login account in roborock integration, it still polls devices in the old account. The unload code does not seem to take effect.
  2. device offline. When the device is offline, "networking = await mqtt_client.get_networking()" raises error. However, I see nowhere it closes the RoborockMqttClient. HA calls async_setup_entry periodically, which continuously creates & leaks connection.

This is the source line mentioned above: roborock/__init__py#L94

tmkjchen avatar Jan 15 '24 08:01 tmkjchen

And same for me, I was wondering why HA is so slow today and restarts every 2 hours - issue was with this integration :(

krzyk avatar Jan 21 '24 07:01 krzyk

Same here. image

kamilk91 avatar Jan 31 '24 14:01 kamilk91

BTW. I just had exact same issue with the built-int roborock integration. So it looks like the issue is maybe in home assistant itself?

krzyk avatar Feb 09 '24 11:02 krzyk

After 2024.3 release i havent seen this issue occur, anyone else feels that i works better after last release?

ABEIDO avatar Mar 07 '24 11:03 ABEIDO