rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.99k stars 565 forks source link

Error adding a device: Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists. #1538

Open srtxema opened 1 year ago

srtxema commented 1 year ago

HOMEASSISTANT VERSION: 2023.10.4 TUYALOCAL VERSION: 5.2.1 ENVIRONMENT: DOCKER

I have try with 3.2, 3.3 and 3.4 protocol versions:

it´s no possible add. i receive this message.

In log, i obtain next:

023-10-22 13:08:58.602 DEBUG (MainThread) [custom_components.localtuya.pytuya] [122...126] Sending command 10 (device type: type_0d) 2023-10-22 13:08:58.603 DEBUG (MainThread) [custom_components.localtuya.pytuya] [122...126] Sending payload: b'{"devId":"12243xxxxxxxxxx1126","uid":"12243xxxxxxxxxxxx1126","t":"1697972938","dps":{"1":null,"2":null,"3":null,"4":null,"5":null,"6":null,"7":null,"8":null,"9":null,"10":null}}' 2023-10-22 13:08:58.604 DEBUG (MainThread) [custom_components.localtuya.pytuya] [122...126] Command 13 waiting for seq. number 1 2023-10-22 13:09:03.606 DEBUG (MainThread) [custom_components.localtuya.pytuya] [122...126] Command 13 timed out waiting for sequence number 1 2023-10-22 13:09:03.606 ERROR (MainThread) [custom_components.localtuya.pytuya] [122...126] Failed to get status: File "/config/custom_components/localtuya/pytuya/init.py", line 863, in detect_available_dps File "/config/custom_components/localtuya/pytuya/init.py", line 795, in status File "/config/custom_components/localtuya/pytuya/init.py", line 769, in exchange File "/config/custom_components/localtuya/pytuya/init.py", line 450, in wait_for 2023-10-22 13:09:03.612 DEBUG (MainThread) [custom_components.localtuya.config_flow] Initial state update failed (), trying reset command 2023-10-22 13:09:03.612 DEBUG (MainThread) [custom_components.localtuya.config_flow] No DPS able to be detected: object of type 'NoneType' has no len() 2023-10-22 13:09:03.612 DEBUG (MainThread) [custom_components.localtuya.config_flow] Detected DPS: {} 2023-10-22 13:09:03.612 DEBUG (MainThread) [custom_components.localtuya.pytuya] [122...126] Closing connection 2023-10-22 13:09:03.613 DEBUG (MainThread) [custom_components.localtuya.pytuya] [122...126] Connection lost: None

dnwalker68 commented 1 year ago

I probably have the same problem

`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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0x94 in position 0: invalid start byte 2023-10-24 17:22:31.756 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0x99 in position 6: invalid start byte 2023-10-24 17:22:33.443 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.1.149; expected wasserpumpe-lichtschacht-links with mac address 9c:9c:1f:d0:54:f0, found wasserpumpe-lichtschacht-links with mac address a0:20:a6:36:52:68 2023-10-24 17:22:36.739 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xee in position 6: invalid continuation byte 2023-10-24 17:22:41.139 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.1.149; expected wasserpumpe-lichtschacht-links with mac address 9c:9c:1f:d0:54:f0, found wasserpumpe-lichtschacht-links with mac address a0:20:a6:36:52:68 2023-10-24 17:22:41.719 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0x8a in position 1: invalid start byte 2023-10-24 17:22:46.719 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xfc in position 3: invalid start byte 2023-10-24 17:22:46.783 ERROR (MainThread) [homeassistant.components.fritzbox] Timeout fetching f0d3b3f904dcd97937b5d34223e835ea data 2023-10-24 17:22:46.846 WARNING (MainThread) [homeassistant.components.synology_dsm.common] Connection error during update, fallback by reloading the entry 2023-10-24 17:22:48.937 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.1.149; expected wasserpumpe-lichtschacht-links with mac address 9c:9c:1f:d0:54:f0, found wasserpumpe-lichtschacht-links with mac address a0:20:a6:36:52:68 2023-10-24 17:22:51.720 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xb4 in position 1: invalid start byte 2023-10-24 17:22:56.644 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.1.149; expected wasserpumpe-lichtschacht-links with mac address 9c:9c:1f:d0:54:f0, found wasserpumpe-lichtschacht-links with mac address a0:20:a6:36:52:68 2023-10-24 17:22:56.721 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0x93 in position 3: invalid start byte 2023-10-24 17:23:01.718 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xa8 in position 1: invalid start byte 2023-10-24 17:23:04.518 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.1.149; expected wasserpumpe-lichtschacht-links with mac address 9c:9c:1f:d0:54:f0, found wasserpumpe-lichtschacht-links with mac address a0:20:a6:36:52:68 2023-10-24 17:23:06.719 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xa9 in position 0: invalid start byte 2023-10-24 17:23:08.920 WARNING (MainThread) [homeassistant.components.songpal.media_player] [BDP-S6700(http://192.168.1.63:10000/sony)] Unable to connect 2023-10-24 17:23:08.920 WARNING (MainThread) [homeassistant.components.songpal.media_player] [BDP-S6700(http://192.168.1.54:10000/sony)] Unable to connect 2023-10-24 17:23:11.720 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xa4 in position 7: invalid start byte 2023-10-24 17:23:12.237 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.1.149; expected wasserpumpe-lichtschacht-links with mac address 9c:9c:1f:d0:54:f0, found wasserpumpe-lichtschacht-links with mac address a0:20:a6:36:52:68 2023-10-24 17:23:16.722 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 bytes in position 0-1: invalid continuation byte 2023-10-24 17:23:20.068 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.1.149; expected wasserpumpe-lichtschacht-links with mac address 9c:9c:1f:d0:54:f0, found wasserpumpe-lichtschacht-links with mac address a0:20:a6:36:52:68 2023-10-24 17:23:20.521 INFO (MainThread) [custom_components.localtuya.common] [bf1...lzm] Trying to connect to 192.168.1.169... 2023-10-24 17:23:20.523 INFO (MainThread) [custom_components.localtuya.common] [747...738] Trying to connect to 192.168.1.99... 2023-10-24 17:23:21.724 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xa1 in position 0: invalid start byte 2023-10-24 17:23:23.576 WARNING (MainThread) [custom_components.localtuya.common] [747...738] Failed to connect to 192.168.1.99: [Errno 113] Connect call failed ('192.168.1.99', 6668) 2023-10-24 17:23:23.577 WARNING (MainThread) [custom_components.localtuya.common] [bf1...lzm] Failed to connect to 192.168.1.169: [Errno 113] Connect call failed ('192.168.1.169', 6668) 2023-10-24 17:23:26.721 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xac in position 0: invalid start byte 2023-10-24 17:23:27.774 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.1.149; expected wasserpumpe-lichtschacht-links with mac address 9c:9c:1f:d0:54:f0, found wasserpumpe-lichtschacht-links with mac address a0:20:a6:36:52:68 2023-10-24 17:23:31.719 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xe5 in position 2: invalid continuation byte 2023-10-24 17:23:35.557 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.1.149; expected wasserpumpe-lichtschacht-links with mac address 9c:9c:1f:d0:54:f0, found wasserpumpe-lichtschacht-links with mac address a0:20:a6:36:52:68 2023-10-24 17:23:36.725 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xa8 in position 0: invalid start byte 2023-10-24 17:23:41.719 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xc9 in position 4: invalid continuation byte 2023-10-24 17:23:43.262 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.1.149; expected wasserpumpe-lichtschacht-links with mac address 9c:9c:1f:d0:54:f0, found wasserpumpe-lichtschacht-links with mac address a0:20:a6:36:52:68 2023-10-24 17:23:46.719 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xd2 in position 0: invalid continuation byte 2023-10-24 17:23:51.037 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.1.149; expected wasserpumpe-lichtschacht-links with mac address 9c:9c:1f:d0:54:f0, found wasserpumpe-lichtschacht-links with mac address a0:20:a6:36:52:68 2023-10-24 17:23:51.722 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0x94 in position 0: invalid start byte 2023-10-24 17:23:56.720 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xc2 in position 1: invalid continuation byte 2023-10-24 17:23:58.503 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.1.149; expected wasserpumpe-lichtschacht-links with mac address 9c:9c:1f:d0:54:f0, found wasserpumpe-lichtschacht-links with mac address a0:20:a6:36:52:68 2023-10-24 17:24:01.723 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xce in position 0: invalid continuation byte 2023-10-24 17:24:04.823 ERROR (MainThread) [custom_components.localtuya.pytuya] [bff...dtk] Failed to get status: Traceback (most recent call last): File "/usr/local/lib/python3.11/asyncio/tasks.py", line 490, in wait_for return fut.result() ^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/locks.py", line 387, 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.11/asyncio/tasks.py", line 492, in wait_for raise exceptions.TimeoutError() from exc TimeoutError 2023-10-24 17:24:04.834 DEBUG (MainThread) [custom_components.localtuya.config_flow] Initial state update failed (), trying reset command 2023-10-24 17:24:04.834 DEBUG (MainThread) [custom_components.localtuya.config_flow] No DPS able to be detected: object of type 'NoneType' has no len() 2023-10-24 17:24:04.835 DEBUG (MainThread) [custom_components.localtuya.config_flow] Detected DPS: {} 2023-10-24 17:24:06.283 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.1.149; expected wasserpumpe-lichtschacht-links with mac address 9c:9c:1f:d0:54:f0, found wasserpumpe-lichtschacht-links with mac address a0:20:a6:36:52:68 2023-10-24 17:24:06.719 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xf0 in position 1: invalid continuation byte 2023-10-24 17:24:11.720 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xf8 in position 0: invalid start byte 2023-10-24 17:24:14.032 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.1.149; expected wasserpumpe-lichtschacht-links with mac address 9c:9c:1f:d0:54:f0, found wasserpumpe-lichtschacht-links with mac address a0:20:a6:36:52:68 2023-10-24 17:24:16.720 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xe9 in position 0: invalid continuation byte 2023-10-24 17:24:20.522 INFO (MainThread) [custom_components.localtuya.common] [bf1...lzm] Trying to connect to 192.168.1.169... 2023-10-24 17:24:20.523 INFO (MainThread) [custom_components.localtuya.common] [747...738] Trying to connect to 192.168.1.99... 2023-10-24 17:24:21.719 ERROR (MainThread) [homeassistant] 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.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, 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.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, 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 0xbf in position 0: invalid start byte 2023-10-24 17:24:21.854 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.1.149; expected wasserpumpe-lichtschacht-links with mac address 9c:9c:1f:d0:54:f0, found wasserpumpe-lichtschacht-links with mac address a0:20:a6:36:52:68 `

monsieurlatte commented 1 year ago

Same error here when adding in my sunbeam mattress warmer.

CyberonAustralia commented 1 year ago

Same problem here.

All other devices are fine and working. Got a new light, setup with the Tuya App, pulled the key from the Cloud dev API. The key format looks new / unusual / unexpected and contains special characters like: |?$}+

I can communicate to the device using TinyTuya and it pulls down DPS values fine (as well as the local Key).

Does anyone know if there is a way to manually change the local key (to something more useful)?

srtxema commented 1 year ago

i dont know. For me, with tuya addon it works correctly but not with local tuya addon

jonathanm3 commented 1 year ago

same issue for me

jonathanm3 commented 1 year ago

Does anyone know if there is a way to manually change the local key (to something more useful)?

This was actually on the right track. I looked at the localkey from within the Tuya IoT platform (following this video https://www.youtube.com/watch?v=2kfv0W80NYk ). For some reason this localkey is different to the one found by LocalTuya and then i could add it.

monsieurlatte commented 1 year ago

I couldn't add mine automatically either I did mine using the three dot method and then I manually chose all the DPS and it works that way, not ideal but it works, mine wasn't because of the local key being different though as they both were the same.

LinuxEverywhere commented 1 year ago

I had a similar problem when adding a gosund outlet. Localtuya would list it as unavailable. The fix was to move the outet closer to the router to increase the wifi strength and decrease ping times, to add it. Seems this bug is related to wifi dropping packets, during the add device process.

CyberonAustralia commented 1 year ago

So the plot thickens. I can add the device manually using the 3dots and then adding DPS values. I can see from manually interrogating the device that it has quite a few DPS.

Now the issue is that it appears to be overwriting some of the values with -1 and then providing a non-functional device.

Just tried using "22,23,21,24". The first DP seems to get picked up as the ID and then set to "-1"

monsieurlatte commented 1 year ago

You know what's funny is I think my sunbeam bed warmer has the same thing, I did the manual DPS after using IoT dev to find all of them, however there are a couple and the first one has the -1 value too, wonder if that's what is messing it up?

CyberonAustralia commented 1 year ago

Using "20,21,22,23,24,25" in the manual DPS section and 18,19,20 in the RESET section

allowed me to add but still not responding

CyberonAustralia commented 1 year ago

As an interim I have added the Tuya add-on back, disabled all of the locally functional devices

jonathanm3 commented 1 year ago

I switched to “Tuya local”, no problems

tzwickl commented 10 months ago

Same issue for me... I have three identical light bulbs all of them are working fine over the Tuya App but only two work over the Tuya local integration. All of them used to work but now one of them stopped working and I can't get it back...