TuyaAPI / cli

🔧 A CLI for Tuya devices
MIT License
266 stars 43 forks source link

SET not workin #11

Closed TheItschi closed 5 years ago

TheItschi commented 5 years ago

Hi, I've bougth the folowing thermostat "https://de.aliexpress.com/item/16A-WiFi-Thermostat-mit-Touchscreen-LCD-Display-W-chentlich-Programmierbare-Temperatur-Controller-f-r-Home-Elektrische/32966148463.html". I can query some parameters with dps1..6 successful, but if I try to set e.g. the desired temperature I alwas get a timeout

C:\Users\Yavuz>tuya-cli set --ip 192.168.100.84 --id 308xxx --key IAYxxx --set 50.0 --dps 2 Error: Timeout waiting for response at Timeout._sendTimeout.setTimeout [as _onTimeout] (C:\Users\Yavuz\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\tuyapi\index.js:416:25) at ontimeout (timers.js:436:11) at tryOnTimeout (timers.js:300:5) at listOnTimeout (timers.js:263:5) at Timer.processTimers (timers.js:223:10)

What can I do?

Regards, TheItschi

codetheweb commented 5 years ago

Please run setx DEBUG * in your current shell to turn on debugging output, then run the set command again and post the output.

It would also be helpful if you posted the output of the get command.

TheItschi commented 5 years ago

Find below the result after "setx DEBUG *" command:

C:\Users\Yavuz>tuya-cli get --ip 192.168.100.84 --id 308xxx --key IAYxxx --dps 3 45

C:\Users\Yavuz>setx DEBUG *

ERFOLGREICH: Angegebener Wert wurde gespeichert.

C:\Users\Yavuz>tuya-cli set --ip 192.168.100.84 --id 308xxx --key IAYxxx --set 50 --dps 2 Error: Timeout waiting for response at Timeout._sendTimeout.setTimeout [as _onTimeout] (C:\Users\Yavuz\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\tuyapi\index.js:416:25) at ontimeout (timers.js:436:11) at tryOnTimeout (timers.js:300:5) at listOnTimeout (timers.js:263:5) at Timer.processTimers (timers.js:223:10)

Regards, TheItschi

TheItschi commented 5 years ago

After restarting the shell I finally get the debug output:

C:\Users\Yavuz>tuya-cli get --ip 192.168.100.84 --id 30801624bcddc28dbd2c --key IAYz2WK1th0cMLmL --dps 3 TuyAPI No IPs to search for +0ms TuyAPI Payload: { gwId: '30801624bcddc28dbd2c', devId: '30801624bcddc28dbd2c' } +16ms TuyAPI Send attempt 1 +0ms TuyAPI Sending this data: 000055aa000000000000000a000000467b2267774964223a223330383031363234626364646332386462643263222c226465764964223a223330383031363234626364646332386462643263227d000000000000aa55 +0ms TuyAPI Connect 192.168.100.84 +0ms TuyAPI Socket connected. +31ms TuyAPI Received data back: 192.168.100.84 +0ms TuyAPI 000055aa000000000000000a0000007a000000007b226465764964223a223330383031363234626364646332386462643263222c22647073223a7b2231223a747275652c2232223a34342c2233223a34372c2234223a2231222c2235223a66616c73652c2236223a66616c73652c22313032223a302c22313034223a747275657d7d0e66d9000000aa55 +0ms TuyAPI Data: 192.168.100.84 { devId: '30801624bcddc28dbd2c', dps: { '1': true, '2': 44, '3': 47, '4': '1', '5': false, '6': false, '102': 0, '104': true } } 10 +0ms TuyAPI Disconnect +0ms 47 TuyAPI Socket closed: 192.168.100.84 +16ms

