tinytuya
tinytuya copied to clipboard
Device cant be connected if not connected to cloud
Hi,
I hope this problem is not a feature: I can disable Internet Access for Tuya Devices in my router. If I disable internet access and plug the device off and on (reboot), I can still control my devices with the "Tuya Smart" App on my phone, but no longer with tinytuya. After using the device once with the smartphone app it can be controlled again with tinytuya, even with disabled internet access.
I'm using version 1.2.8.
My simple sample program is:
import tinytuya
import time
loop=1
tinytuya.set_debug(True)
while True:
print(loop)
d = tinytuya.OutletDevice('xxx', 'xx', 'xxx')
d.set_version(3.3)
data = d.status()
if (not ("Error" in data)):
break
loop=loop+1
# Show status and state of first controlled switch on device
print('Dictionary %r' % data)
data = d.set_status(True, 7)
time.sleep(1)
data = d.set_status(False, 7)
If Internet is enabled for the tuya device debug output is as follows:
DEBUG:TinyTuya [1.2.8]
1
DEBUG:status() entry (dev_type is default)
DEBUG:building payload=b'{"gwId":"6715286024a16016aeaf","devId":"6715286024a16016aeaf","uid":"6715286024a16016aeaf","t":"1633030135"}'
DEBUG:payload generated=b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00x\xce%\x93s\xd7\xb1\xbe\x0b\xe9\x0e\xf6\xb6\xfe\xdc\xfbk\xde\xf1\tVn\x0b7\xaayTu\x1a\x1e\xca\x95Oe\xa6\xdd\xae!W\xd1\x03-\xc1F\xd2\x8b\xda\xa4n\x80\x13\xbcA\xd2*\xf1\x9cA0\xfa\xf83\xeex\xda\xd3\r"\xff\xae}\xec\xd3j\x12R^k-\x97\x83@f\xe7[\xed\xe1\xdeM\xb3d\xc2E\xa0\x84\xad\x03\xc1\r\x9d8`\x9fN\xe4\xd5\xb3\x04\xfcj5.:\xf2*\xe4\xe1\x00\x00\xaaU'
DEBUG:received data=b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x8c\x00\x00\x00\x00A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80j\x19\x98\xd4\xe8Oy\xc6s\x9ck\x08\xef\x0c\xfc!\xff\x83,\xbc`[\x9a\xe5\x8eG\x94\xe5\xad\x10\x1b\xf16\xa5\x8a\xca\xe7\x86\xa8\xee\xe0\x90\x90\x87\xf9\x84&\xa6\xa9f%\xe0\x9d\x89\xab\xc4x\xc7\x8f5K\xd4t\x10(\x16+\rY\xf4\x99\x84\xbcz\xb1\x15\xb7\xdb:~r\xde4\x0c\xe4\x9d\xad^L\xd8\x085\x0e\xac\xf7\xe5:WI\xae\x00\x00\xaaU'
DEBUG:raw unpacked message = TuyaMessage(seqno=0, cmd=10, retcode=0, payload=b'A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80j\x19\x98\xd4\xe8Oy\xc6s\x9ck\x08\xef\x0c\xfc!\xff\x83,\xbc`[\x9a\xe5\x8eG\x94\xe5\xad\x10\x1b\xf16\xa5\x8a\xca\xe7\x86\xa8\xee\xe0\x90\x90\x87\xf9\x84&\xa6\xa9f%\xe0\x9d\x89\xab\xc4x\xc7\x8f5K\xd4t\x10(\x16+\rY\xf4\x99\x84\xbcz\xb1\x15\xb7\xdb:~r\xde4\x0c\xe4\x9d\xad^L\xd8\x085\x0e\xac\xf7\xe5', crc=978799022)
DEBUG:decode payload=b'A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80j\x19\x98\xd4\xe8Oy\xc6s\x9ck\x08\xef\x0c\xfc!\xff\x83,\xbc`[\x9a\xe5\x8eG\x94\xe5\xad\x10\x1b\xf16\xa5\x8a\xca\xe7\x86\xa8\xee\xe0\x90\x90\x87\xf9\x84&\xa6\xa9f%\xe0\x9d\x89\xab\xc4x\xc7\x8f5K\xd4t\x10(\x16+\rY\xf4\x99\x84\xbcz\xb1\x15\xb7\xdb:~r\xde4\x0c\xe4\x9d\xad^L\xd8\x085\x0e\xac\xf7\xe5'
DEBUG:decrypting=b'A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80j\x19\x98\xd4\xe8Oy\xc6s\x9ck\x08\xef\x0c\xfc!\xff\x83,\xbc`[\x9a\xe5\x8eG\x94\xe5\xad\x10\x1b\xf16\xa5\x8a\xca\xe7\x86\xa8\xee\xe0\x90\x90\x87\xf9\x84&\xa6\xa9f%\xe0\x9d\x89\xab\xc4x\xc7\x8f5K\xd4t\x10(\x16+\rY\xf4\x99\x84\xbcz\xb1\x15\xb7\xdb:~r\xde4\x0c\xe4\x9d\xad^L\xd8\x085\x0e\xac\xf7\xe5'
DEBUG:decrypted 3.3 payload='{"devId":"6715286024a16016aeaf","dps":{"1":false,"7":false,"9":0,"15":0,"18":0,"19":0,"20":2347,"101":false,"102":false}}'
DEBUG:decoded results='{"devId":"6715286024a16016aeaf","dps":{"1":false,"7":false,"9":0,"15":0,"18":0,"19":0,"20":2347,"101":false,"102":false}}'
DEBUG:status() received data={'devId': '6715286024a16016aeaf', 'dps': {'1': False, '7': False, '9': 0, '15': 0, '18': 0, '19': 0, '20': 2347, '101': False, '102': False}}
Dictionary {'devId': '6715286024a16016aeaf', 'dps': {'1': False, '7': False, '9': 0, '15': 0, '18': 0, '19': 0, '20': 2347, '101': False, '102': False}}
DEBUG:building payload=b'{"devId":"6715286024a16016aeaf","uid":"6715286024a16016aeaf","t":"1633030135","dps":{"7":true}}'
DEBUG:payload generated=b'\x00\x00U\xaa\x00\x00\x00\x01\x00\x00\x00\x07\x00\x00\x00w3.3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\xa8\xa1\x848w\xafQ\x92\xf7N\xfb~\xce^u\x9fY\xb8\x94\x07\x01#\n\x88\xdd7\xe0.D#qp\x9c\xc5-\xd6\xed\xc6\xa0\xb7\xdf\x8a9\x8b\xf4\xe0J\xff\xca\r\xbd\x99\x1aC\xd6b.1\x04-|^\xde\xaf\xaf[\x00\xb4\x00\x00\xaaU'
DEBUG:received null payload (b'\x00\x00U\xaa\x00\x00\x00\x01\x00\x00\x00\x07\x00\x00\x00\x0c\x00\x00\x00\x00\xa5\x05\xa9\x14\x00\x00\xaaU'), fetch new one
DEBUG:received data=b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00k\x00\x00\x00\x003.3\x00\x00\x00\x00\x00\x00\x00]\x00\x00\x00\x01A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\xc9\x98\x8e\x03\xc4\xad\xf9\xd1mMd\xb9\xd3\x0e\xe7\xa1|\x15\x18\x1f\x0c\xc65<\xeb\xb9\xba\xf2\x82\xc8\xf9\xbf\x86\xf3\x0b\xbeN\x15\xc0b\x9b\xc45\x8e=+,\x90J\x98\x96\xcf\x00\x00\xaaU'
DEBUG:raw unpacked message = TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b'3.3\x00\x00\x00\x00\x00\x00\x00]\x00\x00\x00\x01A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\xc9\x98\x8e\x03\xc4\xad\xf9\xd1mMd\xb9\xd3\x0e\xe7\xa1|\x15\x18\x1f\x0c\xc65<\xeb\xb9\xba\xf2\x82\xc8\xf9\xbf\x86\xf3\x0b\xbeN\x15\xc0b\x9b\xc45\x8e=+,\x90', crc=1251514063)
DEBUG:decode payload=b'3.3\x00\x00\x00\x00\x00\x00\x00]\x00\x00\x00\x01A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\xc9\x98\x8e\x03\xc4\xad\xf9\xd1mMd\xb9\xd3\x0e\xe7\xa1|\x15\x18\x1f\x0c\xc65<\xeb\xb9\xba\xf2\x82\xc8\xf9\xbf\x86\xf3\x0b\xbeN\x15\xc0b\x9b\xc45\x8e=+,\x90'
DEBUG:removing 3.3=b'A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\xc9\x98\x8e\x03\xc4\xad\xf9\xd1mMd\xb9\xd3\x0e\xe7\xa1|\x15\x18\x1f\x0c\xc65<\xeb\xb9\xba\xf2\x82\xc8\xf9\xbf\x86\xf3\x0b\xbeN\x15\xc0b\x9b\xc45\x8e=+,\x90'
DEBUG:decrypting=b'A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\xc9\x98\x8e\x03\xc4\xad\xf9\xd1mMd\xb9\xd3\x0e\xe7\xa1|\x15\x18\x1f\x0c\xc65<\xeb\xb9\xba\xf2\x82\xc8\xf9\xbf\x86\xf3\x0b\xbeN\x15\xc0b\x9b\xc45\x8e=+,\x90'
DEBUG:decrypted 3.3 payload='{"devId":"6715286024a16016aeaf","dps":{"7":true},"t":1633030135}'
DEBUG:decoded results='{"devId":"6715286024a16016aeaf","dps":{"7":true},"t":1633030135}'
DEBUG:set_status received data={'devId': '6715286024a16016aeaf', 'dps': {'7': True}, 't': 1633030135}
DEBUG:building payload=b'{"devId":"6715286024a16016aeaf","uid":"6715286024a16016aeaf","t":"1633030136","dps":{"7":false}}'
DEBUG:payload generated=b'\x00\x00U\xaa\x00\x00\x00\x02\x00\x00\x00\x07\x00\x00\x00\x873.3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\xa8\xa1\x848w\xafQ\x92\xf7N\xfb~\xce^u\x9fY\xb8\x94\x07\x01#\n\x88\xdd7\xe0.D#qpd\xacI4\x91\xcc\x98w\x87(W9\x11\xe2sc\xc4M\xbf\x81\xd5h\x18w\xe2\xceE\x18w\x04r\xa9\x86\xf3\x0b\xbeN\x15\xc0b\x9b\xc45\x8e=+,\x90[\xc2`\xa0\x00\x00\xaaU'
DEBUG:received null payload (b'\x00\x00U\xaa\x00\x00\x00\x02\x00\x00\x00\x07\x00\x00\x00\x0c\x00\x00\x00\x00\x18\xcf\xc5\xda\x00\x00\xaaU'), fetch new one
DEBUG:received data=b"\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00k\x00\x00\x00\x003.3\x00\x00\x00\x00\x00\x00\x00^\x00\x00\x00\x01A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\x8f\xe9\xdag-[\x8a\x9e\x19\xee\x03V\xb65\x8c\xdf\x03I\x12\xde\x1d\x91O4\x8a\x17\x96i\x8d\xd9\xa6f\xbe])6\xfdX.}\x00\xeb1@'\x1eb\x88\xc1;\xf5K\x00\x00\xaaU"
DEBUG:raw unpacked message = TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b"3.3\x00\x00\x00\x00\x00\x00\x00^\x00\x00\x00\x01A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\x8f\xe9\xdag-[\x8a\x9e\x19\xee\x03V\xb65\x8c\xdf\x03I\x12\xde\x1d\x91O4\x8a\x17\x96i\x8d\xd9\xa6f\xbe])6\xfdX.}\x00\xeb1@'\x1eb\x88", crc=3241932107)
DEBUG:decode payload=b"3.3\x00\x00\x00\x00\x00\x00\x00^\x00\x00\x00\x01A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\x8f\xe9\xdag-[\x8a\x9e\x19\xee\x03V\xb65\x8c\xdf\x03I\x12\xde\x1d\x91O4\x8a\x17\x96i\x8d\xd9\xa6f\xbe])6\xfdX.}\x00\xeb1@'\x1eb\x88"
DEBUG:removing 3.3=b"A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\x8f\xe9\xdag-[\x8a\x9e\x19\xee\x03V\xb65\x8c\xdf\x03I\x12\xde\x1d\x91O4\x8a\x17\x96i\x8d\xd9\xa6f\xbe])6\xfdX.}\x00\xeb1@'\x1eb\x88"
DEBUG:decrypting=b"A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\x8f\xe9\xdag-[\x8a\x9e\x19\xee\x03V\xb65\x8c\xdf\x03I\x12\xde\x1d\x91O4\x8a\x17\x96i\x8d\xd9\xa6f\xbe])6\xfdX.}\x00\xeb1@'\x1eb\x88"
DEBUG:decrypted 3.3 payload='{"devId":"6715286024a16016aeaf","dps":{"7":false},"t":1633030136}'
DEBUG:decoded results='{"devId":"6715286024a16016aeaf","dps":{"7":false},"t":1633030136}'
DEBUG:set_status received data={'devId': '6715286024a16016aeaf', 'dps': {'7': False}, 't': 1633030136}
If Internet is disabled and device is rebooted, debug output is as follows:
DEBUG:TinyTuya [1.2.8]
1
DEBUG:status() entry (dev_type is default)
DEBUG:building payload=b'{"gwId":"6715286024a16016aeaf","devId":"6715286024a16016aeaf","uid":"6715286024a16016aeaf","t":"1633030584"}'
DEBUG:payload generated=b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00x\xce%\x93s\xd7\xb1\xbe\x0b\xe9\x0e\xf6\xb6\xfe\xdc\xfbk\xde\xf1\tVn\x0b7\xaayTu\x1a\x1e\xca\x95Oe\xa6\xdd\xae!W\xd1\x03-\xc1F\xd2\x8b\xda\xa4n\x80\x13\xbcA\xd2*\xf1\x9cA0\xfa\xf83\xeex\xda\xd3\r"\xff\xae}\xec\xd3j\x12R^k-\x97\x83@f\xe7[\xed\xe1\xdeM\xb3d\xc2E\xa0\x84\xad\x03\t\xff\xbf\x87\xfd\xdf\x85g\x94\x8e\x02G)\xdb:\x85\x86Q\xa6W\x00\x00\xaaU'
DEBUG:received data=b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00,\x00\x00\x00\x01\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 \xf0S\xcb\x8b\x00\x00\xaaU'
DEBUG:raw unpacked message = TuyaMessage(seqno=0, cmd=10, retcode=1, payload=b'\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 ', crc=4032023435)
DEBUG:decode payload=b'\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 '
DEBUG:decrypting=b'\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 '
DEBUG:decrypted 3.3 payload='json obj data unvalid'
DEBUG:'data unvalid' error detected: switching to dev_type 'device22'
DEBUG:Device22 detected and updated (default -> device22) - Update payload and try again
DEBUG:ERROR Device22 Detected: Retry Command - 907 - payload: null
DEBUG:status() received data={'Error': 'Device22 Detected: Retry Command', 'Err': '907', 'Payload': None}
DEBUG:status() rebuilding payload for device22
DEBUG:building payload=b'{"devId":"6715286024a16016aeaf","uid":"6715286024a16016aeaf","t":"1633030584","dps":{"1":null}}'
DEBUG:payload generated=b'\x00\x00U\xaa\x00\x00\x00\x01\x00\x00\x00\r\x00\x00\x00w3.3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\xa8\xa1\x848w\xafQ\x92\xf7N\xfb~\xce^u\x9fY\xb8\x94\x07\x01#\n\x88\xdd7\xe0.D#qp\x0c\x90M3\xe8\x9c\xed\xb3\xdfp\xc9xX\x80J;+3\x7f\xe4.\xad\xab\xb6+;\xeb\x8dGI\xad?\x95\x00y)\x00\x00\xaaU'
DEBUG:Timeout or exception in _send_receive() - retry 1/5
DEBUG:Timeout or exception in _send_receive() - retry 2/5
DEBUG:Timeout or exception in _send_receive() - retry 3/5
DEBUG:Timeout or exception in _send_receive() - retry 4/5
DEBUG:Timeout or exception in _send_receive() - retry 5/5
DEBUG:Timeout or exception in _send_receive() - retry 6/5
DEBUG:Exceeded tinytuya retry limit (5)
DEBUG:ERROR Timeout Waiting for Device - 902 - payload: "Check device key or version"
Hi @doktorschiwago - In the "internet disabled" debug trace, the device responds back with 'json obj data unvalid' which is typically an indication that the device has an edge behavior that requires command 0x0d instead of 0x0a to get status. TinyTuya is designed to detect and switch to that mode if it detects the 'unvalid' response. Let's try to have your code force it back to default mode:
import tinytuya
import time
loop=1
tinytuya.set_debug(True)
d = tinytuya.OutletDevice('xxx', 'xx', 'xxx')
d.set_version(3.3)
while True:
print(loop)
data = d.status()
print(data)
d.dev_type = 'default' # reset type if it was forced to device22
loop=loop+1
time.sleep(1)
If that doesn't help, let's try switching to raw listening mode to see what the device is doing:
import tinytuya
# tinytuya.set_debug(True)
d = tinytuya.OutletDevice('DEVICEID', 'DEVICEIP', 'DEVICEKEY')
d.set_version(3.3)
d.set_socketPersistent(True)
print(" > Send Request for Status < ")
payload = d.generate_payload(tinytuya.DP_QUERY)
d.send(payload)
print(" > Begin Monitor Loop <")
while(True):
# See if any data is available
data = d.receive()
print('Received Payload: %r' % data)
# Send keyalive heartbeat
print(" > Send Heartbeat Ping < ")
payload = d.generate_payload(tinytuya.HEART_BEAT)
d.send(payload)
Thanks for your help. It seems to me that the workarounds did not solve the problem.
Output of first program: ` #DEBUG:TinyTuya [1.2.8]
1 DEBUG:status() entry (dev_type is default) DEBUG:building payload=b'{"gwId":"6715286024a16016aeaf","devId":"6715286024a16016aeaf","uid":"6715286024a16016aeaf","t":"1633242794"}' DEBUG:payload generated=b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00x\xce%\x93s\xd7\xb1\xbe\x0b\xe9\x0e\xf6\xb6\xfe\xdc\xfbk\xde\xf1\tVn\x0b7\xaayTu\x1a\x1e\xca\x95Oe\xa6\xdd\xae!W\xd1\x03-\xc1F\xd2\x8b\xda\xa4n\x80\x13\xbcA\xd2*\xf1\x9cA0\xfa\xf83\xeex\xda\xd3\r"\xff\xae}\xec\xd3j\x12R^k-\x97\x83@f\xe7[\xed\xe1\xdeM\xb3d\xc2E\xa0\x84\xad\x03+:\x96@\xf0,?}\n0\xefYh\x0c\x08\xa6W\x14\xa1\x8b\x00\x00\xaaU' DEBUG:received data=b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00,\x00\x00\x00\x01\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 \xf0S\xcb\x8b\x00\x00\xaaU' DEBUG:raw unpacked message = TuyaMessage(seqno=0, cmd=10, retcode=1, payload=b'\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 ', crc=4032023435) DEBUG:decode payload=b'\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 ' DEBUG:decrypting=b'\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 ' DEBUG:decrypted 3.3 payload='json obj data unvalid' DEBUG:'data unvalid' error detected: switching to dev_type 'device22' DEBUG:Device22 detected and updated (default -> device22) - Update payload and try again DEBUG:ERROR Device22 Detected: Retry Command - 907 - payload: null DEBUG:status() received data={'Error': 'Device22 Detected: Retry Command', 'Err': '907', 'Payload': None} DEBUG:status() rebuilding payload for device22 DEBUG:building payload=b'{"devId":"6715286024a16016aeaf","uid":"6715286024a16016aeaf","t":"1633242798","dps":{"1":null}}' DEBUG:payload generated=b'\x00\x00U\xaa\x00\x00\x00\x01\x00\x00\x00\r\x00\x00\x00w3.3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\xa8\xa1\x848w\xafQ\x92\xf7N\xfb~\xce^u\x9fY\xb8\x94\x07\x01#\n\x88\xdd7\xe0.D#qpFZ\xa4<\xf2\xcc\x98\xca\x0e\x00\xa1aC\x9fmD+3\x7f\xe4.\xad\xab\xb6+;\xeb\x8dGI\xad?\xcaI\xa30\x00\x00\xaaU' DEBUG:Timeout or exception in _send_receive() - retry 1/5 DEBUG:Timeout or exception in _send_receive() - retry 2/5 DEBUG:Timeout or exception in _send_receive() - retry 3/5 DEBUG:Timeout or exception in _send_receive() - retry 4/5 DEBUG:Timeout or exception in _send_receive() - retry 5/5 DEBUG:Timeout or exception in send_receive() - retry 6/5 DEBUG:Exceeded tinytuya retry limit (5) DEBUG:ERROR Timeout Waiting for Device - 902 - payload: "Check device key or version" 2 DEBUG:status() entry (dev_type is default) DEBUG:building payload=b'{"gwId":"6715286024a16016aeaf","devId":"6715286024a16016aeaf","uid":"6715286024a16016aeaf","t":"1633242829"}' DEBUG:payload generated=b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00x\xce%\x93s\xd7\xb1\xbe\x0b\xe9\x0e\xf6\xb6\xfe\xdc\xfbk\xde\xf1\tVn\x0b7\xaayTu\x1a\x1e\xca\x95Oe\xa6\xdd\xae!W\xd1\x03-\xc1F\xd2\x8b\xda\xa4n\x80\x13\xbcA\xd2*\xf1\x9cA0\xfa\xf83\xeex\xda\xd3\r"\xff\xae}\xec\xd3j\x12R^k-\x97\x83@f\xe7[\xed\xe1\xdeM\xb3d\xc2E\xa0\x84\xad\x032|\xa4'\x03G\xae4\x12\xcbM\x1cE\xf5\x7f\xcb\x17\x1f\xf7A\x00\x00\xaaU' DEBUG:received data=b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00,\x00\x00\x00\x01\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 \xf0S\xcb\x8b\x00\x00\xaaU' DEBUG:raw unpacked message = TuyaMessage(seqno=0, cmd=10, retcode=1, payload=b'\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 ', crc=4032023435) DEBUG:decode payload=b'\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 ' DEBUG:decrypting=b'\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 ' DEBUG:decrypted 3.3 payload='json obj data unvalid' DEBUG:'data unvalid' error detected: switching to dev_type 'device22' DEBUG:Device22 detected and updated (default -> device22) - Update payload and try again DEBUG:ERROR Device22 Detected: Retry Command - 907 - payload: null DEBUG:status() received data={'Error': 'Device22 Detected: Retry Command', 'Err': '907', 'Payload': None} DEBUG:status() rebuilding payload for device22 DEBUG:building payload=b'{"devId":"6715286024a16016aeaf","uid":"6715286024a16016aeaf","t":"1633242829","dps":{"1":null}}' DEBUG:payload generated=b'\x00\x00U\xaa\x00\x00\x00\x01\x00\x00\x00\r\x00\x00\x00w3.3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\xa8\xa1\x848w\xafQ\x92\xf7N\xfb~\xce^u\x9fY\xb8\x94\x07\x01#\n\x88\xdd7\xe0.D#qpS"s\xaeV\xb6N}\xb7h^\xfb\xce\x80\x1e+3\x7f\xe4.\xad\xab\xb6+;\xeb\x8dGI\xad?\xe7\xaa\xe8!\x00\x00\xaaU' DEBUG:Timeout or exception in _send_receive() - retry 1/5 DEBUG:Timeout or exception in _send_receive() - retry 2/5 DEBUG:Timeout or exception in _send_receive() - retry 3/5 DEBUG:Timeout or exception in _send_receive() - retry 4/5 DEBUG:Timeout or exception in _send_receive() - retry 5/5 DEBUG:Timeout or exception in _send_receive() - retry 6/5 DEBUG:Exceeded tinytuya retry limit (5) DEBUG:ERROR Timeout Waiting for Device - 902 - payload: "Check device key or version"
`
Output of second program:
` #DEBUG:TinyTuya [1.2.8]
1 DEBUG:status() entry (dev_type is default) DEBUG:building payload=b'{"gwId":"6715286024a16016aeaf","devId":"6715286024a16016aeaf","uid":"6715286024a16016aeaf","t":"1633242794"}' DEBUG:payload generated=b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00x\xce%\x93s\xd7\xb1\xbe\x0b\xe9\x0e\xf6\xb6\xfe\xdc\xfbk\xde\xf1\tVn\x0b7\xaayTu\x1a\x1e\xca\x95Oe\xa6\xdd\xae!W\xd1\x03-\xc1F\xd2\x8b\xda\xa4n\x80\x13\xbcA\xd2*\xf1\x9cA0\xfa\xf83\xeex\xda\xd3\r"\xff\xae}\xec\xd3j\x12R^k-\x97\x83@f\xe7[\xed\xe1\xdeM\xb3d\xc2E\xa0\x84\xad\x03+:\x96@\xf0,?}\n0\xefYh\x0c\x08\xa6W\x14\xa1\x8b\x00\x00\xaaU' DEBUG:received data=b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00,\x00\x00\x00\x01\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 \xf0S\xcb\x8b\x00\x00\xaaU' DEBUG:raw unpacked message = TuyaMessage(seqno=0, cmd=10, retcode=1, payload=b'\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 ', crc=4032023435) DEBUG:decode payload=b'\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 ' DEBUG:decrypting=b'\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 ' DEBUG:decrypted 3.3 payload='json obj data unvalid' DEBUG:'data unvalid' error detected: switching to dev_type 'device22' DEBUG:Device22 detected and updated (default -> device22) - Update payload and try again DEBUG:ERROR Device22 Detected: Retry Command - 907 - payload: null DEBUG:status() received data={'Error': 'Device22 Detected: Retry Command', 'Err': '907', 'Payload': None} DEBUG:status() rebuilding payload for device22 DEBUG:building payload=b'{"devId":"6715286024a16016aeaf","uid":"6715286024a16016aeaf","t":"1633242798","dps":{"1":null}}' DEBUG:payload generated=b'\x00\x00U\xaa\x00\x00\x00\x01\x00\x00\x00\r\x00\x00\x00w3.3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\xa8\xa1\x848w\xafQ\x92\xf7N\xfb~\xce^u\x9fY\xb8\x94\x07\x01#\n\x88\xdd7\xe0.D#qpFZ\xa4<\xf2\xcc\x98\xca\x0e\x00\xa1aC\x9fmD+3\x7f\xe4.\xad\xab\xb6+;\xeb\x8dGI\xad?\xcaI\xa30\x00\x00\xaaU' DEBUG:Timeout or exception in _send_receive() - retry 1/5 DEBUG:Timeout or exception in _send_receive() - retry 2/5 DEBUG:Timeout or exception in _send_receive() - retry 3/5 DEBUG:Timeout or exception in _send_receive() - retry 4/5 DEBUG:Timeout or exception in _send_receive() - retry 5/5 DEBUG:Timeout or exception in send_receive() - retry 6/5 DEBUG:Exceeded tinytuya retry limit (5) DEBUG:ERROR Timeout Waiting for Device - 902 - payload: "Check device key or version" 2 DEBUG:status() entry (dev_type is default) DEBUG:building payload=b'{"gwId":"6715286024a16016aeaf","devId":"6715286024a16016aeaf","uid":"6715286024a16016aeaf","t":"1633242829"}' DEBUG:payload generated=b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00x\xce%\x93s\xd7\xb1\xbe\x0b\xe9\x0e\xf6\xb6\xfe\xdc\xfbk\xde\xf1\tVn\x0b7\xaayTu\x1a\x1e\xca\x95Oe\xa6\xdd\xae!W\xd1\x03-\xc1F\xd2\x8b\xda\xa4n\x80\x13\xbcA\xd2*\xf1\x9cA0\xfa\xf83\xeex\xda\xd3\r"\xff\xae}\xec\xd3j\x12R^k-\x97\x83@f\xe7[\xed\xe1\xdeM\xb3d\xc2E\xa0\x84\xad\x032|\xa4'\x03G\xae4\x12\xcbM\x1cE\xf5\x7f\xcb\x17\x1f\xf7A\x00\x00\xaaU' DEBUG:received data=b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00,\x00\x00\x00\x01\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 \xf0S\xcb\x8b\x00\x00\xaaU' DEBUG:raw unpacked message = TuyaMessage(seqno=0, cmd=10, retcode=1, payload=b'\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 ', crc=4032023435) DEBUG:decode payload=b'\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 ' DEBUG:decrypting=b'\xb4\x02\xc8\x8c\xdfZkZ(\xe9\x1f\xd8\xb8d\xf7\xab|\x81\xe0\xc3m\xe3\x0eQ\x18J\xb8\x97\x86U\xb7 ' DEBUG:decrypted 3.3 payload='json obj data unvalid' DEBUG:'data unvalid' error detected: switching to dev_type 'device22' DEBUG:Device22 detected and updated (default -> device22) - Update payload and try again DEBUG:ERROR Device22 Detected: Retry Command - 907 - payload: null DEBUG:status() received data={'Error': 'Device22 Detected: Retry Command', 'Err': '907', 'Payload': None} DEBUG:status() rebuilding payload for device22 DEBUG:building payload=b'{"devId":"6715286024a16016aeaf","uid":"6715286024a16016aeaf","t":"1633242829","dps":{"1":null}}' DEBUG:payload generated=b'\x00\x00U\xaa\x00\x00\x00\x01\x00\x00\x00\r\x00\x00\x00w3.3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00A\x0fI3\xf5K\xa0\xc0y\xe1\xa5d4\xc8U\x8b\xae\x04\xe9\xbdy\xbdv\xe2\x01M\x10c\x0e\x943\x80\xa8\xa1\x848w\xafQ\x92\xf7N\xfb~\xce^u\x9fY\xb8\x94\x07\x01#\n\x88\xdd7\xe0.D#qpS"s\xaeV\xb6N}\xb7h^\xfb\xce\x80\x1e+3\x7f\xe4.\xad\xab\xb6+;\xeb\x8dGI\xad?\xe7\xaa\xe8!\x00\x00\xaaU' DEBUG:Timeout or exception in _send_receive() - retry 1/5 DEBUG:Timeout or exception in _send_receive() - retry 2/5 DEBUG:Timeout or exception in _send_receive() - retry 3/5 DEBUG:Timeout or exception in _send_receive() - retry 4/5 DEBUG:Timeout or exception in _send_receive() - retry 5/5 DEBUG:Timeout or exception in _send_receive() - retry 6/5 DEBUG:Exceeded tinytuya retry limit (5) DEBUG:ERROR Timeout Waiting for Device - 902 - payload: "Check device key or version"
`
I have attached the pcap of my mobile phone talking with the smart socket. Does this help you to understand the problem? The file type is not zipped, its a pcapng. I added the zip extension because otherwise github didnt allow me to upload the file. steckdose.pcapng.zip
Thanks for the pcap. I'm not an expert on pcaps, but I only see 3 devices here, 192.168.178.43 (Tuya device), 192.168.178.34 (Raspberry Pi) and 192.168.178.72 (unknown). The unknown device only sends ICMP messages, never any TCP conversations. I don't see the mobile phone talking with the Tuya device. Also, the address resolution (ARP) is providing TWO mac addresses for the IP address assigned to the Tuya device (.43) and TWO mac addresses for the unknown device IP (.72). This may all be a rabbit hole, but it does seem very odd and seems to cause redirections. More important, I don't see the traffic for your mobile phone.
Two ideas:
-
Do you have any other Tuya devices that are behaving the same way? It would be good to get a DEBUG trace for them as well.
-
I'm still stuck on the first DEBUG traces you first posted. The first one does not show the "unvalid" response but it does show in the 2nd one (no internet). The test I had your run above was to see if the device continued to send back "unvalid" which it did but TinyTuya kept adjusting for the device22 specifics. I added code to TinyTuya to disable detection. Pull the latest TinyTuya code from github and see if this makes a difference:
git clone https://github.com/jasonacox/tinytuya.git
cd tinytuya
# run your script in here to force the usage of the clone code instead of the PyPI version.
Script
import tinytuya
# tinytuya.set_debug(True)
d = tinytuya.OutletDevice('DEVICEID', 'DEVICEIP', 'DEVICEKEY')
d.set_version(3.3)
d.set_socketPersistent(True)
d.disabledetect = True # Disable auto-detection of device22
print(" > Send Request for Status < ")
payload = d.generate_payload(tinytuya.DP_QUERY)
d.send(payload)
print(" > Begin Monitor Loop <")
while(True):
# See if any data is available
data = d.receive()
print('Received Payload: %r' % data)
# Send keyalive heartbeat
print(" > Send Heartbeat Ping < ")
payload = d.generate_payload(tinytuya.HEART_BEAT)
d.send(payload)
@jasonacox
I have checked almost all your threads regarding Tuya Device via Zigbee Gateways. I have Gateway from LIDL (https://www.lidl.de/p/silvercrest-gateway-zigbee-smart-home/p100306596) and some Temperature & Humidity Sensors (https://www.aliexpress.com/item/1005004854419532.html?spm=a2g0o.order_list.order_list_main.5.5f951802BuIC5F) linked to Tuya account via this Gateway. I have tied every solution that you provided in the repo's issues but I couldn't find any solution for me. I just want to get temperature and humidity data from the sensors without using TinyTuya Cloud (my current solution).
I have executed the code in the comment bellow (https://github.com/jasonacox/tinytuya/issues/69#issuecomment-933088167) and this is the output:
python -m sensor_local.py
DEBUG:TinyTuya [1.9.1]
> Send Request for Status <
DEBUG:building command 10 payload=b'{"gwId":"bf26e5...9m2gu","devId":"bf26e5...9m2gu","uid":"bf26e5...9m2gu","t":"1673022042"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000010000000a0000007a7b2267774964223a226266323665353234616564346436626665396d326775222c226465764964223a226266323665353234616564346436626665396d326775222c22756964223a226266323665353234616564346436626665396d326775222c2274223a2231363733303232303432227d967f8f070000aa55'
> Begin Monitor Loop <
Received Payload: None
> Send Heartbeat Ping <
DEBUG:building command 9 payload=b'{"gwId":"bf26e5...9m2gu","devId":"bf26e5...9m2gu"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa00000002000000090000004a7b2267774964223a226266323665353234616564346436626665396d326775222c226465764964223a226266323665353234616564346436626665396d326775227d665593e10000aa55'
Received Payload: None
> Send Heartbeat Ping <
DEBUG:building command 9 payload=b'{"gwId":"bf26e5...9m2gu","devId":"bf26e5...9m2gu"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa00000003000000090000004a7b2267774964223a226266323665353234616564346436626665396d326775222c226465764964223a226266323665353234616564346436626665396d326775227d9a0b547c0000aa55'
Received Payload: None
> Send Heartbeat Ping <
DEBUG:building command 9 payload=b'{"gwId":"bf26e5...9m2gu","devId":"bf26e5...9m2gu"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa00000004000000090000004a7b2267774964223a226266323665353234616564346436626665396d326775222c226465764964223a226266323665353234616564346436626665396d326775227d0200086c0000aa55'
Received Payload: None
> Send Heartbeat Ping <
DEBUG:building command 9 payload=b'{"gwId":"bf26e5...9m2gu","devId":"bf26e5...9m2gu"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa00000005000000090000004a7b2267774964223a226266323665353234616564346436626665396d326775222c226465764964223a226266323665353234616564346436626665396d326775227dfe5ecff10000aa55'
Received Payload: None
> Send Heartbeat Ping <
DEBUG:building command 9 payload=b'{"gwId":"bf26e5...9m2gu","devId":"bf26e5...9m2gu"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa00000006000000090000004a7b2267774964223a226266323665353234616564346436626665396d326775222c226465764964223a226266323665353234616564346436626665396d326775227d21cc81170000aa55'
Received Payload: None
> Send Heartbeat Ping <
DEBUG:building command 9 payload=b'{"gwId":"bf26e5...9m2gu","devId":"bf26e5...9m2gu"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa00000007000000090000004a7b2267774964223a226266323665353234616564346436626665396d326775222c226465764964223a226266323665353234616564346436626665396d326775227ddd92468a0000aa55'
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 0/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 1/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 2/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 3/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 4/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 5/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, 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
Received Payload: {'Error': 'Unexpected Payload from Device', 'Err': '904', 'Payload': None}
> Send Heartbeat Ping <
DEBUG:building command 9 payload=b'{"gwId":"bf26e5...9m2gu","devId":"bf26e5...9m2gu"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa00000008000000090000004a7b2267774964223a226266323665353234616564346436626665396d326775222c226465764964223a226266323665353234616564346436626665396d326775227dcaab3f760000aa55'
Received Payload: None
> Send Heartbeat Ping <
DEBUG:building command 9 payload=b'{"gwId":"bf26e5...9m2gu","devId":"bf26e5...9m2gu"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa00000009000000090000004a7b2267774964223a226266323665353234616564346436626665396d326775222c226465764964223a226266323665353234616564346436626665396d326775227d36f5f8eb0000aa55'
Received Payload: None
> Send Heartbeat Ping <
DEBUG:building command 9 payload=b'{"gwId":"bf26e5...9m2gu","devId":"bf26e5...9m2gu"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa0000000a000000090000004a7b2267774964223a226266323665353234616564346436626665396d326775222c226465764964223a226266323665353234616564346436626665396d326775227de967b60d0000aa55'
Received Payload: None
> Send Heartbeat Ping <
DEBUG:building command 9 payload=b'{"gwId":"bf26e5...9m2gu","devId":"bf26e5...9m2gu"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa0000000b000000090000004a7b2267774964223a226266323665353234616564346436626665396d326775222c226465764964223a226266323665353234616564346436626665396d326775227d153971900000aa55'
Received Payload: None
> Send Heartbeat Ping <
DEBUG:building command 9 payload=b'{"gwId":"bf26e5...9m2gu","devId":"bf26e5...9m2gu"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa0000000c000000090000004a7b2267774964223a226266323665353234616564346436626665396d326775222c226465764964223a226266323665353234616564346436626665396d326775227d8d322d800000aa55'
^CDEBUG:Keyboard Interrupt - Exiting
Do you have any ideea what I have to try ?
@romicaiarca It's a Zigbee gateway and sensors? You need to create a "parent" device for the gateway itself and then attach the sensors as children: https://github.com/jasonacox/tinytuya/pull/226
@romicaiarca It's a Zigbee gateway and sensors? You need to create a "parent" device for the gateway itself and then attach the sensors as children: #226
@uzlonewolf , yes, they both are zigbee. The sensor is linked to the gateway via Tuya. I've used the code bellow:
import tinytuya
import time
# configure the parent device
gw = tinytuya.Device( ZIGBEE_GATEWAY_ID, address=ZIGBEE_GATEWAY_IP_ADDRESS, local_key=ZIGBEE_GATEWAY_LOCAL_KEY, persist=True, version=3.3 )
print('GW IP found:', gw.address, '- getting status')
# configure one or more children. Every dev_id must be unique!
zigbee1 = tinytuya.OutletDevice( THS_OFFICE, cid=THS_OFFICE, parent=gw )
# zigbee2 = tinytuya.OutletDevice( 'eb04...l', cid='0011223344556689', parent=gw )
print(zigbee1.status())
# print(zigbee2.status())
print(" > Begin Monitor Loop <")
pingtime = time.time() + 9
while(True):
if( pingtime <= time.time() ):
payload = gw.generate_payload(tinytuya.HEART_BEAT)
gw.send(payload)
pingtime = time.time() + 9
# receive from the gateway object to get updates for all sub-devices
print('recv:')
data = gw.receive()
print( data )
# data['device'] contains a reference to the device object
# if data and 'device' in data and data['device'] == zigbee1:
# print('toggling device state')
# time.sleep(1)
# if data['dps']['1']:
# data['device'].turn_off(nowait=True)
# else:
# data['device'].turn_on(nowait=True)
But it looks like I cannot connect to the gateway. This is the output:
❯ python -m sensor_local.py
DEBUG:TinyTuya [1.9.1]
GW IP found: 192.168.100.7 - getting status
DEBUG:status() entry (dev_type is zigbee)
DEBUG:building command 10 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf26...m2gu","uid":"bf26...m2gu","t":"1673037502","cid":"bf26...m2gu"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000010000000a000000a8b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc9d7df3c0230d9f79a9e3122b27f7b325dadb5761bd1e9b03f3d8905f5dfe615a905d40c5569f74a3eb5fe316fae8728bfbee443c15583998b1122927bc66ad6f87a72e9f708b4a8c3902690b2426b103939fe0ebc613bde071278664bc398515fbee443c15583998b1122927bc66ad6f0bb9a8490bb8f3ee825695be811d6d30e58c452c0000aa55'
DEBUG:Timeout in _send_receive() - retry 1 / 5
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000020000000a000000a8b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc9d7df3c0230d9f79a9e3122b27f7b325dadb5761bd1e9b03f3d8905f5dfe615a905d40c5569f74a3eb5fe316fae8728bfbee443c15583998b1122927bc66ad6f87a72e9f708b4a8c3902690b2426b103939fe0ebc613bde071278664bc398515fbee443c15583998b1122927bc66ad6f0bb9a8490bb8f3ee825695be811d6d30d090fdb50000aa55'
DEBUG:Timeout in _send_receive() - retry 2 / 5
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000030000000a000000a8b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc9d7df3c0230d9f79a9e3122b27f7b325dadb5761bd1e9b03f3d8905f5dfe615a905d40c5569f74a3eb5fe316fae8728bfbee443c15583998b1122927bc66ad6f87a72e9f708b4a8c3902690b2426b103939fe0ebc613bde071278664bc398515fbee443c15583998b1122927bc66ad6f0bb9a8490bb8f3ee825695be811d6d30754b97fd0000aa55'
DEBUG:Timeout in _send_receive() - retry 3 / 5
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000040000000a000000a8b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc9d7df3c0230d9f79a9e3122b27f7b325dadb5761bd1e9b03f3d8905f5dfe615a905d40c5569f74a3eb5fe316fae8728bfbee443c15583998b1122927bc66ad6f87a72e9f708b4a8c3902690b2426b103939fe0ebc613bde071278664bc398515fbee443c15583998b1122927bc66ad6f0bb9a8490bb8f3ee825695be811d6d30baa98c870000aa55'
DEBUG:Timeout in _send_receive() - retry 4 / 5
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000050000000a000000a8b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc9d7df3c0230d9f79a9e3122b27f7b325dadb5761bd1e9b03f3d8905f5dfe615a905d40c5569f74a3eb5fe316fae8728bfbee443c15583998b1122927bc66ad6f87a72e9f708b4a8c3902690b2426b103939fe0ebc613bde071278664bc398515fbee443c15583998b1122927bc66ad6f0bb9a8490bb8f3ee825695be811d6d301f72e6cf0000aa55'
DEBUG:Timeout in _send_receive() - retry 5 / 5
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000060000000a000000a8b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc9d7df3c0230d9f79a9e3122b27f7b325dadb5761bd1e9b03f3d8905f5dfe615a905d40c5569f74a3eb5fe316fae8728bfbee443c15583998b1122927bc66ad6f87a72e9f708b4a8c3902690b2426b103939fe0ebc613bde071278664bc398515fbee443c15583998b1122927bc66ad6f0bb9a8490bb8f3ee825695be811d6d302a6e5e560000aa55'
DEBUG:Timeout in _send_receive() - retry 6 / 5
DEBUG:Exceeded tinytuya retry limit (5)
DEBUG:ERROR Timeout Waiting for Device - 902 - payload: "Check device key or version"
DEBUG:status() received data={'Error': 'Timeout Waiting for Device', 'Err': '902', 'Payload': 'Check device key or version'}
{'Error': 'Timeout Waiting for Device', 'Err': '902', 'Payload': 'Check device key or version'}
> Begin Monitor Loop <
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000070000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c8499952573520000aa55'
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000080000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c8499e5e015690000aa55'
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000090000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c849981dc78e10000aa55'
recv:
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 0/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 1/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 2/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 3/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 4/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 5/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, 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
{'Error': 'Unexpected Payload from Device', 'Err': '904', 'Payload': None}
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa0000000a0000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c84992d98ce790000aa55'
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa0000000b0000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c849949a4a3f10000aa55'
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa0000000c0000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c8499ae60a5080000aa55'
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa0000000d0000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c8499ca5cc8800000aa55'
recv:
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 0/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 1/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 2/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 3/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 4/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 5/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, 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
{'Error': 'Unexpected Payload from Device', 'Err': '904', 'Payload': None}
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa0000000e0000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c849966187e180000aa55'
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa0000000f0000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c8499022413900000aa55'
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000100000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c84998792b26e0000aa55'
recv:
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 0/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 1/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 2/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 3/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 4/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 5/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, 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
{'Error': 'Unexpected Payload from Device', 'Err': '904', 'Payload': None}
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000110000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c8499e3aedfe60000aa55'
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000120000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c84994fea697e0000aa55'
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000130000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c84992bd604f60000aa55'
recv:
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 0/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 1/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 2/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 3/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 4/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 5/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, 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
{'Error': 'Unexpected Payload from Device', 'Err': '904', 'Payload': None}
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000140000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c8499cc12020f0000aa55'
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000150000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c8499a82e6f870000aa55'
recv:
None
recv:
None
DEBUG:building command 9 payload=b'{"gwId":"bf58...a4zgjr","devId":"bf58...a4zgjr"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000160000000900000058b3c2fe719c930ec59bdce0cc68e6f932fcbb313919ccb4f12dcd32db1d626efc975cc75edf288e52b986356af14ba4715b20d3cabfc2b3075f210ec30e97ad54b2feb204ec60f440286e58f41a1c8499046ad91f0000aa55'
recv:
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 0/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 1/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 2/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 3/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 4/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, in _recv_all
raise DecodeError('No data received - connection closed?')
tinytuya.core.DecodeError: No data received - connection closed?
DEBUG:_recv_all(): no data? b''
DEBUG:_recv_all(): no data? b''
DEBUG:Error decoding received data - read retry 5/5
Traceback (most recent call last):
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 716, 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
{'Error': 'Unexpected Payload from Device', 'Err': '904', 'Payload': None}
recv:
^CDEBUG:Keyboard Interrupt - Exiting
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 184, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 110, in _get_module_details
__import__(pkg_name)
File "/Users/romica.iarca/code/tinytuya/sensor_local.py", line 147, in <module>
data = gw.receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 1191, in receive
return self._send_receive(None)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 838, in _send_receive
rmsg = self._receive()
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 735, in _receive
data = self._recv_all(header_len+ret_end_len)
File "/Users/romica.iarca/code/tinytuya/tinytuya/core.py", line 710, in _recv_all
newdata = self.socket.recv(length)
KeyboardInterrupt
Not sure what is wrong with the devices or with the code that I'm trying to implement/adapt from the snippets from the issues in the repo.
Maybe the scan output can help you give me some advice
❯ python -m tinytuya scan
TinyTuya (Tuya device scanner) [1.9.1]
Scanning on UDP ports 6666 and 6667 for devices (15 retries)...
* Unexpected payload=%r
b'd8dc2a11c2\xb1I\xc1\xf4\x05"\xad\xceM*\xab\x17\r\x0b\x8c\x12\xd6r|\xdd\x98\xf6\xado\xd7\xe7\x1b\xe9\xac>\x16\xbfoEm\xf9\x9f\xa2$~6\xc0 .\x11S\xd2\x86#\xeb\xd1\x13\xa0\xdd\x14Y/\xee_-\xe6\x08\xbb\x19\xe5\xf7\x01B\x02\xfc\xe4)e3*\x99k\xf9\rx"\xdf\x84(f\x9f\xab?e\xab\x83\xd3\xfd\xd1\x05\xf7\x9a\xa3\x04\xc3\x08\xe2G\x9b\xcb\x9e\xdb\xf2\xea\xc4\x03\xf6\x1d\xeae*\xf7\x93\\\x9c\x1c\x825\x10\x9c\xd8\xff\xc1\x18z\xad\x94\xb0\xd4n\xf5\x87\x19\xfa\xcd\x12\xee\xfbt9\x89\x91\xd6\xfc\x0f\xf9P\xf3\x19\xf8\xed\x9ah\x08\x9a\xdesd\xad\xebg\x8f\x17\xa3'
Unknown v Device Product ID = [Unknown payload]:
Address = 192.168.100.7, Device ID = , Local Key = , Version = , MAC =
No Stats for 192.168.100.7: DEVICE KEY required to poll for status
* Unexpected payload=%r
b"a24b5b3a8e\xe3\x9a\xad\xa3\x9c\xda\x08\x8aJv\xf7=\xdf\x17\x9e^`\xfd\xacX\x87\xf6\x97X\x18\xac\xb3\x9a\xf3\xfc#\xb1M\x1e\x1agg\xe6\xd9:\x15\xa1\x81\xa2Gn\xb9\xc3_\x1a\x13\x9d\\\xf3\xc7\x9d\r\x82Z\xdf\xa1h\x1c,`\xbb\x92]\xfd\x1f\xc9\x9a\x83\xc6m\xf34\x7f\x80'6\t\xb4\x83\xa3\xf5\x94\xe6\xaf\x9d~\xd5\x8c\x88\x1f-\x93c\xbd\xceq\x83\xd8\x8bQ\x12\x02\xf0g\xfd\xbf%\x06O\x1bs,V\x9f\xd7\xfa\xd3\xf1i\x08,\xd1\xabNV\x85\xddpv\xe7\xd1\xb2\xba\xb3\x9d\x8bo*\x8cY\x97D;_\xc3\x86\xaed\xca\xa6B-\x02\xeb\xc2\xf1\xd6\xb3\xe3e\xf4K\xd1{"
* Unexpected payload=%r
b'22b5ab4742GV6\xfc\x19\xe9k\xd2$\xc9\x0b%9\x9fA\x80\xb2o\xa5S\xa0v\x93\xcf\x99\x92\x1f@\xf0.\x02\x00R\xea\xadQU\x9b\x8f\xaa\xfbr\xfej\xe2\xef$cEd?\xd4\x85`\x91\xbfe\xa2CqI\x1ddX\x08\x87r\x8e\xca\xd36:N\xffaM\x84)5\xc8\xf2\xfb\x04\xc1\xd9\xef\x99\xb2\x8bF\xb1\xfe\xa7Z\xedx\xafU\x11\x9d\\%oB\x80\x91\xb9O\x99tL\n I2\xbf\xec/\xf3\xd4I\xe6{\xf5S\xaa\x8b\xf2IGc\xd2\xc1\xd66\x11]\xca\xc9\x9f\x82\xf6\xe8\x9dx\xa1\x8e\t\x16^0\x7f\xa1\x0bp\xd6g\x04\xbci\x1a\x86\xba\x1a%\xa4*&\x95'
* Unexpected payload=%r
b'd579754188n\xd6\xf0\x80\xf3\xd3@-az\xe4\n\xae\xfe\x0f\xcb\r\x90\x95\x11\xd6p\x11j\xfe\xa3\x93\x81\x93\xcfvJYH\xea\xa4\xcah\x8b\xee\x7f\x82\xfc\x9e\xde\xf4o\x0e\x0c\x8e{\x8e\xcb\xe3\xb9\xb9\xe8\x0cU\xbb\xa6.\x9f\x9a\xdc\x0bg#r\xf1\xc7\x11\xa4\xf5\x15\x95r\xe6\xa8\xc1\x7f%\xa4w\xf7L\xbb$Y\x890D\x17\x80\xbc\xb9(\xb5,\xbf\xea\xa8\xaf\xae\xd7A/\xd1B#\x88`P\xa0\xfa\x13`\xd5Ij*Ra%l1_*Ze%.\xa2\x8d\xfe\xe8\xe96\xc0\x1fq"+\xba\xfb\xcc3\xda#\xd3 Q*`\x7fv\xe3\x8b\xf2`\x04\xfb\x8f:\x9d\xf0\'\x87\x84'
* Unexpected payload=%r
b'508cda41ceJ\xff\xb0Rq\xf4\x1a\xcdG\xa61S?\xb4\xde\xfcX\xd8\xac\xcd>c/\xab\x8d\x1e\x0f\x84\x11\xb9\x10\xda\xcf\xd5#l\xca\x97\xb3\xe4\x88\x82\xcf?\x87\xb3\xb5\x1d\x06\xc0\x80\xbc\x80aj\xdb\xe9\xe2W\xd6iX\xf7\x9b\x8c\x8e\x9f\xcf\xfdh^&\xae\xd2eU\x90\xae\xd5:0)\xcd$L\x9cR\xdf\x88/\xde\xa4z\xf34m\x83R\xca\xd3H/\xd9\x07\xa0w\xc0\xc6Bve\xcb\xff6\x0c@\xff,\xe1:r\x10\xd4/T\x13\xa4m4jr\xdf\xf9\x84\xf9\x0c\xc0!E\x10\x8fz\xba\xa5\x1e(\x1c\x80:\xf8\x87\xb2w\xb1k\xe28\xc5\xbeQH\xf8b\xf2 3\x9ds\x08'
* Unexpected payload=%r
b'bcefd26b7e^\xf5S%:\x1e\x89\x85L\xf9Dbg\xc4z\x94\xf1\x9e<\x1f\x07J%\x9b\xf5/V[@\x90\xec\xd082\x82\x9c\xf2\x93\x98\x9a\xff\x07O[\x89\x84\xac\x16\xae\xa0\xc7\xa7\x99\xc8\x9d\x8dW\xca\x14f}f\x8f\xb2\x8d\x8406o\xb4\xecS\xa4\xd1R^,\xfbm\xbd\xba\xe5k$\xfb\xfatZ\x84\xadk{<d\x15>\x16Q\x88np\x00\xd6~W\xc8z\xe7R[\xad&5\x00\xe0\xb2\xe7Y\xaa\t]\x8d\x05pw`M\xbf\x92\x00\xdb]\xa1\x0e\xf9\x8e\xc0\x99\x8a\x89\t!\xce\xd6G\xa1\x1d\xff|\xa1\xae\x1eS\xf7\xc6\xe4C!\xbaS;f\xb5\x9a\xf41+\xfb2'
* Unexpected payload=%r
b"480c2cb7d3\xb7F'\xc7N4q\xff;0\xe9\xaf\x05\x8ay)\xdbe\x82\x92\x1c[%\xb4\x85\x00\xa2\xbc\xbe\x19y\x8as>%\xee\x19\x80\xee\xab;\xd6\xd5\xae\xd4T\x11\xe6]M\xf0^\x13\xfaX\x80D\xdb\xed\xa1\xb10\x03m<\x81\xe5\x17\xb6\\\x9bYt\xb1\xdf*Y\xf2qR\xcc\xbb\xe1\xe6\x8b/\xf2\xde\x8a\xbf\x06\x0f\xcf\x0f\xe4\x03\xab/h\x0c\xaf\xf9\r\x1f\x10\x02\xe2\x18\x87\xb8\xf7\xa3\xb3\xf8\x8c>\xe8\xf9\x12\xe3j\xa3\xa5\x99\xa9H\x93\xb3\x14\x87l\xe2\xc2[\xd7N\xc0\x01\xbd\xd8\x80\x04<\xef\xc9\x10%\x04\x03\x13\x96hJ\x05w\x82\xc2\x8b\x8f\xe2\x85\x02\xd3\xce,\x96K\x90\xaa"
* Unexpected payload=%r
b'7d7c679954\xc1\xd7BEr\x03\x04T\xaa[\xf4\xc6f\x99\xbf\xd6@1\xb7Xx\x87\xd4&| ?8\xe3\x95M\xb0\x1e\xa6&\xa0\x93\x87\xe9r\n\xc7e\xcc\x8a\xc5<"\xfa\xf8K\x95\xb2\x04\x01Q\xd5\xa8\xe1\xdb+Bm\xe3\xd3\xd8\xd3\xc3u.\x83\xa8\x9f\xb7A\xcdg\xf8\xdf\x1e/$\xb4\xd0\x8e\x03\xae@]K\x91\xe4\xd6\x97CK\x10O\xfcw@X\x98zm$F[\xf4\xa0@\x10\x802%\x9b\x81B\x01V\xa5]\xd7`\xee\xcb\x9d\xb3i\x16\x8fd\xfef\x1b`\x01\xf8"\xdfSv\x93\xd84\x02\xf4\x83\x1f\xf7\x03|t\xdd\xe7\xbe\xb3]T\xc9!\xb94\x82^\x96\x9fU0'
Scan Complete! Found 1 devices.
>> Saving device snapshot data to snapshot.json
Thank you!
If you haven't already I'd try rebooting the gateway. Sometimes they get stuck in a weird state and need to be rebooted. Beyond that I'm not sure what else to try, that code looks correct.
I just saw your edit. That looks like a newer device which is not yet supported. Someone else had the exact same issue with a light bulb the other day https://github.com/jasonacox/tinytuya/issues/247
I just saw your edit. That looks like a newer device which is not yet supported. Someone else had the exact same issue with a light bulb the other day #247
@uzlonewolf, Is anything that I can do to help (please keep in mind that I don't have any hardware to get the dump from the gateway and/or sensor....)?
I had pretty much the same issue - Payload: none, Unexpected payload and 914: Check device key or version.
Fixed by upgrading to the latest Python (IMC 3.9.18), which apparently comes with newer versions of the AES crypto libraries used to decipher the payload.
An important note is that some devices (primarily light bulbs) identified their protocol version wrongly with Python 3.7 and below!
- One bulb was identifying as protocol version
3.3, but status only responded to version3.2. - The other two were posing as
3.4, but turned out to be3.5.
Hope that helps. Good luck!
@jasonacox and @uzlonewolf - Mad props, guys!