Closed leoheck closed 2 years ago
This is also happening on a second device, a circuit breaker.
➜ DEBUG=* ./cli.js get --ip 192.168.86.242 --id [ID] --key [KEY] --full
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 192.168.86.242... +2ms
TuyAPI Socket connected. +80ms
TuyAPI GET Payload: +0ms
TuyAPI {
TuyAPI gwId: '[ID]',
TuyAPI devId: '[ID]',
TuyAPI t: '1633919430',
TuyAPI dps: {},
TuyAPI uid: '[ID]'
TuyAPI } +0ms
TuyAPI Received data: 000055aa000000010000000a0000002c00000001bf0726de796c6ba96eab0c936f3fa9de7eb60fccd5698769a9d13e2d94499ccd696796660000aa55 +30ms
TuyAPI Parsed: +1ms
TuyAPI {
TuyAPI payload: '�\u0007&�ylk�n�\f�o?��~�\u000f��i�i��>-�I��',
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 1
TuyAPI } +0ms
TuyAPI Received DATA packet +1ms
TuyAPI Disconnect +0ms
�&�ylk�n�
�o?��~���i�i��>-�I��
TuyAPI Socket closed: 192.168.86.242 +1ms
Maybe my issue is the version 3.3
TuyAPI Received UDP message. +2s
TuyAPI UDP data: +1ms
TuyAPI {
TuyAPI payload: {
TuyAPI ip: '192.168.86.41',
TuyAPI gwId: 'ID',
TuyAPI active: 2,
TuyAPI ablilty: 0,
TuyAPI encrypt: true,
TuyAPI productKey: 'KEY',
TuyAPI version: '3.3'
TuyAPI },
TuyAPI leftover: false,
TuyAPI commandByte: 19,
TuyAPI sequenceN: 0
TuyAPI } +0ms
TuyAPI Received UDP message. +1ms
TuyAPI UDP data: +0ms
TuyAPI {
TuyAPI payload: {
TuyAPI ip: '192.168.86.41',
TuyAPI gwId: 'ID',
TuyAPI active: 2,
TuyAPI ablilty: 0,
TuyAPI encrypt: true,
TuyAPI productKey: 'KEY',
TuyAPI version: '3.3'
TuyAPI },
TuyAPI leftover: false,
TuyAPI commandByte: 19,
TuyAPI sequenceN: 0
TuyAPI } +0ms
TuyAPI Received UDP message. +2s
TuyAPI UDP data: +0ms
TuyAPI {
TuyAPI payload: {
TuyAPI ip: '192.168.86.242',
TuyAPI gwId: 'eb8aaaaefcc7d62c9fhg2c',
TuyAPI active: 2,
TuyAPI ablilty: 0,
TuyAPI encrypt: true,
TuyAPI productKey: 'KEY',
TuyAPI version: '3.3'
TuyAPI },
TuyAPI leftover: false,
TuyAPI commandByte: 19,
TuyAPI sequenceN: 0
TuyAPI } +0ms
TuyAPI Received UDP message. +1ms
TuyAPI UDP data: +0ms
TuyAPI {
TuyAPI payload: {
TuyAPI ip: '192.168.86.242',
TuyAPI gwId: 'eb8aaaaefcc7d62c9fhg2c',
TuyAPI active: 2,
TuyAPI ablilty: 0,
TuyAPI encrypt: true,
TuyAPI productKey: 'KEY',
TuyAPI version: '3.3'
TuyAPI },
TuyAPI leftover: false,
TuyAPI commandByte: 19,
TuyAPI sequenceN: 0
TuyAPI } +0ms
TuyAPI Received UDP message. +3s
TuyAPI UDP data: +0ms
TuyAPI {
TuyAPI payload: {
TuyAPI ip: '192.168.86.41',
TuyAPI gwId: 'ID',
TuyAPI active: 2,
TuyAPI ablilty: 0,
TuyAPI encrypt: true,
TuyAPI productKey: 'KEY',
TuyAPI version: '3.3'
TuyAPI },
TuyAPI leftover: false,
TuyAPI commandByte: 19,
TuyAPI sequenceN: 0
TuyAPI } +0ms
TuyAPI Received UDP message. +0ms
TuyAPI UDP data: +1ms
TuyAPI {
TuyAPI payload: {
TuyAPI ip: '192.168.86.41',
TuyAPI gwId: 'ID',
TuyAPI active: 2,
TuyAPI ablilty: 0,
TuyAPI encrypt: true,
TuyAPI productKey: 'KEY',
TuyAPI version: '3.3'
TuyAPI },
TuyAPI leftover: false,
TuyAPI commandByte: 19,
TuyAPI sequenceN: 0
TuyAPI } +0ms
TuyAPI Received UDP message. +2s
TuyAPI UDP data: +0ms
TuyAPI {
TuyAPI payload: {
TuyAPI ip: '192.168.86.242',
TuyAPI gwId: 'eb8aaaaefcc7d62c9fhg2c',
TuyAPI active: 2,
TuyAPI ablilty: 0,
TuyAPI encrypt: true,
TuyAPI productKey: 'KEY',
TuyAPI version: '3.3'
TuyAPI },
TuyAPI leftover: false,
TuyAPI commandByte: 19,
TuyAPI sequenceN: 0
TuyAPI } +0ms
TuyAPI Received UDP message. +0ms
TuyAPI UDP data: +1ms
TuyAPI {
TuyAPI payload: {
TuyAPI ip: '192.168.86.242',
TuyAPI gwId: 'eb8aaaaefcc7d62c9fhg2c',
TuyAPI active: 2,
TuyAPI ablilty: 0,
TuyAPI encrypt: true,
TuyAPI productKey: 'KEY',
TuyAPI version: '3.3'
TuyAPI },
TuyAPI leftover: false,
TuyAPI commandByte: 19,
TuyAPI sequenceN: 0
TuyAPI } +0ms
Even using protocol 3.3 I am still seeing this
➜ DEBUG=* tuya-cli get --ip 192.168.86.242 --id ID --key KEY --full --protocol-version 3.3
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 192.168.86.242... +2ms
TuyAPI Socket connected. +22ms
TuyAPI GET Payload: +0ms
TuyAPI {
TuyAPI gwId: 'ID',
TuyAPI devId: 'ID',
TuyAPI t: '1633923141',
TuyAPI dps: {},
TuyAPI uid: 'ID'
TuyAPI } +1ms
TuyAPI Received data: 000055aa000000010000000a0000002c00000001bf0726de796c6ba96eab0c936f3fa9de7eb60fccd5698769a9d13e2d94499ccd696796660000aa55 +29ms
TuyAPI Parsed: +0ms
TuyAPI {
TuyAPI payload: '�\u0007&�ylk�n�\f�o?��~�\u000f��i�i��>-�I��',
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 1
TuyAPI } +1ms
TuyAPI Received DATA packet +0ms
TuyAPI Disconnect +0ms
�&�ylk�n�
�o?��~���i�i��>-�I��
TuyAPI Socket closed: 192.168.86.242 +1ms
If I try to set I receive this
DEBUG=* tuya-cli set --ip 192.168.86.242 --id ID --key KEY --set "true" --protocol-version 3.3
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 192.168.86.242... +3ms
TuyAPI Socket connected. +72ms
TuyAPI SET Payload: +1ms
TuyAPI {
TuyAPI devId: 'ID',
TuyAPI gwId: 'ID',
TuyAPI uid: '',
TuyAPI t: 1633924441,
TuyAPI dps: { '1': true }
TuyAPI } +0ms
TuyAPI Received data: 000055aa00000001000000070000002c00000001bf0726de796c6ba96eab0c936f3fa9de7eb60fccd5698769a9d13e2d94499ccdbab4d4cd0000aa55 +34ms
TuyAPI Parsed: +1ms
TuyAPI {
TuyAPI payload: '�\u0007&�ylk�n�\f�o?��~�\u000f��i�i��>-�I��',
TuyAPI leftover: false,
TuyAPI commandByte: 7,
TuyAPI sequenceN: 1
TuyAPI } +0ms
TuyAPI Received DATA packet +0ms
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Timeout waiting for status response from device id: ID')
at TuyaDevice.emit (events.js:303:17)
at /usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:369:12
at Timeout._onTimeout (/usr/lib/node_modules/@tuyapi/cli/node_modules/p-timeout/index.js:25:13)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7) {
code: 'ERR_UNHANDLED_ERROR',
context: 'Timeout waiting for status response from device id: ID'
}
So, the IP I was using was wrong and the device may not be available (at least trying a few types of scans) while it sleeps since it is solar/battery powered
Alright, passing in front of it triggers it to wake up and then generate notifications in the app. Then I was able to scan it, but I was not able to get data from it.
➜ python3 -m tinytuya scan
TinyTuya (Tuya device scanner) [1.2.9]
[Loaded devices.json - 2 devices]
Scanning on UDP ports 6666 and 6667 for devices (15 retries)...
Solar Strobe Light Product ID = PRODUCT_ID [Valid payload]:
Address = 192.168.86.28, Device ID = DEVICE_ID, Local Key = DEVICE_KEY, Version = 3.3
Status: {'2': 58, '6': 'none', '102': True}
Unknown v3.3 Device Product ID = keygg897krt5kk4t [Valid payload]:
Address = 192.168.86.41, Device ID = eb6a6de92a356f2d62rnfj, Local Key = , Version = 3.3
No Stats for 192.168.86.41: DEVICE KEY required to poll for status
Unknown v3.3 Device Product ID = keygg897krt5kk4t [Valid payload]:
Address = 192.168.86.242, Device ID = eb8aaaaefcc7d62c9fhg2c, Local Key = , Version = 3.3
No Stats for 192.168.86.242: DEVICE KEY required to poll for status
Scan Complete! Found 3 devices.
This is the output from tuya-cli
➜ DEBUG=* tuya-cli get --ip 192.168.86.28 --id DEVICE_ID, --key DEVICE_KEY, --full --protocol-version 3.3
(node:836842) UnhandledPromiseRejectionWarning: TypeError: Key is missing or incorrect.
at new TuyaDevice (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:73:13)
at parseConfig (/usr/lib/node_modules/@tuyapi/cli/lib/control.js:32:9)
at Object.get (/usr/lib/node_modules/@tuyapi/cli/lib/control.js:36:15)
at Command.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/cli.js:62:11)
at Command.listener [as _actionHandler] (/usr/lib/node_modules/@tuyapi/cli/node_modules/commander/index.js:413:31)
at Command._parseCommand (/usr/lib/node_modules/@tuyapi/cli/node_modules/commander/index.js:914:14)
at Command._dispatchSubcommand (/usr/lib/node_modules/@tuyapi/cli/node_modules/commander/index.js:865:18)
at Command._parseCommand (/usr/lib/node_modules/@tuyapi/cli/node_modules/commander/index.js:882:12)
at Command.parse (/usr/lib/node_modules/@tuyapi/cli/node_modules/commander/index.js:717:10)
at Object.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/cli.js:133:9)
(node:836842) 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: 1)
(node:836842) [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.
TuyAPI will not work with devices that only periodically connect to WiFi as it assumes devices are continuously connected. See the TuyAPI readme:
TuyAPI does not support sensors due to the fact that they only connect to the network when their state changes. There are no plans to add support as it's out of scope to intercept network requests.
Thanks dude. The README is really good. But it means nothing when we don't know how to translate what we are experiencing to what is written there. It looks like I am bothering you here, so thank you for this nice tool, and sorry for asking these questions.
No problem, happy to answer questions as they come up. 😃
Hi. I am trying to access a smart siren. And it looks like the data is pretty much encrypted. Do I have anything that I can to understand what I am receiving to be able to control this? I just want to turn it on and off nothing else.
The device is this one https://www.amazon.com/Detector-Notification-RISOON-Wireless-Waterproof/dp/B08L4YQB6M
Ah, maybe the issue is that the IP is not right anymore. Could this be the problem?