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

Timeout error retrieving datapoints for UR_智能饮水机 #59

Open
Elfrizzyx opened this issue Jan 29, 2025 · 2 comments
Open

Timeout error retrieving datapoints for UR_智能饮水机 #59

Elfrizzyx opened this issue Jan 29, 2025 · 2 comments

Comments

@Elfrizzyx
Copy link

I am experiencing an issue with the LocalTuya integration in Home Assistant. While the connection to my device is successful, I receive a “Failed to get status” error, and not all datapoints (DPS) are being detected. Some features of the device are missing in Home Assistant, despite being available in the Tuya IoT Platform.

Here are the details:
• Device model: UR_智能饮水机
• Product Category: cwysj
• Firmware version: 1.0.24
• Integration version: 5.2.3
• Home Assistant version: Core 2025.1.4
• Python version: 3.13
• Detected datapoints: None (timeout error during retrieval)

Steps to reproduce:
1. Add the device to LocalTuya using its IP and Local Key.
2. Restart Home Assistant.
3. Attempt to control the device or retrieve its status.

Debug Log :

Here is the debug log that shows the error:

[bf6...rz0] Failed to get status:
Traceback (most recent call last):
File "/usr/local/lib/python3.13/asyncio/tasks.py", line 507, in wait_for
return await fut
^^^^^^^^^
File "/usr/local/lib/python3.13/asyncio/locks.py", line 407, in acquire
await fut
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
File "/config/custom_components/localtuya/pytuya/init.py", line 863, in detect_available_dps
data = await self.status()
^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/localtuya/pytuya/init.py", line 795, in status
status = await self.exchange(DP_QUERY)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/localtuya/pytuya/init.py", line 769, in exchange
msg = await self.dispatcher.wait_for(seqno, payload.cmd)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/localtuya/pytuya/init.py", line 450, in wait_for
await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
File "/usr/local/lib/python3.13/asyncio/tasks.py", line 506, in wait_for
async with timeouts.timeout(timeout):
~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/local/lib/python3.13/asyncio/timeouts.py", line 116, in aexit
raise TimeoutError from exc_val
TimeoutError

I am also observing another related error in the logs, which might help identify the root cause of the issue. Here is the additional traceback:

Error doing job: Exception in callback _SelectorDatagramTransport._read_ready() (None)
Traceback (most recent call last):
File "/config/custom_components/localtuya/discovery.py", line 65, in datagram_received
data = decrypt_udp(data)
File "/config/custom_components/localtuya/discovery.py", line 30, in decrypt_udp
return _unpad(decryptor.update(message) + decryptor.finalize()).decode()
~~~~~~~~~~~~~~~~~~^^
ValueError: The length of the provided data is not a multiple of the block length.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 1241, in _read_ready
self._protocol.datagram_received(data, addr)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "/config/custom_components/localtuya/discovery.py", line 67, in datagram_received
data = data.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcc in position 0: invalid continuation byte

To be more specific the DPs available on tuya IOT are:

switch (Switch, bool, RW)
work_mode (Work mode, enum, RW: normal, night)
filter_days (Filter days left, value, RO: 0-90 days)
pump_time (Cleaning days left, value, RO: 0-31 days)
filter_reset (Reset filter, bool, RW)
pump_reset (Reset cleaning, bool, RW)
filter_life (Filter duration, value, RW: 0-30 days)
time_clean (Cleaning duration, value, RW: 0-15 days)
water_level (Water level, enum, RO: low, middle, high)
water_left (Percentage water, value, RO: 0-100%)
water_intake (Water intake, value, RO: 0-2000 ml)
fault (Fault warnings, bitmap, RO)
water_surplus (Water remaining, value, RW: 0-4500 ml)

Those taken on home assistant are these :

switch (Switch, bool, RW)
filter_reset (Reset filter, bool, RW)
pump_reset (Reset cleaning, bool, RW)
I would like to be able to integrate the remaining DPs on home assistant.

THX in advace

Image
@Elfrizzyx
Copy link
Author

I tested all the protocols.
3.1 - 3.2 - 3.3 - 3-4.
The result is the same.
"Connection to the device was successful but no datapoints were found, try again. Create a new Issue and include debug logs if the problem persists."

Image

@Elfrizzyx
Copy link
Author

Elfrizzyx commented Jan 30, 2025

I have prepared a table with all the DPs extracted from Tuya IOT, should it be useful.

Image

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

1 participant