tuya / tuya-home-assistant

Home Assistant integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, maintained by the Home Assistant Community and Tuya Developer Team.
MIT License
856 stars 206 forks source link

Tuya Integration Not Showing Devices #978

Open blackshuck88 opened 4 months ago

blackshuck88 commented 4 months ago

Home Assistant Core: 2024.2.1 Supervisor 2024.01.1 Operating System 11.5 Frontend 20240207.1 Local Tuya: 5.2.1 Devices: Smart Bulbs

Hi guys,

I don't see any devices listed in LocalTuya integration. My subscription at IoT Platform is valid. I see all my devices there and they are linked properly to the SmartLife App. I tried to unlink and add again the SmartLife App at IoT Platform but without success.

Then I tried to add a device manually but receive always the same error message: "Connection to device succeeded but no datapoints found, please try again."

I have all needed device details (Name, Host, Device ID and Local key) and tried with all shown protocols (3.1, 3.2, 3.3, 3.4)

I can also ping all devices from the HA terminal.

Thank you in advance for your support!

Here are two errors that I see in HA logs:


Logger: custom_components.localtuya.pytuya Source: custom_components/localtuya/pytuya/init.py:863 Integration: LocalTuya integration (documentation, issues) First occurred: 08:08:21 (1 occurrences) Last logged: 08:08:21

[bf5...eva] Failed to get status: Traceback (most recent call last): File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for return await fut ^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/locks.py", line 386, 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.12/asyncio/tasks.py", line 519, in wait_for async with timeouts.timeout(timeout): File "/usr/local/lib/python3.12/asyncio/timeouts.py", line 115, in aexit raise TimeoutError from exc_val TimeoutError


Logger: homeassistant Source: custom_components/localtuya/discovery.py:67 Integration: LocalTuya integration (documentation, issues) First occurred: 08:06:46 (240 occurrences) Last logged: 08:13:22

Error doing job: Exception in callback _SelectorDatagramTransport._read_ready() 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() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 184, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 223, in finalize raise ValueError( 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.12/asyncio/events.py", line 84, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 1234, 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 0xf6 in position 0: invalid start byte


blackshuck88 commented 4 months ago

I would also like to add that I can see all devices listed in diagnostics for integrations (config_entry-localtuya) but can't see them listed in the drop down menu when I try to add new device. And the Smart Life App is closed on all devices. LocalTuya_Integration_Add Device

blackshuck88 commented 4 months ago

I have finally found a solution by installing LocalTuya "fork from localtuya" provided by hass-localtuya Here is detailed description.

To make it short. Here is the main installation guide:

1. Open HACS and navigate to Integrations Section.
2. Open the Overflow Menu (⋮) in the top right corner and click on Custom repositories.
3. Paste https://github.com/xZetsubou/localtuya into the input field and select Integration from the category dropdown then click ADD.
4. Now the integration should be added search in for it and install it!.

In my case the integration was already there. Just search for LocalTuya by xZetsubou. I didn't delete the previous version of LocalTuya.

I am impressed how stable this version is. Great job. Btw. This version uses the protocol 3.5.