C:\Users\Yavuz>tuya-cli set --ip 192.168.100.84 --id 30801624bcddc28dbd2c --key IAYz2WK1th0cMLmL --set 50 --dps 2 TuyAPI No IPs to search for +0ms TuyAPI Payload: 192.168.100.84 +7ms TuyAPI { devId: '30801624bcddc28dbd2c', TuyAPI uid: '', TuyAPI t: '1549307320', TuyAPI dps: { '2': 50 } } +0ms TuyAPI Send attempt 1 +7ms TuyAPI Sending this data: 000055aa000000000000000700000087332e313030396564366631373738343862316165495141527a74384c4a6a4a2f7370744e6338364251476f7a5463457374664a5853482f4a4f65594b4d4c755258635945536d513930687555744a392b3034626f6a5537557a5770464f794f65566d67336c584c57764776472b6b6b4b4a475a58366c6a41763833326c453d000000000000aa55 +0ms TuyAPI Connect 192.168.100.84 +0ms TuyAPI Socket connected. +31ms TuyAPI Socket closed: 192.168.100.84 +5s TuyAPI Send attempt 2 +1s TuyAPI Sending this data: 000055aa000000000000000700000087332e313030396564366631373738343862316165495141527a74384c4a6a4a2f7370744e6338364251476f7a5463457374664a5853482f4a4f65594b4d4c755258635945536d513930687555744a392b3034626f6a5537557a5770464f794f65566d67336c584c57764776472b6b6b4b4a475a58366c6a41763833326c453d000000000000aa55 +0ms TuyAPI Connect 192.168.100.84 +0ms TuyAPI Socket connected. +47ms TuyAPI Socket closed: 192.168.100.84 +5s TuyAPI Send attempt 3 +2s TuyAPI Sending this data: 000055aa000000000000000700000087332e313030396564366631373738343862316165495141527a74384c4a6a4a2f7370744e6338364251476f7a5463457374664a5853482f4a4f65594b4d4c755258635945536d513930687555744a392b3034626f6a5537557a5770464f794f65566d67336c584c57764776472b6b6b4b4a475a58366c6a41763833326c453d000000000000aa55 +0ms TuyAPI Connect 192.168.100.84 +0ms TuyAPI Socket connected. +47ms TuyAPI Socket closed: 192.168.100.84 +5s TuyAPI Send attempt 4 +2s TuyAPI Sending this data: 000055aa000000000000000700000087332e313030396564366631373738343862316165495141527a74384c4a6a4a2f7370744e6338364251476f7a5463457374664a5853482f4a4f65594b4d4c755258635945536d513930687555744a392b3034626f6a5537557a5770464f794f65566d67336c584c57764776472b6b6b4b4a475a58366c6a41763833326c453d000000000000aa55 +0ms TuyAPI Connect 192.168.100.84 +0ms TuyAPI Socket connected. +0ms TuyAPI Socket closed: 192.168.100.84 +5s TuyAPI Send attempt 5 +3s TuyAPI Sending this data: 000055aa000000000000000700000087332e313030396564366631373738343862316165495141527a74384c4a6a4a2f7370744e6338364251476f7a5463457374664a5853482f4a4f65594b4d4c755258635945536d513930687555744a392b3034626f6a5537557a5770464f794f65566d67336c584c57764776472b6b6b4b4a475a58366c6a41763833326c453d000000000000aa55 +31ms TuyAPI Connect 192.168.100.84 +0ms TuyAPI Socket connected. +16ms Error: Timeout waiting for response at Timeout._sendTimeout.setTimeout [as _onTimeout] (C:\Users\Yavuz\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\tuyapi\index.js:416:25) at ontimeout (timers.js:436:11) at tryOnTimeout (timers.js:300:5) at listOnTimeout (timers.js:263:5) at Timer.processTimers (timers.js:223:10) TuyAPI Socket closed: 192.168.100.84 +5s

TheItschi commented 5 years ago

Hm, sorry. I obviously made a mistake while extracting the local key. I didn't realize that it works without the locale key. Now it works fine with the correct locale key. Sorry for the confusion...

Regards, TheItschi

codetheweb commented 5 years ago

Glad you got it working.

As this seems to be a common problem, I'll add something about it to the issue template.