tuyaapi / cli Goto Github PK
View Code? Open in Web Editor NEW🔧 A CLI for Tuya devices
License: MIT License
🔧 A CLI for Tuya devices
License: MIT License
Waiting for request...error happened in proxy websocket: { Error: listen EADDRINUSE: address already in use :::8001
at Server.setupListenHandle [as _listen2] (net.js:1279:14)
at listenInCluster (net.js:1327:12)
at Server.listen (net.js:1414:7)
at async.series.tipText (/usr/local/lib/node_modules/anyproxy/proxy.js:205:32)
at /usr/local/lib/node_modules/anyproxy/node_modules/async/lib/async.js:607:21
at /usr/local/lib/node_modules/anyproxy/node_modules/async/lib/async.js:246:17
at iterate (/usr/local/lib/node_modules/anyproxy/node_modules/async/lib/async.js:146:13)
at /usr/local/lib/node_modules/anyproxy/node_modules/async/lib/async.js:157:25
at /usr/local/lib/node_modules/anyproxy/node_modules/async/lib/async.js:248:21
at /usr/local/lib/node_modules/anyproxy/node_modules/async/lib/async.js:612:34
at async.series.tipText (/usr/local/lib/node_modules/anyproxy/proxy.js:200:11)
at /usr/local/lib/node_modules/anyproxy/node_modules/async/lib/async.js:607:21
at /usr/local/lib/node_modules/anyproxy/node_modules/async/lib/async.js:246:17
at iterate (/usr/local/lib/node_modules/anyproxy/node_modules/async/lib/async.js:146:13)
at /usr/local/lib/node_modules/anyproxy/node_modules/async/lib/async.js:157:25
at /usr/local/lib/node_modules/anyproxy/node_modules/async/lib/async.js:248:21
I finally managed to get my Teckin SP21's added (just kept trying, eventually they gave in!), but tuya-cli doesn't work for these.
Making a PCAP, I saw them report their protocol version as 3.3, but when I do a 'get all' I get a 'json obj data unvalid' message, and when trying to SET, it just doesn't do anything...
GET -ALL Debug output:
DEBUG=* tuya-cli get --ip *.*.*.* --id bfc*** --key 03*** --protocol-version 3.3 --all
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to *.*.*.*... +11ms
TuyAPI Socket connected. +112ms
TuyAPI GET Payload: +2ms
TuyAPI { gwId: 'bfc***',
TuyAPI devId: 'bfc***' } +1ms
TuyAPI Received data: 000055aa000000010000000a0000002c0000000158755a82b6eb11619e162139da95a818055c1bdc615e06518fe1d302d7f51fff30e61fb40000aa55 +32ms
TuyAPI Parsed: +4ms
TuyAPI { payload: 'json obj data unvalid',
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 1 } +0ms
TuyAPI GET Payload: +3ms
TuyAPI { gwId: 'bfc***',
TuyAPI devId: 'bfc*** } +0ms
TuyAPI Received data: 000055aa000000020000000a0000002c0000000158755a82b6eb11619e162139da95a818055c1bdc615e06518fe1d302d7f51fff0f2d61210000aa55 +11ms
TuyAPI Parsed: +1ms
TuyAPI { payload: 'json obj data unvalid',
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 2 } +0ms
TuyAPI Disconnect +1ms
json obj data unvalid
TuyAPI Socket closed: *.*.*.* +4ms
SET Debug output:
DEBUG=* tuya-cli set --ip *.*.*.* --id bfc*** --key 03*** --protocol-version 3.3 --dps 1 --set 1
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to *.*.*.*... +11ms
TuyAPI Socket connected. +45ms
TuyAPI GET Payload: +2ms
TuyAPI { gwId: 'bfc***',
TuyAPI devId: 'bfc***' } +0ms
TuyAPI Received data: 000055aa000000010000000a0000002c0000000158755a82b6eb11619e162139da95a818055c1bdc615e06518fe1d302d7f51fff30e61fb40000aa55 +31ms
TuyAPI Parsed: +4ms
TuyAPI { payload: 'json obj data unvalid',
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 1 } +0ms
TuyAPI SET Payload: +3ms
TuyAPI { devId: 'bfc***',
TuyAPI gwId: 'bfc***',
TuyAPI uid: '',
TuyAPI t: 1582473299,
TuyAPI dps: { '1': 1 } } +1ms
TuyAPI Received data: 000055aa00000002000000070000000c0000000018cfc5da0000aa55 +74ms
TuyAPI Parsed: +0ms
TuyAPI { payload: false, leftover: false, commandByte: 7, sequenceN: 2 } +1ms
TuyAPI Got SET ack. +0ms
TuyAPI Pinging *.*.*.* +10s
TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +120ms
TuyAPI Parsed: +1ms
TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
TuyAPI Pong from *.*.*.* +1ms
TuyAPI Pinging *.*.*.* +10s
TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +41ms
TuyAPI Parsed: +0ms
TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +1ms
TuyAPI Pong from *.*.*.* +0ms
TuyAPI Pinging *.*.*.* +10s
TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +60ms
TuyAPI Parsed: +1ms
TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
TuyAPI Pong from *.*.*.* +1ms
^C
Anything I can send to help debugging this?
Hi,
I am getting the following error in Raspbian Stretch when I run npm commands after installing TuyaAPI/cli.
npm ERR! code E404
npm ERR! 404 Not found : @tuyapi/.AppleDouble
npm ERR! 404
npm ERR! 404 '@tuyapi/.AppleDouble' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404 1. name can no longer contain capital letters
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
The error goes if I remove TuyaApi/cli.
Any ideas what might be wrong?
Thanks.
Hi,
I tried to get my localkey with your code and I got this error...
Could you tell me what I did wrong?
thanks
Γ£û Device(s) failed to be registered!
GotError: getaddrinfo ENOTFOUND openapi.tuyabe.com
at onError (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/got/dist/source/request-as-event-emitter.js:140:29)
at handleRequest (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/got/dist/source/request-as-event-emitter.js:173:17)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:64:26) {
name: 'RequestError',
code: 'ENOTFOUND'
}
Missed in #20
Hi, trying to get this working with a bulb with firmware v1.0.5 (proto v3.3). I can set to true or false, as indicated by the DEBUG output, but the result from tuya-cli always shows "undefined". If I run the demo that toggles the state, it says it's changing from undefined to undefined.
$ DEBUG="" tuya-cli get --id 572757322cf432269a18
undefined
$ DEBUG="*" tuya-cli get --id 572757322cf432269a18
TuyAPI Finding missing IP undefined or ID 572757322cf432269a18 +0ms
TuyAPI Received UDP message. +5s
TuyAPI UDP data: +19ms
TuyAPI { payload:
TuyAPI { ip: '192.168.1.89',
TuyAPI gwId: '572757322cf432269a18',
TuyAPI active: 2,
TuyAPI ability: 0,
TuyAPI mode: 0,
TuyAPI encrypt: true,
TuyAPI productKey: '4kheilyfiyazqpda',
TuyAPI version: '3.3' },
TuyAPI leftover: false,
TuyAPI commandByte: 19,
TuyAPI sequenceN: 0 } +0ms
TuyAPI Connecting to 192.168.1.89... +32ms
TuyAPI Socket connected. +20ms
TuyAPI GET Payload: +3ms
TuyAPI { gwId: '572757322cf432269a18', devId: '572757322cf432269a18' } +0ms
TuyAPI Received data: 000055aa000000010000000a000000bc00000000fe69584f50dd7df21f8765abd18425e27a3d78dbf479ce5d3ace084aa1132bc9ba849c8af24ae0237ad75028dd11bd4ed7c56cddf42da77b2db53cdaeacf4ccb6de86f94d60f3ae2ad2744d586659d9299437d11cf73a3af152d937b64813e0e049fd318b3a663c94d6d26545626810779b1c6b3fa334a2cb6449a0663323408bcc3497c947c2b2707cbc479dac24032526a5600f7749f8ac3ef13a8f3b784d494ef07da10f101a9b678069c9c4cb5f4fc6408c80000aa55 +58ms
TuyAPI Parsed: +4ms
TuyAPI { payload:
TuyAPI { devId: '572757322cf432269a18',
TuyAPI dps:
TuyAPI { '20': true,
TuyAPI '21': 'white',
TuyAPI '22': 150,
TuyAPI '23': 188,
TuyAPI '24': '00180389003c',
TuyAPI '25': '04464602007803e803e800000000464602007803e8000a00000000' } },
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 1 } +0ms
TuyAPI GET Payload: +6ms
TuyAPI { gwId: '572757322cf432269a18', devId: '572757322cf432269a18' } +1ms
TuyAPI Received data: 000055aa0000000000000008000000cb00000000332e33000000000002e1c300000001fe69584f50dd7df21f8765abd18425e27a3d78dbf479ce5d3ace084aa1132bc9ba849c8af24ae0237ad75028dd11bd4ed7c56cddf42da77b2db53cdaeacf4ccb6de86f94d60f3ae2ad2744d586659d9299437d11cf73a3af152d937b64813e0e049fd318b3a663c94d6d26545626810779b1c6b3fa334a2cb6449a0663323408bcc3497c947c2b2707cbc479dac24032526a5600f7749f8ac3ef13a8f3b784d47ac807110577b79b17f844561dc469bed48876f80000aa55 +4ms
TuyAPI Parsed: +3ms
TuyAPI { payload:
TuyAPI { devId: '572757322cf432269a18',
TuyAPI dps:
TuyAPI { '20': true,
TuyAPI '21': 'white',
TuyAPI '22': 150,
TuyAPI '23': 188,
TuyAPI '24': '00180389003c',
TuyAPI '25': '04464602007803e803e800000000464602007803e8000a00000000' },
TuyAPI t: 94706 },
TuyAPI leftover: false,
TuyAPI commandByte: 8,
TuyAPI sequenceN: 0 } +0ms
TuyAPI Received data: 000055aa000000020000000a000000bc00000000fe69584f50dd7df21f8765abd18425e27a3d78dbf479ce5d3ace084aa1132bc9ba849c8af24ae0237ad75028dd11bd4ed7c56cddf42da77b2db53cdaeacf4ccb6de86f94d60f3ae2ad2744d586659d9299437d11cf73a3af152d937b64813e0e049fd318b3a663c94d6d26545626810779b1c6b3fa334a2cb6449a0663323408bcc3497c947c2b2707cbc479dac24032526a5600f7749f8ac3ef13a8f3b784d494ef07da10f101a9b678069c9c4cb5f4d69fe4e70000aa55 +44ms
TuyAPI Parsed: +1ms
TuyAPI { payload:
TuyAPI { devId: '572757322cf432269a18',
TuyAPI dps:
TuyAPI { '20': true,
TuyAPI '21': 'white',
TuyAPI '22': 150,
TuyAPI '23': 188,
TuyAPI '24': '00180389003c',
TuyAPI '25': '04464602007803e803e800000000464602007803e8000a00000000' } },
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 2 } +0ms
TuyAPI Disconnect +2ms
undefined
TuyAPI Socket closed: 192.168.1.89 +5ms
I'm trying to use "tuya-cli link-wizard".
I fill out all the information and eventually get a "Error: Timed out wating for device(s) to connect to cloud".
But, then I realized... the Tuya device is not connected to any network. How will tuyapi/cli or tuyapi/link communicate with it? Am I supposed to put the Tuya Device into AP mode and then connect to its WiFi SSID before attempting the link-wizard?
I know the Android Tuya app is able to register the device without it being in AP mode, but I also see the WiFi status of my Android device change as it's doing this. And, in looking over the code in tuyapi/link, I don't see any place where it's even attempting to do that. It's simply sending UDP packets to the broadcast address.
Please advise.
if I run tuya-cli list-app it only binds with ipv6
netstat -plnt
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:45789 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 17854/vino-server
tcp6 0 0 :::111 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 ::1:631 :::* LISTEN -
tcp6 0 0 :::8001 :::* LISTEN 18006/node
tcp6 0 0 :::8002 :::* LISTEN 18006/node
tcp6 0 0 :::36363 :::* LISTEN -
tcp6 0 0 :::5900 :::* LISTEN 17854/vino-server
Any advice for how to troubleshoot this step?
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:73:26)
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'broadcasthost' }```
My laptop is connected to the correct 2.4GHz network and I am using the iOS key and secret as instructed.
Hi, i'm unable to successfully run the tuya-cli get command. I've seen a couple similar issues, and i've read through all relevant issues, but nothing helped me resolve my issue. The device in question is Ihttps://www.aliexpress.com/item/4001045079168.html?. I was able to get the Key & ID using the Tuya Developer/IOT method and tuya-cli wizard. I've double checked, and my Key & ID are still active and accurate.
I've also pinged the device, and everything is nominal:
PING 192.168.1.29 (192.168.1.29): 56 data bytes
64 bytes from 192.168.1.29: icmp_seq=0 ttl=255 time=96.999 ms
64 bytes from 192.168.1.29: icmp_seq=1 ttl=255 time=46.313 ms
64 bytes from 192.168.1.29: icmp_seq=2 ttl=255 time=9.810 ms
64 bytes from 192.168.1.29: icmp_seq=3 ttl=255 time=21.714 ms
64 bytes from 192.168.1.29: icmp_seq=4 ttl=255 time=11.614 ms
64 bytes from 192.168.1.29: icmp_seq=5 ttl=255 time=9.481 ms
64 bytes from 192.168.1.29: icmp_seq=6 ttl=255 time=25.220 ms
64 bytes from 192.168.1.29: icmp_seq=7 ttl=255 time=9.805 ms
64 bytes from 192.168.1.29: icmp_seq=8 ttl=255 time=13.514 ms
64 bytes from 192.168.1.29: icmp_seq=9 ttl=255 time=12.034 ms
64 bytes from 192.168.1.29: icmp_seq=10 ttl=255 time=11.396 ms
Additionally, I ran nmap on the device's IP:
nmap -p 6668 192.168.1.29
Starting Nmap 7.70 ( https://nmap.org ) at 2020-08-31 03:48 PDT
Nmap scan report for 192.168.1.29
Host is up (0.53s latency).
PORT STATE SERVICE
6668/tcp open irc
Nmap done: 1 IP address (1 host up) scanned in 2.18 seconds
Here's the command i'm running. Note that I also tried forcing --protocol-version 3.0, 3.1, 3.2, 3.3 and 3.4 (I don't even know if all of these exist, I just wanted to try every possibility). The "x"s below are redacted, i'm using my actual ID and Key.
tuya-cli get --id REDACTED --key REDACTED --ip 192.168.1.29 --all
And here's the result:
(node:22824) UnhandledPromiseRejectionWarning: Error: Error from socket
at Socket. (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:350:30)
at Socket.emit (events.js:315:20)
at errorOrDestroy (internal/streams/destroy.js:108:12)
at onwriteError (_stream_writable.js:418:5)
at onwrite (_stream_writable.js:445:5)
at doWrite (_stream_writable.js:399:11)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at /usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:242:23
at new Promise ()
(node:22824) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 12)
(node:22824) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:22824) UnhandledPromiseRejectionWarning: Error: Error from socket
at Socket. (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:350:30)
at Socket.emit (events.js:315:20)
at errorOrDestroy (internal/streams/destroy.js:108:12)
at onwriteError (_stream_writable.js:418:5)
at onwrite (_stream_writable.js:445:5)
at doWrite (_stream_writable.js:399:11)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at /usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:242:23
at new Promise ()
(node:22824) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 14)
And here's the debug command (again, i've redacted the id and key):
DEBUG=* tuya-cli get --id REDACTED --key REDACTED --ip 192.168.1.29 --all
And the debug output (ID redacted):
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 192.168.1.29... +6ms
TuyAPI Socket connected. +278ms
TuyAPI GET Payload: +1ms
TuyAPI {
TuyAPI gwId: 'REDACTED',
TuyAPI devId: 'REDACTED',
TuyAPI t: 'REDACTED',
TuyAPI dps: {},
TuyAPI uid: 'REDACTED'
TuyAPI } +1ms
TuyAPI GET Payload: +9ms
TuyAPI {
TuyAPI gwId: 'REDACTED',
TuyAPI devId: 'REDACTED',
TuyAPI t: 'REDACTED',
TuyAPI dps: {},
TuyAPI uid: '31xxxxxxxxxxxxxxxdf8'
TuyAPI } +1ms
TuyAPI Error event from socket. 192.168.1.29 Error: write ECONNRESET
at afterWriteDispatched (internal/stream_base_commons.js:154:25)
at writeGeneric (internal/stream_base_commons.js:145:3)
at Socket._writeGeneric (net.js:786:11)
at Socket._write (net.js:798:8)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at /usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:242:23
at new Promise ()
at pRetry.retries (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:239:14) {
errno: 'ECONNRESET',
code: 'ECONNRESET',
syscall: 'write'
} +2ms
TuyAPI Socket closed: 192.168.1.29 +4ms
TuyAPI Error event from socket. 192.168.1.29 Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
at doWrite (_stream_writable.js:399:19)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at /usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:242:23
at new Promise ()
at pRetry.retries (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:239:14)
at RetryOperation._fn (/usr/lib/node_modules/@tuyapi/cli/node_modules/p-retry/index.js:41:18)
at Timeout._onTimeout (/usr/lib/node_modules/@tuyapi/cli/node_modules/retry/lib/retry_operation.js:81:10)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) {
code: 'ERR_STREAM_DESTROYED'
} +1s
TuyAPI Error event from socket. 192.168.1.29 Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
at doWrite (_stream_writable.js:399:19)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at /usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:242:23
at new Promise ()
at pRetry.retries (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:239:14)
at RetryOperation._fn (/usr/lib/node_modules/@tuyapi/cli/node_modules/p-retry/index.js:41:18)
at Timeout._onTimeout (/usr/lib/node_modules/@tuyapi/cli/node_modules/retry/lib/retry_operation.js:81:10)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) {
code: 'ERR_STREAM_DESTROYED'
} +2s
TuyAPI Error event from socket. 192.168.1.29 Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
at doWrite (_stream_writable.js:399:19)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at /usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:242:23
at new Promise ()
at pRetry.retries (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:239:14)
at RetryOperation._fn (/usr/lib/node_modules/@tuyapi/cli/node_modules/p-retry/index.js:41:18)
at Timeout._onTimeout (/usr/lib/node_modules/@tuyapi/cli/node_modules/retry/lib/retry_operation.js:81:10)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) {
code: 'ERR_STREAM_DESTROYED'
} +4s
TuyAPI Error event from socket. 192.168.1.29 Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
at doWrite (_stream_writable.js:399:19)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at /usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:242:23
at new Promise ()
at pRetry.retries (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:239:14)
at RetryOperation._fn (/usr/lib/node_modules/@tuyapi/cli/node_modules/p-retry/index.js:41:18)
at Timeout._onTimeout (/usr/lib/node_modules/@tuyapi/cli/node_modules/retry/lib/retry_operation.js:81:10)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) {
code: 'ERR_STREAM_DESTROYED'
} +8s
TuyAPI Error event from socket. 192.168.1.29 Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
at doWrite (_stream_writable.js:399:19)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at /usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:242:23
at new Promise ()
at pRetry.retries (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:239:14)
at RetryOperation._fn (/usr/lib/node_modules/@tuyapi/cli/node_modules/p-retry/index.js:41:18)
at Timeout._onTimeout (/usr/lib/node_modules/@tuyapi/cli/node_modules/retry/lib/retry_operation.js:81:10)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) {
code: 'ERR_STREAM_DESTROYED'
} +16s
(node:22853) UnhandledPromiseRejectionWarning: Error: Error from socket
at Socket. (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:350:30)
at Socket.emit (events.js:315:20)
at errorOrDestroy (internal/streams/destroy.js:108:12)
at onwriteError (_stream_writable.js:418:5)
at onwrite (_stream_writable.js:445:5)
at doWrite (_stream_writable.js:399:11)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at /usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:242:23
at new Promise ()
(node:22853) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 7)
(node:22853) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I'm a total loss here. Any help would be much appreciated.
Hi, I'm doing tuya-cli list-app and getting what looks like an SSL error, full output below. Never used node.js (or github issues, for that matter) before so forgive me if I'm doing something dumb here. Env is Windows-7 with Cygwin and windows Node.JS, floowed by "npm i @tuyapi/cli -g" which did work, and "tuya-cli help" does work. This env is because what I want to end up with is a "DOS" command to turn a couple things on and off -- which will be run by some christmas light show software every 10-15 minutes in the evenings.
It's also possible I just don't know how to use the software.
msturtz@griffin ~
$ DEBUG=* tuya-cli list-app
[AnyProxy Log][2018-11-25 15:36:34]: You can run anyproxy-ca
to generate one root CA and then re-run this command
(node:4292) UnhandledPromiseRejectionWarning: Error: root CA not found. Please run anyproxy-ca
to generate one first.
at new ProxyCore (C:\Users\msturtz\AppData\Roaming\npm\node_modules@tuyapi\cli\node_modules\anyproxy\proxy.js:82:13)
at new ProxyServer (C:\Users\msturtz\AppData\Roaming\npm\node_modules@tuyapi\cli\node_modules\anyproxy\proxy.js:321:5)
at listApp (C:\Users\msturtz\AppData\Roaming\npm\node_modules@tuyapi\cli\lib\list-app.js:27:22)
at Command.program.command.description.option.option.action.options (C:\Users\msturtz\AppData\Roaming\npm\node_modules@tuyapi\cli\cli.js:78:3)
at Command.listener (C:\Users\msturtz\AppData\Roaming\npm\node_modules@tuyapi\cli\node_modules\commander\index.js:315:8)
at Command.emit (events.js:182:13)
at Command.parseArgs (C:\Users\msturtz\AppData\Roaming\npm\node_modules@tuyapi\cli\node_modules\commander\index.js:654:12)
at Command.parse (C:\Users\msturtz\AppData\Roaming\npm\node_modules@tuyapi\cli\node_modules\commander\index.js:474:21)
at Object. (C:\Users\msturtz\AppData\Roaming\npm\node_modules@tuyapi\cli\cli.js:90:9)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
at startup (internal/bootstrap/node.js:285:19)
(node:4292) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4292) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
****At this point it doesn't return to the prompt until I hit ^C
Hi, I am trying to run get command with my tuya smart plug, but it seems that the result is somewhat corrupted or simply unreadable. Here's my tuya-cli arguments and the result
tuya-cli get --id XXXXXXX --key XXXXXXX --ip 192.168.100.51 --protocol-version 3.3 -a
�2Z-���6�ϩ�A���)��5U�YT���
And here's the result when on debug mode
DEBUG="*" tuya-cli get --id xxxxxxxxx --key xxxxxxxxxx --ip 192.168.100.51 --protocol-version 3.3 -a
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 192.168.100.51... +1ms
TuyAPI Socket connected. +7ms
TuyAPI GET Payload: +0ms
TuyAPI { gwId: 'xxxxxxxx',
TuyAPI devId: 'xxxxxxxxx',
TuyAPI t: '1605421150',
TuyAPI dps: {},
TuyAPI uid: 'xxxxxxx' } +0ms
TuyAPI GET Payload: +3ms
TuyAPI { gwId: 'xxxxxxx',
TuyAPI devId: 'xxxxxxx',
TuyAPI t: '1605421150',
TuyAPI dps: {},
TuyAPI uid: 'xxxxxxx' } +0ms
TuyAPI Received data: 000055aa000000010000000a0000002c00000001fd325a2dde10988236df7308cfa9b741daf8e829bbc3033555fb185954aa8796cfbc52220000aa55 +44ms
TuyAPI Parsed: +1ms
TuyAPI { payload: '�2Z-�\u0010��6�s\bϩ�A���)��\u00035U�\u0018YT���',
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 1 } +0ms
TuyAPI Received data: 000055aa000000020000000a0000002c00000001fd325a2dde10988236df7308cfa9b741daf8e829bbc3033555fb185954aa8796f0772cb70000aa55 +48ms
TuyAPI Parsed: +0ms
TuyAPI { payload: '�2Z-�\u0010��6�s\bϩ�A���)��\u00035U�\u0018YT���',
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 2 } +1ms
TuyAPI Disconnect +0ms
�2Z-���6�ϩ�A���)��5U�YT���
TuyAPI Socket closed: 192.168.100.51 +1ms
it would be very helpful to be able to check the status of outlets other than 1
Hello, I tried to get my devices Id/Key, and when running Tuya-cli wizard
, and entering the correct info from the Tuya website, I get this error
There was an issue fetching that device. Make sure your account is linked and the ID is correct.
I am using a RPI3 (Rapsian) on the latest version of this project.
Edit:
The devices I am trying to connect to, are Wi-Fi light bulbs.
I just tried the list-app
command, and was able to connect to the proxy with my phone. However I seem to have too many devices on my network, as the console only lists some of them, then ends with:
}, { name: 'Kitchen 5', id: '<REMOVED>', key: '<REMOVED>' }, ... 147 more items ]
Is there a way to write out the remaining 147?
Hello,
Thank you for your work on this. I have set this up and I'm able to get the devices status but when I try to set anything nothing happens. I'll execute the command and then... nothing. No error, no acknowledgment, nothing. I don't know what's going on. Here's the command I'm running and also a wireshark capture of the traffic to and from the device.
[jruth@localhost tuyapi]$ tuya-cli get --ip 10.0.0.225 --id 0320026868c63ac1b6fc --key KhmRHEepuxV8ALfR -a
{ devId: '0320026868c63ac1b6fc',
dps:
{ '1': true,
'2': 'white',
'3': 140,
'4': 113,
'5': '008c000078ff8c',
'6': '00ff0000000000',
'7': 'ffff320100ff00',
'8': 'ffff8003ff000000ff000000ff000000000000000000',
'9': 'ffff5001ff0000',
'10': 'ffff0505ff000000ff00ffff00ff00ff0000ff000000' } }
[jruth@localhost tuyapi]$ tuya-cli set --ip 10.0.0.225 --id 0320026868c63ac1b6fc --key KhmRHEepuxV8ALfR --dps 1 --set false
Any help is appreciated.
Hi!
In the experiment I used:
— iPhone Xs max (firmware 13.2.2)
— MacBook Pro (Mac OS Catalina 10.15.1), as an alternative to running tuya-cli
, also used Raspberry Pi 3B+ (Raspbian Debian Buster), Intel NUC (Debian Stretch).
— Tuya Smart application (installed on the iPhone)
— Multiple Tuya devices (mostly smart sockets)
After fulfilling all the necessary requirements, such as installing tuya-cli
, launching tuya-cli list-app
, downloading and installing a profile (certificate for iPhone), setting up the proxy for the specified tuya-cli
in the WiFi connection, I tried to open the Tuya Smart application and do a swipe down on the device list.
However, in the proxy, I see only “Waiting for request”. Nothing more. In the application itself, I get a network connection error. There were no firewalls or any other restrictions for network connection on tuya-cli
hosts.
Using the Burp program, I tried to see the addresses where the Tuya Smart application was making requests. I saw two addresses:
According to the application logic, calls to a1.tuyaeu.com should have been caught, but this did not happen.
What could be here?
Hello,
When I run "tuya-cli wizard" nothing happends:
PS E:\Fabian\My\Path> tuya-cli wizard
PS E:\Fabian\My\Path>
So I ran link instead of wizard:
tuya-cli link --api-key Access ID/Client ID --api-secret Access Secret/Client Secret--ssid MyWifiSSID --password MyWifiPassword
But I get the error:
{
code: 'SING_VALIDATE_FALED_4',
message: 'Permission validation failed 4'
}
Hello,
in the new Version i get an JSON Parse Error when i try to list my smartlife devices.
I have got an IPhone.
Here is the error :
SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at C:\Users\Andre\AppData\Roaming\npm\node_modules@tuyapi\cli\lib\list-app.js:28:23
at C:\Users\Andre\AppData\Roaming\npm\node_modules@tuyapi\cli\node_modules\http-mitm-proxy\lib\proxy.js:1047:12
at C:\Users\xxx\AppData\Roaming\npm\node_modules@tuyapi\cli\node_modules\async\dist\async.js:3110:16
at eachOfArrayLike (C:\Users\xxx\AppData\Roaming\npm\node_modules@tuyapi\cli\node_modules\async\dist\async.js:1069:9)
at eachOf (C:\Users\xxx\AppData\Roaming\npm\node_modules@tuyapi\cli\node_modules\async\dist\async.js:1117:5)
at Object.eachLimit (C:\Users\xxx\AppData\Roaming\npm\node_modules@tuyapi\cli\node_modules\async\dist\async.js:3172:5)
at Proxy._onResponseData (C:\Users\xxx\AppData\Roaming\npm\node_modules@tuyapi\cli\node_modules\http-mitm-proxy\lib\proxy.js:1046:9)
at ProxyFinalResponseFilter.write (C:\Users\xxx\AppData\Roaming\npm\node_modules@tuyapi\cli\node_modules\http-mitm-proxy\lib\proxy.js:875:11)
at IncomingMessage.ondata (_stream_readable.js:722:22)
I followed instructions to try and use this tool to link my devices and get their IDs (Intending to use it with homebridge)
However, I get errors around API permissions when running commands. In the Tuya web portal, I so see an "API settings" where seemingly you can apply for permissions, but it looks to be a manual approval (Mine are "Open")
Unsure if this is a new thing or not, or expected. Thanks!
is it possible to send command with the cli api ? like ON/OFF or even RGB for bulb
thanks
git clone
npm list --depth=0
ERR! peer dep missing: react@^0.14.0 || ^15.0.0, required by [email protected]
if global install is same.
hello,
today I tried to follow the "https://github.com/AMoo-Miki/homebridge-tuya-lan/wiki/Setup-Instructions" tutorial
at one point it asks us to use tuya-cli list-app to recover "id" and "key" to add in homebridge, at the time of installation tuya-cli and AnyProxy I had warning messages for trucks called "deprecated" but tuya-cliu and anyproxy it is all the same installed.
I started tuya-cli with port 3128 because I noticed that port 8001 was busy at home (app synology dsm)
I updated my page in the "tuya smart" app but nothing is displayed in the console... except the "Waiting for request..." which flickers but no other information that appears
can you help me?
Translated with www.DeepL.com/Translator
Hi
I am trying to install in a NUC with ubuntu 18.04 desktop and I am getting the following
Can someone advice what I should do. (I am a total noob in linux)
I tried
npm i @tuyapi/cli -g
and sudo npm i @tuyapi/cli -g
loadRequestedDeps ▌ ╢████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
loadDep:update-notifier → ▐ ╢████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
loadDep:got → get ▐ ╢████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
loadDep:type-fest → reque ▀ ╢████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
loadDep:type-fest → resol ▌ ╢████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
loadDep:type-fest → get ▐ ╢████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine @szmarczak/[email protected]: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
loadDep:defer-to-connect ▀ ╢████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
loadDep:through → resolve ▀ ╢█████████████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine [email protected]: wanted: {"node":">= 10"} (current: {"node":"8.10.0","npm":"3.5.2"})
npm ERR! Linux 5.4.0-51-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i" "@tuyapi/cli" "-g"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! code EMISSINGARG
npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror http://github.com/npm/npm/issues
... you can use it like:
Rule:
module.exports = function(callback) {
return {
summary: 'Catch Tuya Data from Response',
*beforeSendResponse(requestDetail, responseDetail) {
const body = responseDetail.response.body.toString('utf8');
if (body.includes('tuya.m.my.group.device.list')) {
try {
const response = JSON.parse(body);
}
catch (err) {
return null;
}
callback(response);
return null;
}
},
*beforeDealHttpsRequest(requestDetail) {
return requestDetail.host.includes('tuya');
}
};
};
And in main file:
rule: require('./lib/anyproxy-rule.js')(resonse => { ... }),
When running:
DEBUG=* tuya-cli get --ip 192.168.1.XXX --id ******************* --key ******************* -a
I get this response:
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 192.168.1.XXX... +29ms
TuyAPI Socket connected. +32ms
TuyAPI GET Payload: +8ms
TuyAPI { gwId: ''*******************',',
TuyAPI devId: ''*******************',' } +1ms
TuyAPI Received data: ******************************************************** +174ms
TuyAPI Parsed: +18ms
TuyAPI { payload: 'parse data error',
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 1 } +1ms
TuyAPI GET Payload: +8ms
TuyAPI { gwId: '*******************',
TuyAPI devId: '*******************', } +1ms
TuyAPI Received data: ******************************************************** +134ms
TuyAPI Parsed: +4ms
TuyAPI { payload: 'parse data error',
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 2 } +1ms
TuyAPI Disconnect +4ms
parse data error
TuyAPI Socket closed: 192.168.1.XXX +8ms
It keeps throwing parse data error
.
does the tuya-cli mock option only simulate a socket device? or can it simulate another type of device?
When --set false
reaches
Line 69 in 1cb3bfb
Number.isNaN("false")
evaluates to false
, so the conditional passes and the option set
property becomes the result of Number.parseInt("false", 10)
, which is NaN
, which has no effect when the device receives it.
A fix is to check for the acceptable string values first, then fall back to Number.parseInt
.
Hi, @codetheweb.
I have a device configured correctly in my Tuya App.
But when I try to use tuya-cli for connect with it, I get the next message:
DEBUG=* tuya-cli get --ip 192.168.100.120 --id xxxxxxxxx --key yyyyyyyyy --all
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 192.168.100.120... +3ms
Error: connection timed out
at Socket.client.setTimeout (/root/.nvm/versions/node/v8.12.0/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:292:18)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at Socket.emit (events.js:208:7)
at Socket._onTimeout (net.js:422:8)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)
TuyAPI Socket closed: 192.168.100.120 +5s
Can you give some hints?
Regards
This is weird, I have 4 smart plugs from the same vendor, Awow. All for work without issue via my phone, all 4 work via the TUYA API, but one keeps reporting error from socket messages over and over, even though it actually works. Any idea why this is the case?
I'm using most recent Master and am getting an the following error. My outlets are definitely 3.3 btw.
tuya-cli get --ip 192.168.x.x --id ID HERE --key KEY HERE --protocol-version 3.3 --all
gives:
internal/crypto/cipher.js:173
const ret = this[kHandle].final();
^
Error: error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length
at Decipheriv.final (internal/crypto/cipher.js:173:29)
at TuyaCipher.decrypt (C:\Users\Matt\AppData\Roaming\npm\node_modules@tuyapi\cli\node_modules\t
uyapi\lib\cipher.js:65:24)
at Socket.client.on.data (C:\Users\Matt\AppData\Roaming\npm\node_modules@tuyapi\cli\node_module
s\tuyapi\index.js:345:39)
at Socket.emit (events.js:193:13)
at addChunk (_stream_readable.js:296:12)
at readableAddChunk (_stream_readable.js:277:11)
at Socket.Readable.push (_stream_readable.js:232:10)
at TCP.onStreamRead (internal/stream_base_commons.js:150:17)
@codetheweb
I got reports on my side tht the proxy is no longer working with the most uptodate Handy apps. I also can reproduce that with the most current iOS App (3.10.1) :-(
Can you reproduce that or is it still working for you?
Charles Proxy is still working ...
This does not seem 100% repeatable
I have just updated my npm and apt-get upgrade then updated tuyaapi/cli
tuya-cli -V
1.13.3
$ npm -v
5.8.0
I ran this command yesterday many times and it worked fine turning on and off a power strip socket, except for consecutive identical commands (iRayanKhan/homebridge-tuya#116)
$ DEBUG=* tuya-cli set --ip '10.0.0.212' --id 73328546dc4f22eb3795 --key 153e749667XXXXXX --dps 1 --set 1
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 10.0.0.212... +11ms
TuyAPI Socket connected. +147ms
TuyAPI GET Payload: +2ms
TuyAPI { gwId: '73328546dc4f22eb3795',
TuyAPI devId: '73328546dc4f22eb3795',
TuyAPI t: '1595467267',
TuyAPI dps: {},
TuyAPI uid: '73328546dc4f22eb3795' } +1ms
TuyAPI SET Payload: +19ms
TuyAPI { devId: '73328546dc4f22eb3795',
TuyAPI gwId: '73328546dc4f22eb3795',
TuyAPI uid: '',
TuyAPI t: 1595467267,
TuyAPI dps: { '1': 1 } } +1ms
TuyAPI Error event from socket. 10.0.0.212 { Error: write EPIPE
at WriteWrap.afterWrite [as oncomplete] (net.js:789:14) errno: 'EPIPE', code: 'EPIPE', syscall: 'write' } +11ms
events.js:174
throw er; // Unhandled 'error' event
^
Error: Error from socket
at Socket.client.on.err (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:350:30)
at Socket.emit (events.js:198:13)
at errorOrDestroy (internal/streams/destroy.js:107:12)
at onwriteError (_stream_writable.js:436:5)
at onwrite (_stream_writable.js:461:5)
at _destroy (internal/streams/destroy.js:49:7)
at Socket._destroy (net.js:614:3)
at Socket.destroy (internal/streams/destroy.js:37:8)
at WriteWrap.afterWrite [as oncomplete] (net.js:791:10)
Emitted 'error' event at:
at Socket.client.on.err (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:350:16)
at Socket.emit (events.js:198:13)
[... lines matching original stack trace ...]
at WriteWrap.afterWrite [as oncomplete] (net.js:791:10)
I tried this syntax, just in case there was a change "--set True", did not work
$ DEBUG=* tuya-cli set --ip '10.0.0.212' --id 73328546dc4f22eb3795 --key 153e749667XXXXXX --dps 1 --set True
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 10.0.0.212... +10ms
TuyAPI Socket connected. +160ms
TuyAPI GET Payload: +2ms
TuyAPI { gwId: '73328546dc4f22eb3795',
TuyAPI devId: '73328546dc4f22eb3795',
TuyAPI t: '1595467301',
TuyAPI dps: {},
TuyAPI uid: '73328546dc4f22eb3795' } +0ms
TuyAPI SET Payload: +20ms
TuyAPI { devId: '73328546dc4f22eb3795',
TuyAPI gwId: '73328546dc4f22eb3795',
TuyAPI uid: '',
TuyAPI t: 1595467300,
TuyAPI dps: { '1': true } } +0ms
TuyAPI Error event from socket. 10.0.0.212 { Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:111:27) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' } +120ms
events.js:174
throw er; // Unhandled 'error' event
^
Error: Error from socket
at Socket.client.on.err (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:350:30)
at Socket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Socket.client.on.err (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:350:16)
at Socket.emit (events.js:198:13)
[... lines matching original stack trace ...]
at process._tickCallback (internal/process/next_tick.js:63:19)
Decided to check repeatability for turning off a socket
This looks like the error from (iRayanKhan/homebridge-tuya#116)
$ DEBUG=* tuya-cli set --ip '10.0.0.212' --id 73328546dc4f22eb3795 --key 153e74966XXXXXXX --dps 1 --set 0
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 10.0.0.212... +10ms
TuyAPI Socket connected. +300ms
TuyAPI GET Payload: +2ms
TuyAPI { gwId: '73328546dc4f22eb3795',
TuyAPI devId: '73328546dc4f22eb3795',
TuyAPI t: '1595468555',
TuyAPI dps: {},
TuyAPI uid: '73328546dc4f22eb3795' } +0ms
TuyAPI SET Payload: +20ms
TuyAPI { devId: '73328546dc4f22eb3795',
TuyAPI gwId: '73328546dc4f22eb3795',
TuyAPI uid: '',
TuyAPI t: 1595468554,
TuyAPI dps: { '1': 0 } } +1ms
TuyAPI Received data: 000055aa000000010000000a00000064000000007b226465764964223a223733333238353436646334663232656233373935222c22647073223a7b2231223a66616c73652c2232223a747275652c2233223a747275652c2239223a302c223130223a302c223131223a307d7d9a0cfe410000aa55 +12ms
TuyAPI Parsed: +4ms
TuyAPI { payload:
TuyAPI { devId: '73328546dc4f22eb3795',
TuyAPI dps:
TuyAPI { '1': false, '2': true, '3': true, '9': 0, '10': 0, '11': 0 } },
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 1 } +1ms
TuyAPI Received data: 000055aa00000002000000070000000c0000000018cfc5da0000aa55 +14ms
TuyAPI Parsed: +1ms
TuyAPI { payload: false, leftover: false, commandByte: 7, sequenceN: 2 } +0ms
TuyAPI Got SET ack. +1ms
TuyAPI Pinging 10.0.0.212 +10s
TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +2s
TuyAPI Parsed: +1ms
TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
TuyAPI Pong from 10.0.0.212 +1ms
TuyAPI Pinging 10.0.0.212 +8s
TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +16ms
TuyAPI Parsed: +0ms
TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +1ms
TuyAPI Pong from 10.0.0.212 +1ms
^C
Tried to check repeatability turning on a wifi power strip socket
$ DEBUG=* tuya-cli set --ip '10.0.0.212' --id 73328546dc4f22eb3795 --key 153e749667097341 --dps 1 --set 1
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 10.0.0.212... +11ms
TuyAPI Socket connected. +28ms
TuyAPI GET Payload: +3ms
TuyAPI { gwId: '73328546dc4f22eb3795',
TuyAPI devId: '73328546dc4f22eb3795',
TuyAPI t: '1595468591',
TuyAPI dps: {},
TuyAPI uid: '73328546dc4f22eb3795' } +0ms
TuyAPI SET Payload: +19ms
TuyAPI { devId: '73328546dc4f22eb3795',
TuyAPI gwId: '73328546dc4f22eb3795',
TuyAPI uid: '',
TuyAPI t: 1595468591,
TuyAPI dps: { '1': 1 } } +1ms
TuyAPI Received data: 000055aa000000010000000a00000064000000007b226465764964223a223733333238353436646334663232656233373935222c22647073223a7b2231223a66616c73652c2232223a747275652c2233223a747275652c2239223a302c223130223a302c223131223a307d7d9a0cfe410000aa55 +15ms
TuyAPI Parsed: +7ms
TuyAPI { payload:
TuyAPI { devId: '73328546dc4f22eb3795',
TuyAPI dps:
TuyAPI { '1': false, '2': true, '3': true, '9': 0, '10': 0, '11': 0 } },
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 1 } +0ms
TuyAPI Received data: 000055aa00000002000000070000000c0000000018cfc5da0000aa55 +12ms
TuyAPI Parsed: +1ms
TuyAPI { payload: false, leftover: false, commandByte: 7, sequenceN: 2 } +0ms
TuyAPI Got SET ack. +1ms
TuyAPI Received data: 000055aa00000000000000080000008b00000000332e313430633634646362646363313531386545444a74713576434e7a646c66632b2f627766477133474d4130684d7a4b4d56625a6f4262536d2f6b4a2b5367335a56436d2b562f62506348766b416c41347251616b43676535414d4c336a335273455466486f4c6334504d3967763677322b6858374775734a42556b733d2b1663320000aa55 +54ms
TuyAPI Parsed: +1ms
TuyAPI { payload:
TuyAPI { devId: '73328546dc4f22eb3795',
TuyAPI dps: { '1': true },
TuyAPI t: 1595468590,
TuyAPI s: 7 },
TuyAPI leftover: false,
TuyAPI commandByte: 8,
TuyAPI sequenceN: 0 } +1ms
TuyAPI Disconnect +2ms
Set succeeded.
TuyAPI Socket closed: 10.0.0.212 +8ms
Wait -- this worked, perhaps this is not going to be repeatable?
Now I am running without error. I can no longer repeat the problem.
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
Hey
when running list-app the response is intercepted, my zigbee gateway shows both and ID and Key, but the attached devices only show the ID and have key: undefined. I've also done some response
Bug is repeatable
I tried to run the tuya-cli get command and an error occured and a message was thrown: Update available 1.13.0 → 1.13.3
I Just performed a apt-get upgrade then updated my npm i @tuyapi/cli -g
$ tuya-cli -V
1.13.3
$ npm -v
5.8.0
I was able to do use tuya-cli get yesterday no problem.
$ DEBUG=* tuya-cli get --ip '10.0.0.212' --id 73328546dc4f22eb3795 --key 153e749667XXXXXX -a
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 10.0.0.212... +11ms
TuyAPI Socket connected. +24ms
TuyAPI GET Payload: +3ms
TuyAPI { gwId: '73328546dc4f22eb3795',
TuyAPI devId: '73328546dc4f22eb3795',
TuyAPI t: '1595466643',
TuyAPI dps: {},
TuyAPI uid: '73328546dc4f22eb3795' } +0ms
TuyAPI GET Payload: +20ms
TuyAPI { gwId: '73328546dc4f22eb3795',
TuyAPI devId: '73328546dc4f22eb3795',
TuyAPI t: '1595466643',
TuyAPI dps: {},
TuyAPI uid: '73328546dc4f22eb3795' } +0ms
TuyAPI Error event from socket. 10.0.0.212 { Error: write EPIPE
at WriteWrap.afterWrite [as oncomplete] (net.js:789:14) errno: 'EPIPE', code: 'EPIPE', syscall: 'write' } +7ms
events.js:174
throw er; // Unhandled 'error' event
^
Error: Error from socket
at Socket.client.on.err (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:350:30)
at Socket.emit (events.js:198:13)
at errorOrDestroy (internal/streams/destroy.js:107:12)
at onwriteError (_stream_writable.js:436:5)
at onwrite (_stream_writable.js:461:5)
at _destroy (internal/streams/destroy.js:49:7)
at Socket._destroy (net.js:614:3)
at Socket.destroy (internal/streams/destroy.js:37:8)
at WriteWrap.afterWrite [as oncomplete] (net.js:791:10)
Emitted 'error' event at:
at Socket.client.on.err (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:350:16)
at Socket.emit (events.js:198:13)
[... lines matching original stack trace ...]
at WriteWrap.afterWrite [as oncomplete] (net.js:791:10)
pi@raspberrypi:~ $
pi@raspberrypi:~ $
pi@raspberrypi:~ $ DEBUG=* tuya-cli get --ip '10.0.0.212' --id 73328546dc4f22eb3795 --key 153e749667XXXXXX -a
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 10.0.0.212... +11ms
TuyAPI Socket connected. +21ms
TuyAPI GET Payload: +3ms
TuyAPI { gwId: '73328546dc4f22eb3795',
TuyAPI devId: '73328546dc4f22eb3795',
TuyAPI t: '1595466680',
TuyAPI dps: {},
TuyAPI uid: '73328546dc4f22eb3795' } +1ms
TuyAPI GET Payload: +21ms
TuyAPI { gwId: '73328546dc4f22eb3795',
TuyAPI devId: '73328546dc4f22eb3795',
TuyAPI t: '1595466680',
TuyAPI dps: {},
TuyAPI uid: '73328546dc4f22eb3795' } +0ms
TuyAPI Error event from socket. 10.0.0.212 { Error: write EPIPE
at WriteWrap.afterWrite [as oncomplete] (net.js:789:14) errno: 'EPIPE', code: 'EPIPE', syscall: 'write' } +6ms
events.js:174
throw er; // Unhandled 'error' event
^
Error: Error from socket
at Socket.client.on.err (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:350:30)
at Socket.emit (events.js:198:13)
at errorOrDestroy (internal/streams/destroy.js:107:12)
at onwriteError (_stream_writable.js:436:5)
at onwrite (_stream_writable.js:461:5)
at _destroy (internal/streams/destroy.js:49:7)
at Socket._destroy (net.js:614:3)
at Socket.destroy (internal/streams/destroy.js:37:8)
at WriteWrap.afterWrite [as oncomplete] (net.js:791:10)
Emitted 'error' event at:
at Socket.client.on.err (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:350:16)
at Socket.emit (events.js:198:13)
[... lines matching original stack trace ...]
at WriteWrap.afterWrite [as oncomplete] (net.js:791:10)
I am trying to get data from a device but tuya-cli does not seem to work. This is what I have tried so far:
tuya-cli get --id xxxxx --key xxxxx --ip 192.168.1.7 --all
This is not returning anything. Absolutely nothing.
Then I tried only this:
tuya-cli get --id xxxxx --key xxxxx --all
Response: Error: find() timed out. Is the device powered on and the ID or IP correct?
Then I tried PING 192.168.1.7 and got response from the device.
Last I tried this:
tuya-cli get --id xxxxxx --key xxxxx --ip 192.168.1.7 ----protocol-version 3.3
Response: true
What am I missing and why am I not getting the correct response?
Hi,
`pi@DomoticZ:~ 03:04 $ DEBUG=* tuya-cli link --api-key xxx --api-secret xxx --schema xxx --ssid xxx --password xxx --region eu
⠼ Registering devices(s)... @tuyapi/link:wizard Token: { region: 'EU', secret: 'BiTa', token: 'j1TssaEQ' } +0ms
@tuyapi/link:manual Sending SmartLink initialization packets +0ms
@tuyapi/link:wizard Polling cloud for details on token... +17ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +289ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +202ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +183ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +253ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +194ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +200ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +191ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +183ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +253ms
⠏ Registering devices(s)... @tuyapi/link:manual Sending SmartLink data packets +2s
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +206ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +198ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +185ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +183ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +190ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +268ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +197ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +250ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +186ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +267ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +245ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +194ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +258ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +206ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +280ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +194ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +265ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +199ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +207ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +252ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +245ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +186ms
⠇ Registering devices(s)... @tuyapi/link:manual Finished sending packets. +5s
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +248ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +180ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +247ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +187ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +251ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +252ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +189ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +259ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +270ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +190ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +196ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +189ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +246ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +244ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +245ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +253ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +264ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +191ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +193ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +207ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +275ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +195ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +287ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +216ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +266ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +269ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +275ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +194ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +194ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +212ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +211ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +246ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +182ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +260ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +190ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +265ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +265ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +202ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +193ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +266ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +198ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +240ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +245ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +182ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +268ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +260ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +192ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +198ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +207ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +253ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +189ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +249ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +248ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +178ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +181ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +242ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +265ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +188ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +266ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +189ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +191ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +267ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +264ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +258ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +263ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +189ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +192ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +190ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +260ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +178ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +241ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +247ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +197ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +190ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +257ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +259ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +197ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +262ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +265ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +276ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +268ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +189ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +276ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +265ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +279ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +184ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +183ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +243ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +261ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +202ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +266ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +194ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +268ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +189ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +246ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +180ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +193ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +277ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +245ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +178ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +186ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +185ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +196ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +269ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +202ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +241ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +182ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +259ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +186ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +241ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +243ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +269ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +190ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +262ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +195ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +259ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +255ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +246ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +241ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +255ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +190ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +188ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +180ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +183ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +181ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +265ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +261ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +259ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +265ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +181ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +243ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +184ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +189ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +263ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +269ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +197ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +262ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +259ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +264ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +257ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +185ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +181ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +187ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +250ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +178ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +242ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +239ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +257ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +258ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +270ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +196ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +258ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +267ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +187ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +258ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +259ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +193ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +195ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +259ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +265ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +190ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +259ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +188ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +195ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +257ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +187ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +266ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +265ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +257ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +255ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +264ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +188ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +189ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +262ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +187ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +192ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +260ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +192ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +186ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +256ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +266ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +189ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +260ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +261ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +275ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +245ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +180ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +188ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +189ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +188ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +178ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +181ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +178ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +259ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +197ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +225ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +189ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +253ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +252ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +258ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +188ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +189ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +266ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +257ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +261ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +275ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +260ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +190ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +187ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +268ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +259ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +190ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +262ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +189ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +265ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +188ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +262ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +241ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +180ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +181ms
⠴ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +263ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +185ms
⠋ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +259ms
⠸ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +264ms
⠦ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +187ms
⠇ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +186ms
⠙ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +242ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +247ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +248ms
⠏ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +189ms
⠹ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +200ms
⠼ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +224ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +193ms
⠧ Registering devices(s)... @tuyapi/link:wizard 0 devices returned by API. +830ms
✖ Device(s) failed to be registered!
Error: Timed out waiting for devices to connect.
at TuyaLinkWizard.linkDevice (/usr/lib/node_modules/@tuyapi/cli/node_modules/@tuyapi/link/index.js:117:17)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async link (/usr/lib/node_modules/@tuyapi/cli/lib/link.js:47:19)`
The device is a Wifi outdoor Plug (2 plugs in one), worked well with smart life android app.
I created an account on IoT Tuya, process has changed a bit (Cloud API Authorization has been upgraded to SaaS Development Platform), but I have access ID and access Secret, so should it be ok ?
Hey i keep getting this? You know what to do?
root@raspberrypi:~# tuya-cli get --ip 192.168.178.59 --id 03462186ecfabc3331a3 --key 9b8cf008fb86040f -a
events.js:182
throw er; // Unhandled 'error' event
^
Error: Error from socket
at Socket.client.on.err (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:365:30)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
Hi,
I tried to install tuya-cli on my Lede router. installation went fine but when I try to launch it I receive this error. Any advice?
Regards.
Pino.
`tuya-cli
internal/util.js:214
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'original', 'function');
^
TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type function
at Object.promisify (internal/util.js:214:11)
at Object. (/usr/lib/node_modules/@tuyapi/cli/node_modules/got/dist/source/get-response.js:8:25)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/usr/lib/node_modules/@tuyapi/cli/node_modules/got/dist/source/request-as-event-emitter.js:13:24)
`
Hi,
Facing an issue with some new LED Strip Controllers. Originally bought these expecting to find an ESP inside to flash with Tasmota, but they use a W600 chip that rules that out...
Version of TuyAPI is 5.3.1.
I noted some similar issues (#23, #64), however all of those seemed to be resolved with protocol changes and some time ago - so wondering if this is yet another new protocol or similar...
Example Set commands:
DEBUG=* tuya-cli set --ip 192.168.2.Z --id XXXXX --key YYYYY --protocol-version 3.3 --dps 1 --set 1
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 192.168.2.Z... +11ms
TuyAPI Socket connected. +59ms
TuyAPI GET Payload: +1ms
TuyAPI {
TuyAPI gwId: 'XXXXX',
TuyAPI devId: 'XXXXX',
TuyAPI t: '1595491332',
TuyAPI dps: {},
TuyAPI uid: 'XXXXX'
TuyAPI } +0ms
TuyAPI SET Payload: +12ms
TuyAPI {
TuyAPI devId: 'XXXXX',
TuyAPI gwId: 'XXXXX',
TuyAPI uid: '',
TuyAPI t: 1595491331,
TuyAPI dps: { '1': 1 }
TuyAPI } +0ms
TuyAPI Received data: 000055aa000000010000000a0000002c000000011fd12f2145a2b4e48d0bc6f78454ef31ce04d93fc98d24d84e47a9045c13e0bd73b5e0ba0000aa55 +7ms
TuyAPI Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('json obj data unvalid')
TuyAPI at TuyaDevice.emit (events.js:304:17)
TuyAPI at Socket.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:318:22)
TuyAPI at Socket.emit (events.js:315:20)
TuyAPI at addChunk (_stream_readable.js:295:12)
TuyAPI at readableAddChunk (_stream_readable.js:271:9)
TuyAPI at Socket.Readable.push (_stream_readable.js:212:10)
TuyAPI at TCP.onStreamRead (internal/stream_base_commons.js:186:23) +4ms
events.js:292
throw er; // Unhandled 'error' event
^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('json obj data unvalid')
at TuyaDevice.emit (events.js:304:17)
at Socket.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:318:22)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at Socket.Readable.push (_stream_readable.js:212:10)
at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
Emitted 'error' event on TuyaDevice instance at:
at Socket.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:334:18)
at Socket.emit (events.js:315:20)
[... lines matching original stack trace ...]
at TCP.onStreamRead (internal/stream_base_commons.js:186:23) {
code: 'ERR_UNHANDLED_ERROR',
context: 'json obj data unvalid'
}
DEBUG=* tuya-cli set --ip 192.168.2.Z --id XXXXX --key YYYYY --protocol-version 3.2 --dps 1 --set 1
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 192.168.2.Z... +6ms
TuyAPI Socket connected. +111ms
TuyAPI GET Payload: +2ms
TuyAPI {
TuyAPI gwId: 'XXXXX',
TuyAPI devId: 'XXXXX',
TuyAPI t: '1595491352',
TuyAPI dps: {},
TuyAPI uid: 'XXXXX'
TuyAPI } +0ms
TuyAPI SET Payload: +9ms
TuyAPI {
TuyAPI devId: 'XXXXX',
TuyAPI gwId: 'XXXXX',
TuyAPI uid: '',
TuyAPI t: 1595491352,
TuyAPI dps: { '1': 1 }
TuyAPI } +1ms
TuyAPI Received data: 000055aa000000010000000a0000002c00000001341e53faf713cd68b0675c61c34f2a87a6efc804260729dec5b4d916506bdcf4c31a296e0000aa55 +22ms
TuyAPI Parsed: +2ms
TuyAPI {
TuyAPI payload: 'parse data error',
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 1
TuyAPI } +0ms
TuyAPI Received data: 000055aa00000002000000070000002c00000001341e53faf713cd68b0675c61c34f2a87a6efc804260729dec5b4d916506bdcf42f0215500000aa55 +15ms
TuyAPI Parsed: +0ms
TuyAPI {
TuyAPI payload: 'parse data error',
TuyAPI leftover: false,
TuyAPI commandByte: 7,
TuyAPI sequenceN: 2
TuyAPI } +0ms
TuyAPI Pinging 192.168.2.36 +10s
TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +35ms
TuyAPI Parsed: +1ms
TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
TuyAPI Pong from 192.168.2.Z +1ms
TuyAPI Pinging 192.168.2.Z +10s
TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +51ms
TuyAPI Parsed: +1ms
TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
TuyAPI Pong from 192.168.2.Z +1ms
TuyAPI Pinging 192.168.2.Z +10s
TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +5ms
TuyAPI Parsed: +1ms
TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
TuyAPI Pong from 192.168.2.Z +1ms
TuyAPI Pinging 192.168.2.Z +10s
TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +97ms
TuyAPI Parsed: +1ms
TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
TuyAPI Pong from 192.168.2.Z +0ms
TuyAPI Pinging 192.168.2.Z +10s
TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +111ms
TuyAPI Parsed: +1ms
TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
TuyAPI Pong from 192.168.2.Z +1ms
TuyAPI Pinging 192.168.2.Z +10s
TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +29ms
TuyAPI Parsed: +1ms
TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
TuyAPI Pong from 192.168.2.Z +0ms
^C
Example Get Command
DEBUG=* tuya-cli get --ip 192.168.2.X --id XXXXX --key YYYYY --protocol-version 3.3 --all
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 192.168.2.Z... +6ms
TuyAPI Socket connected. +72ms
TuyAPI GET Payload: +1ms
TuyAPI {
TuyAPI gwId: 'XXXXX',
TuyAPI devId: 'XXXXX',
TuyAPI t: '1595490890',
TuyAPI dps: {},
TuyAPI uid: 'XXXXX'
TuyAPI } +0ms
TuyAPI GET Payload: +12ms
TuyAPI {
TuyAPI gwId: 'XXXXX',
TuyAPI devId: 'XXXXX',
TuyAPI t: '1595490890',
TuyAPI dps: {},
TuyAPI uid: 'XXXXX'
TuyAPI } +0ms
TuyAPI Received data: 000055aa000000010000000a0000002c000000011fd12f2145a2b4e48d0bc6f78454ef31ce04d93fc98d24d84e47a9045c13e0bd73b5e0ba0000aa55 +6ms
TuyAPI Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('json obj data unvalid')
TuyAPI at TuyaDevice.emit (events.js:304:17)
TuyAPI at Socket.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:318:22)
TuyAPI at Socket.emit (events.js:315:20)
TuyAPI at addChunk (_stream_readable.js:295:12)
TuyAPI at readableAddChunk (_stream_readable.js:271:9)
TuyAPI at Socket.Readable.push (_stream_readable.js:212:10)
TuyAPI at TCP.onStreamRead (internal/stream_base_commons.js:186:23) +4ms
events.js:292
throw er; // Unhandled 'error' event
^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('json obj data unvalid')
at TuyaDevice.emit (events.js:304:17)
at Socket.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:318:22)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at Socket.Readable.push (_stream_readable.js:212:10)
at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
Emitted 'error' event on TuyaDevice instance at:
at Socket.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:334:18)
at Socket.emit (events.js:315:20)
[... lines matching original stack trace ...]
at TCP.onStreamRead (internal/stream_base_commons.js:186:23) {
code: 'ERR_UNHANDLED_ERROR',
context: 'json obj data unvalid'
}
Had this working a few weeks ago, but is now throwing exceptions left and right. First it was this:
/usr/local/lib/node_modules/@tuyapi/cli/node_modules/got/dist/source/create.js:101
got.paginate = async function* (url, options) {
^
SyntaxError: Unexpected token *
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/got/dist/source/index.js:7:18)
So I removed the offending asterick from the code, now it is throwing this on ANY tuya-cli command (even just the simple -h flag):
/usr/local/lib/node_modules/@tuyapi/cli/node_modules/got/dist/source/create.js:120
yield item;
^^^^^
SyntaxError: Unexpected strict mode reserved word
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/got/dist/source/index.js:7:18)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
What gives? Am I just missing something dumb? I'm running Node.js version 10.19.0, but tried it on versions 8 and 9 as well.
I have a Tuya-based color bulb I'm trying to control. Using tuya-cli, I can read data just fine when specifying either IP or ID but not both. When I specify both, the command never returns and I have to ^C. Under debug, it seems to be receiving and parsing a message but not parsing it correctly.
When I compare the raw message in DEBUG output with that from a run with only --id specified, it appears to be the same length and content except for 40 bytes near the end (around offset 0x186) and a couple of bytes at offset 3A (a counter?).
$ DEBUG="*" tuya-cli get --id 572757322cf432269a18 --ip 192.168.1.89 --dps 20
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 192.168.1.89... +13ms
TuyAPI Socket connected. +16ms
TuyAPI GET Payload: +3ms
TuyAPI { gwId: '572757322cf432269a18', devId: '572757322cf432269a18' } +1ms
TuyAPI Received data: 000055aa0000000000000008000000cb00000000332e330000000000000e2500000001fe69584f50dd7df21f8765abd18425e27a3d78dbf479ce5d3ace084aa1132bc9ba849c8af24ae0237ad75028dd11bd4ed7c56cddf42da77b2db53cdaeacf4ccb8b7a8b09204c5c3eeed78dfc1d1db1a1c90cabb671c5bf556719e56b00102bf34a5a924273ba412e6074022c8476360a4b85daeed87ad730859440a79e512e4c5182d7902e58731f7e8ec11aa54dcd2c1acac006eaa0530c1ddec9c419c9da63d7b7721cd382c7577057b53eef9460c9133b52030000aa55 +176ms
TuyAPI Parsed: +10ms
TuyAPI { payload:
TuyAPI '3.3\u0000\u0000\u0000\u0000\u0000\u0000\u000e%\u0000\u0000\u0000\u0001�iXOP�}�\u001f�e�ф%�z=x��y�]:�\bJ�\u0013+ɺ����J�#z�P(�\u0011�N��l��-�{-�<���Lˋz�\t L\\>��\u001d\u001d���\f��qſUg\u0019�k\u0000\u0010+�JZ�Bs�A.`t\u0002,�v6\nK����z�0��@��Q.LQ�א.Xs\u001f~��\u001a�M�,\u001a��\u0006�S\f\u001d���\u0019��cr\u001cӂ�WpW�>�`�',
TuyAPI leftover: false,
TuyAPI commandByte: 8,
TuyAPI sequenceN: 0 } +0ms
TuyAPI Received data: 000055aa0000000000000008000000cb00000000332e330000000000000e2600000001fe69584f50dd7df21f8765abd18425e27a3d78dbf479ce5d3ace084aa1132bc9ba849c8af24ae0237ad75028dd11bd4ed7c56cddf42da77b2db53cdaeacf4ccb8b7a8b09204c5c3eeed78dfc1d1db1a1c90cabb671c5bf556719e56b00102bf34a5a924273ba412e6074022c8476360a4b85daeed87ad730859440a79e512e4c5182d7902e58731f7e8ec11aa54dcd2c1acac006eaa0530c1ddec9c419c9da63e934f2de4d411a8642d9b13d67c23439dae9472f0000aa55 +501ms
TuyAPI Parsed: +2ms
TuyAPI { payload:
TuyAPI '3.3\u0000\u0000\u0000\u0000\u0000\u0000\u000e&\u0000\u0000\u0000\u0001�iXOP�}�\u001f�e�ф%�z=x��y�]:�\bJ�\u0013+ɺ����J�#z�P(�\u0011�N��l��-�{-�<���Lˋz�\t L\\>��\u001d\u001d���\f��qſUg\u0019�k\u0000\u0010+�JZ�Bs�A.`t\u0002,�v6\nK����z�0��@��Q.LQ�א.Xs\u001f~��\u001a�M�,\u001a��\u0006�S\f\u001d���\u0019��c�4��MA\u001a�Bٱ=g�49',
TuyAPI leftover: false,
TuyAPI commandByte: 8,
TuyAPI sequenceN: 0 } +1ms
Compare a run without --ip:
$ DEBUG="*" tuya-cli get --id 572757322cf432269a18 --dps 20
TuyAPI Finding missing IP undefined or ID 572757322cf432269a18 +0ms
TuyAPI Received UDP message. +1s
TuyAPI UDP data: +19ms
TuyAPI { payload:
TuyAPI { ip: '192.168.1.89',
TuyAPI gwId: '572757322cf432269a18',
TuyAPI active: 2,
TuyAPI ability: 0,
TuyAPI mode: 0,
TuyAPI encrypt: true,
TuyAPI productKey: '4kheilyfiyazqpda',
TuyAPI version: '3.3' },
TuyAPI leftover: false,
TuyAPI commandByte: 19,
TuyAPI sequenceN: 0 } +1ms
TuyAPI Connecting to 192.168.1.89... +31ms
TuyAPI Socket connected. +21ms
TuyAPI GET Payload: +3ms
TuyAPI { gwId: '572757322cf432269a18', devId: '572757322cf432269a18' } +1ms
TuyAPI Received data: 000055aa000000010000000a000000bc00000000fe69584f50dd7df21f8765abd18425e27a3d78dbf479ce5d3ace084aa1132bc9ba849c8af24ae0237ad75028dd11bd4ed7c56cddf42da77b2db53cdaeacf4ccb8b7a8b09204c5c3eeed78dfc1d1db1a1c90cabb671c5bf556719e56b00102bf34a5a924273ba412e6074022c8476360a4b85daeed87ad730859440a79e512e4c5182d7902e58731f7e8ec11aa54dcd2c1acac006eaa0530c1ddec9c419c9da63223dcfd6b378904d1afac9d5548743b4a9c700340000aa55 +59ms
TuyAPI Parsed: +4ms
TuyAPI { payload:
TuyAPI { devId: '572757322cf432269a18',
TuyAPI dps:
TuyAPI { '20': true,
TuyAPI '21': 'white',
TuyAPI '22': 150,
TuyAPI '23': 44,
TuyAPI '24': '00180389003c',
TuyAPI '25': '04464602007803e803e800000000464602007803e8000a00000000' } },
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 1 } +0ms
TuyAPI GET Payload: +5ms
TuyAPI { gwId: '572757322cf432269a18', devId: '572757322cf432269a18' } +1ms
TuyAPI Received data: 000055aa0000000000000008000000cb00000000332e330000000000000e7600000001fe69584f50dd7df21f8765abd18425e27a3d78dbf479ce5d3ace084aa1132bc9ba849c8af24ae0237ad75028dd11bd4ed7c56cddf42da77b2db53cdaeacf4ccb8b7a8b09204c5c3eeed78dfc1d1db1a1c90cabb671c5bf556719e56b00102bf34a5a924273ba412e6074022c8476360a4b85daeed87ad730859440a79e512e4c5182d7902e58731f7e8ec11aa54dcd2c1acac006eaa0530c1ddec9c419c9da63301a2a50ba9c84b8e0158053d2fb298ca57c68510000aa55 +4ms
TuyAPI Parsed: +1ms
TuyAPI { payload:
TuyAPI { devId: '572757322cf432269a18',
TuyAPI dps:
TuyAPI { '20': true,
TuyAPI '21': 'white',
TuyAPI '22': 150,
TuyAPI '23': 44,
TuyAPI '24': '00180389003c',
TuyAPI '25': '04464602007803e803e800000000464602007803e8000a00000000' },
TuyAPI t: 1861 },
TuyAPI leftover: false,
TuyAPI commandByte: 8,
TuyAPI sequenceN: 0 } +0ms
TuyAPI Received data: 000055aa000000020000000a000000bc00000000fe69584f50dd7df21f8765abd18425e27a3d78dbf479ce5d3ace084aa1132bc9ba849c8af24ae0237ad75028dd11bd4ed7c56cddf42da77b2db53cdaeacf4ccb8b7a8b09204c5c3eeed78dfc1d1db1a1c90cabb671c5bf556719e56b00102bf34a5a924273ba412e6074022c8476360a4b85daeed87ad730859440a79e512e4c5182d7902e58731f7e8ec11aa54dcd2c1acac006eaa0530c1ddec9c419c9da63223dcfd6b378904d1afac9d5548743b4833cec1b0000aa55 +48ms
TuyAPI Parsed: +1ms
TuyAPI { payload:
TuyAPI { devId: '572757322cf432269a18',
TuyAPI dps:
TuyAPI { '20': true,
TuyAPI '21': 'white',
TuyAPI '22': 150,
TuyAPI '23': 44,
TuyAPI '24': '00180389003c',
TuyAPI '25': '04464602007803e803e800000000464602007803e8000a00000000' } },
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 2 } +0ms
TuyAPI Disconnect +2ms
true
TuyAPI Socket closed: 192.168.1.89 +5ms
At present tuya-cli wizard
outputs an object like
[
{
name: 'Kitchen 1',
id: '00000000000000000000',
key: 'aaaaaaaaaaaaaaaa'
},
{
name: 'Kitchen 2',
id: '00000000000000000000',
key: 'aaaaaaaaaaaaaaaa'
}
]
but it would be far more useful to have it print out valid JSON instead (e.g. homebridge wants this JSON, tedious for >5 devices) like
[
{
"name": "Kitchen 1",
"id": "00000000000000000000",
"key": "aaaaaaaaaaaaaaaa"
},
{
"name": "Kitchen 2",
"id": "00000000000000000000",
"key": "aaaaaaaaaaaaaaaa"
}
]
The fix is simple, at wizard.js ~ line 93
from
console.log(devices.map(device => ({name: device.name, id: device.id, key: device.local_key})));
to
let devs = devices.map(device => ({name: device.name, id: device.id, key: device.local_key}))
console.log(JSON.stringify(devs, null, 2));
or something similar
Network Error in Smart Life App when trying to refresh devices with the proxy
when I run the command : tuya-cli set --id xxxxxxx --key tuya --set false xxxxx it could take up to 10 second before the light turn off...
Setting up the cert file and installing it on the iPhone of a friend worked fine. But as soon as I try to open the app, I get the following error:
_tls_common.js:88
c.context.setCert(options.cert);
^
Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
at Object.createSecureContext (_tls_common.js:88:17)
at Server (_tls_wrap.js:805:25)
at new Server (https.js:54:14)
at Object.createServer (https.js:76:10)
at Proxy._createHttpsServer (/usr/lib/node_modules/@tuyapi/cli/node_modules/http-mitm-proxy/lib/proxy.js:106:27)
at /usr/lib/node_modules/@tuyapi/cli/node_modules/http-mitm-proxy/lib/proxy.js:493:16
at /usr/lib/node_modules/@tuyapi/cli/node_modules/async/dist/async.js:473:16
at processQueue (/usr/lib/node_modules/@tuyapi/cli/node_modules/async/dist/async.js:1578:20)
at taskComplete (/usr/lib/node_modules/@tuyapi/cli/node_modules/async/dist/async.js:1601:9)
at /usr/lib/node_modules/@tuyapi/cli/node_modules/async/dist/async.js:1625:17
I have tried to make a new cert file and have repeated the same process a few times, but always with the same result.
Maybe the app or device firmware is too new?
Can someone help me with this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.