jasonacox / tinytuya

Python API for Tuya WiFi smart devices using a direct local area network (LAN) connection or the cloud (TuyaCloud API).
MIT License
867 stars 157 forks source link

No payload message if not using Auto IP #513

Closed cmzicz closed 1 week ago

cmzicz commented 1 week ago

Hello,

I have a weird problem. When I use "Auto" method for IP discovery, everything works great. But when I set up the IP address of the device (which has been discovered with wizard), out of nothing I get "No Payload" message.

devices = {
        "bfc47831e6547fdXXXXX" : {"ip":"192.168.1.117", "key":"XXXXXX"}
}
        return tinytuya.BulbDevice(
                        dev_id = id,
                        address = devices[id]["ip"],
                        local_key = devices[id]["key"],
                        connection_retry_delay=1, 
                        version=3.3)
DEBUG:Error decoding received data - read retry 5/5
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/tinytuya/core.py", line 1194, in _send_receive
    rmsg = self._receive()
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/tinytuya/core.py", line 1082, in _receive
    data = self._recv_all( min_len )
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/tinytuya/core.py", line 1062, in _recv_all
    raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:ERROR Unexpected Payload from Device - 904 - payload: null
DEBUG:status() received data={'Error': 'Unexpected Payload from Device', 'Err': '904', 'Payload': None}
DEBUG:Status request returned an error, is version 3.3 and local key XXXXXX correct?

Any ideas would be appreciated! Thank you

cmzicz commented 1 week ago

OK, my bad, just bad version :(