Skip to content

problem connecting lamp to local tuya #1947

Open
@StockHudso

Description

@StockHudso

The problem

Environment

  • Localtuya version: <5.2.3>

  • Home Assistant Core version: < Core 2025.3.2
    Supervisor 2025.03.2
    Operating System 14.2
    Frontend 20250306.0>

  • [] Does the device work using the Home Assistant Tuya Cloud component ? <[x]>

  • [] Does the device work using the Tinytuya (https://github.com/jasonacox/tinytuya) command line tool ? haven't tried

  • [] Was the device working with earlier versions of localtuya ? Which one? no its a new integration

  • [] Are you using the Tuya/SmartLife App in parallel ? < [x]> atm using tuya smart but planning to use only on local lan

Steps to reproduce

1.grab ID and key from tuya iot platform
2. grab ip from dhcp server
3.insert all data in tuya local integration (tried for each protocol 3.1 3.2 3.3 and 3.4)

DP dump

Provide Home Assistant traceback/logs

Questo errore ha avuto origine da un'integrazione personalizzata.

Registratore: homeassistant
Fonte: custom_components/localtuya/discovery.py:67
Integrazione: LocalTuya (documentazione, problemi)
Prima occorrenza: 13 marzo 2025 alle ore 21:10:56 (50911 occorrenze)
Ultimo accesso: 11:23:08

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 1243, 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 0x92 in position 1: invalid start byte

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions