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

Time out on device initialization #725

Open
SLAZ666 opened this issue Sep 19, 2024 · 3 comments
Open

Time out on device initialization #725

SLAZ666 opened this issue Sep 19, 2024 · 3 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@SLAZ666
Copy link

SLAZ666 commented Sep 19, 2024

Describe the bug
Initialization of the vacuum does not work (Time out). Configuration of the device works, but the integration can not load the device.

To Reproduce
Use an L10s Ultra with firmware 4.3.9_3204 like in #482 or #342

Expected behavior
The integration should load the device correctly and not time out.

Additional Information (please complete the following information)

  • Model Name [e.g. dreame.vacuum.p2028]: dreame.vacuum.r2228o
  • Firmware Version [e.g. 1156]: 4.3.9_3204
  • Home Assistant Version: 2024.9.2
  • Integration Version: v1.0.4
  • Configuration Type [With or without map support]: Without map support (local connection)
  • Errors or warnings shown in the HA logs (if applicable):

2024-09-19 19:12:03.652 ERROR (SyncWorker_3) [miio.miioprotocol] Got error when receiving: timed out
2024-09-19 19:12:03.668 WARNING (MainThread) [custom_components.dreame_vacuum] Integration start failed: Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 193, in send
data, addr = s.recvfrom(4096)
^^^^^^^^^^^^^^^^
TimeoutError: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 193, in send
data, addr = s.recvfrom(4096)
^^^^^^^^^^^^^^^^
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/config/custom_components/dreame_vacuum/coordinator.py", line 326, in _async_update_data
await self.hass.async_add_executor_job(self.device.update)
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/dreame_vacuum/dreame/device.py", line 996, in update
self.connect_device()
File "/config/custom_components/dreame_vacuum/dreame/device.py", line 733, in connect_device
self._request_properties()
File "/config/custom_components/dreame_vacuum/dreame/device.py", line 262, in _request_properties
result = self._protocol.get_properties(props[:15])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/dreame_vacuum/dreame/protocol.py", line 543, in get_properties
return self.send("get_properties", parameters=parameters, retry_count=retry_count)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/dreame_vacuum/dreame/protocol.py", line 536, in send
return self.device.send(method, parameters=parameters, retry_count=retry_count)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 233, in send
return self.send(
^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 241, in send
raise DeviceException("No response from the device") from ex
miio.exceptions.DeviceException: No response from the device

I have analysed the problem. The log points to line 262 in device.py, where the properties are requested from the device. The timeout occured in the fourth request inside the loop, so properties 45-60. I tried to get the exact property that causes the timeout, but when I requested less properties, no time out occured. I have changed the code to only request 10 properties at a time and now it initializes the device correctly. I don't really know why this works perhaps the request or response is too big for the exact combination.

So a fix that worked for me is to change lines 262 and 265 inside device.py from the value 15 to 10.

@SLAZ666 SLAZ666 added bug Something isn't working question Further information is requested labels Sep 19, 2024
@Tasshack
Copy link
Owner

So a fix that worked for me is to change lines 262 and 265 inside device.py from the value 15 to 10.

This is a nice found I will investigate that, thanks.

Miio protocol has limit of maximum 15 properties at a time for all the devices that are using it but I don't think it is a size issue because vacuum can return raw map data over local protocol when it is mapping and it can grow very huge.

@ManiaciaChao
Copy link

I can confirm that this issue also occurred with my xiaomi_vacuum_c102cn.
I haven't investigated it deeply yet, but setting it to 10 didn't resolve the problem.
In my case, I had to adjust that value to 5.

@tinuva
Copy link

tinuva commented Dec 10, 2024

For my c102gl I also had to set the props down to 5 on the latest beta release v2.0.0816

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants