TuyaAPI / cli

🔧 A CLI for Tuya devices
MIT License
261 stars 44 forks source link

Timeout waiting for status response -- UnhandledPromiseRejectionWarning #109

Open AndreasMatthias opened 3 years ago

AndreasMatthias commented 3 years ago

I can switch on/off a WiFi socket (from Teckin) successfully but I get this error message:

$ tuya-cli set --id XXXX --key YYYY --ip 192.168.2.121 --protocol-version 3.3 --set true

Set succeeded.
(node:8912) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Timeout waiting for status response from device id: XXXX')
    at TuyaDevice.emit (events.js:187:17)
    at pTimeout (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:256:12)
    at Timeout.setTimeout [as _onTimeout] (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/p-timeout/index.js:25:13)
    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)
(node:8912) 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:8912) [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.

Trying to GET the value triggers the same error message:

$ tuya-cli get --id XXXX --key YYYY --ip 192.168.2.121 --protocol-version 3.3 --all

json obj data unvalid
(node:9167) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Timeout waiting for status response from device id: XXXX')
    at TuyaDevice.emit (events.js:187:17)
    at pTimeout (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:256:12)
    at Timeout.setTimeout [as _onTimeout] (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/p-timeout/index.js:25:13)
    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)
(node:9167) 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:9167) [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.
AndreasMatthias commented 3 years ago

This seems to be the same issue as:

codetheweb commented 3 years ago

Could you run tuya-cli in debug mode and post the output?

DEBUG=* tuya-cli... if you're on *sh.

Teckin devices specifically seem to work slightly differently and I don't think we've been able to nail down the issue yet.

AndreasMatthias commented 3 years ago
$ DEBUG=* tuya-cli set --id bf4e5ccb3edd6c4657kxqa --key b55dc2459f3f55a0 --ip 192.168.2.121 --protocol-version 3.3 --set true

  TuyAPI IP and ID are already both resolved. +0ms
  TuyAPI Connecting to 192.168.2.121... +11ms
  TuyAPI Socket connected. +65ms
  TuyAPI GET Payload: +2ms
  TuyAPI { gwId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   devId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   t: '1611704275',
  TuyAPI   dps: {},
  TuyAPI   uid: 'bf4e5ccb3edd6c4657kxqa' } +0ms
  TuyAPI SET Payload: +22ms
  TuyAPI { devId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   gwId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   uid: '',
  TuyAPI   t: 1611704274,
  TuyAPI   dps: { '1': true } } +0ms
  TuyAPI Received data: 000055aa000000010000000a0000002c000000013e46424aee781f47f1b67afa3c61d4ce52772042c16a0d47a7b9a7695ffbda9a6ec06b720000aa55 +9ms
  TuyAPI Parsed: +4ms
  TuyAPI { payload: 'json obj data unvalid',
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 10,
  TuyAPI   sequenceN: 1 } +1ms
  TuyAPI SET Payload: +2ms
  TuyAPI { devId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   gwId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   uid: '',
  TuyAPI   t: 1611704274,
  TuyAPI   dps: { '1': null } } +0ms
  TuyAPI Received data: 000055aa00000000000000080000004b00000000332e330000000000000021000000017c35ace67528737c85a2b7d7d669e655c08a1274db957d1ba9c0f11f06153cf35f3c7e871b339f1d9fcaef960caf30d61c278c320000aa55 +63ms
  TuyAPI Parsed: +1ms
  TuyAPI { payload: { dps: { '1': true }, t: 1611704273 },
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 8,
  TuyAPI   sequenceN: 0 } +0ms
  TuyAPI Disconnect +4ms
Set succeeded.
  TuyAPI Socket closed: 192.168.2.121 +5ms
(node:17064) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Timeout waiting for status response from device id: bf4e5ccb3edd6c4657kxqa')
    at TuyaDevice.emit (events.js:187:17)
    at pTimeout (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:256:12)
    at Timeout.setTimeout [as _onTimeout] (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/p-timeout/index.js:25:13)
    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)
(node:17064) 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:17064) [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.
$ DEBUG=* tuya-cli get --id bf4e5ccb3edd6c4657kxqa --key b55dc2459f3f55a0 --ip 192.168.2.121 --protocol-version 3.3 --all

  TuyAPI IP and ID are already both resolved. +0ms
  TuyAPI Connecting to 192.168.2.121... +12ms
  TuyAPI Socket connected. +84ms
  TuyAPI GET Payload: +3ms
  TuyAPI { gwId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   devId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   t: '1611704357',
  TuyAPI   dps: {},
  TuyAPI   uid: 'bf4e5ccb3edd6c4657kxqa' } +1ms
  TuyAPI GET Payload: +23ms
  TuyAPI { gwId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   devId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   t: '1611704357',
  TuyAPI   dps: {},
  TuyAPI   uid: 'bf4e5ccb3edd6c4657kxqa' } +1ms
  TuyAPI Received data: 000055aa000000010000000a0000002c000000013e46424aee781f47f1b67afa3c61d4ce52772042c16a0d47a7b9a7695ffbda9a6ec06b720000aa55 +77ms
  TuyAPI Parsed: +5ms
  TuyAPI { payload: 'json obj data unvalid',
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 10,
  TuyAPI   sequenceN: 1 } +0ms
  TuyAPI SET Payload: +5ms
  TuyAPI { devId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   gwId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   uid: '',
  TuyAPI   t: 1611704357,
  TuyAPI   dps: { '1': null } } +0ms
  TuyAPI Received data: 000055aa000000020000000a0000002c000000013e46424aee781f47f1b67afa3c61d4ce52772042c16a0d47a7b9a7695ffbda9a510b15e70000aa55 +7ms
  TuyAPI Parsed: +1ms
  TuyAPI { payload: 'json obj data unvalid',
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 10,
  TuyAPI   sequenceN: 2 } +1ms
  TuyAPI Disconnect +1ms
json obj data unvalid
  TuyAPI Socket closed: 192.168.2.121 +5ms
(node:18222) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Timeout waiting for status response from device id: bf4e5ccb3edd6c4657kxqa')
    at TuyaDevice.emit (events.js:187:17)
    at pTimeout (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:256:12)
    at Timeout.setTimeout [as _onTimeout] (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/p-timeout/index.js:25:13)
    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)
(node:18222) 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:18222) [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.
codetheweb commented 3 years ago

My guess is that your devices are a '0d' type, which is not currently supported.

If you're able to, it would be greatly appreciated if you applied the modifications for the GET command listed in the linked comment and tested to see if there's still an error message.

AndreasMatthias commented 3 years ago

Ok, following the description in the link I modified commandByte and payload in the get() function like this:

$ diff -u4 index.js.orig index.js
--- index.js.orig   2021-01-27 23:29:49.312760117 +0100
+++ index.js    2021-01-28 00:53:36.135902114 +0100
@@ -118,9 +118,16 @@
     const payload = {
       gwId: this.device.gwID,
       devId: this.device.id,
       t: Math.round(new Date().getTime() / 1000).toString(),
-      dps: {},
+      dps: {
+          1: null,
+          2: null,
+          3: null,
+          101: null,
+          102: null,
+          103: null,
+      },
       uid: this.device.id
     };

     debug('GET Payload:');
@@ -128,9 +135,9 @@

     // Create byte buffer
     const buffer = this.device.parser.encode({
       data: payload,
-      commandByte: CommandType.DP_QUERY,
+      commandByte: CommandType.CONTROL_NEW,
       sequenceN: ++this._currentSequenceN
     });

     // Send request and parse response

Now the error message is gone, but the return value of tuya-cli get is always false:

$ tuya-cli set --id bf4e5ccb3edd6c4657kxqa --key b55dc2459f3f55a0 --ip 192.168.2.121 --protocol-version 3.3 --set true
Set succeeded.
$ tuya-cli get --id bf4e5ccb3edd6c4657kxqa --key b55dc2459f3f55a0 --ip 192.168.2.121 --protocol-version 3.3 --all
false
$ tuya-cli set --id bf4e5ccb3edd6c4657kxqa --key b55dc2459f3f55a0 --ip 192.168.2.121 --protocol-version 3.3 --set false
Set succeeded.
$ tuya-cli get --id bf4e5ccb3edd6c4657kxqa --key b55dc2459f3f55a0 --ip 192.168.2.121 --protocol-version 3.3 --all
false

And here is the debug output of the above commands. (If I do not misinterpret the debug output, the device returns the state correctly, i.e. dps: { '1': true } or dps: {'1': false }, but the get() function's return value is wrong.)

$ DEBUG=* tuya-cli set --id bf4e5ccb3edd6c4657kxqa --key b55dc2459f3f55a0 --ip 192.168.2.121 --protocol-version 3.3 --set true
  TuyAPI IP and ID are already both resolved. +0ms
  TuyAPI Connecting to 192.168.2.121... +11ms
  TuyAPI Socket connected. +489ms
  TuyAPI GET Payload: +3ms
  TuyAPI { gwId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   devId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   t: '1611791890',
  TuyAPI   dps:
  TuyAPI    { '1': null,
  TuyAPI      '2': null,
  TuyAPI      '3': null,
  TuyAPI      '101': null,
  TuyAPI      '102': null,
  TuyAPI      '103': null },
  TuyAPI   uid: 'bf4e5ccb3edd6c4657kxqa' } +0ms
  TuyAPI SET Payload: +37ms
  TuyAPI { devId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   gwId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   uid: '',
  TuyAPI   t: 1611791890,
  TuyAPI   dps: { '1': true } } +0ms
  TuyAPI Received data: 000055aa00000000000000080000004b00000000332e33000000000000004b00000001c702ac725df84da5d9d66420ec4c0cfbdb2e23e2bd582cbe699c04625136483996178cc8b73977b42a6302790c5d4de84f6bd6850000aa55 +100ms
  TuyAPI Parsed: +6ms
  TuyAPI { payload: { dps: { '1': false }, t: 1611791889 },
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 8,
  TuyAPI   sequenceN: 0 } +0ms
  TuyAPI Disconnect +4ms
Set succeeded.
  TuyAPI Socket closed: 192.168.2.121 +7ms
$ DEBUG=* tuya-cli get --id bf4e5ccb3edd6c4657kxqa --key b55dc2459f3f55a0 --ip 192.168.2.121 --protocol-version 3.3 --all
  TuyAPI IP and ID are already both resolved. +0ms
  TuyAPI Connecting to 192.168.2.121... +11ms
  TuyAPI Socket connected. +121ms
  TuyAPI GET Payload: +3ms
  TuyAPI { gwId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   devId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   t: '1611791931',
  TuyAPI   dps:
  TuyAPI    { '1': null,
  TuyAPI      '2': null,
  TuyAPI      '3': null,
  TuyAPI      '101': null,
  TuyAPI      '102': null,
  TuyAPI      '103': null },
  TuyAPI   uid: 'bf4e5ccb3edd6c4657kxqa' } +0ms
  TuyAPI GET Payload: +22ms
  TuyAPI { gwId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   devId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   t: '1611791931',
  TuyAPI   dps:
  TuyAPI    { '1': null,
  TuyAPI      '2': null,
  TuyAPI      '3': null,
  TuyAPI      '101': null,
  TuyAPI      '102': null,
  TuyAPI      '103': null },
  TuyAPI   uid: 'bf4e5ccb3edd6c4657kxqa' } +0ms
  TuyAPI Received data: 000055aa00000000000000080000004b00000000332e33000000000000004d000000017c35ace67528737c85a2b7d7d669e65588526b0ead80736368ff1975914fb7075f3c7e871b339f1d9fcaef960caf30d62987d7f80000aa55 +47ms
  TuyAPI Parsed: +4ms
  TuyAPI { payload: { dps: { '1': true }, t: 1611791929 },
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 8,
  TuyAPI   sequenceN: 0 } +0ms
  TuyAPI Received data: 000055aa000000010000000d0000000c00000000302b238a0000aa55 +3ms
  TuyAPI Parsed: +0ms
  TuyAPI { payload: false, leftover: false, commandByte: 13, sequenceN: 1 } +1ms
  TuyAPI Received data: 000055aa00000000000000080000004b00000000332e33000000000000004e000000017c35ace67528737c85a2b7d7d669e65588526b0ead80736368ff1975914fb7075f3c7e871b339f1d9fcaef960caf30d6aaee073b0000aa55 +26ms
  TuyAPI Parsed: +1ms
  TuyAPI { payload: { dps: { '1': true }, t: 1611791929 },
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 8,
  TuyAPI   sequenceN: 0 } +0ms
  TuyAPI Received data: 000055aa000000020000000d0000000c000000008de14f440000aa55 +1ms
  TuyAPI Parsed: +0ms
  TuyAPI { payload: false, leftover: false, commandByte: 13, sequenceN: 2 } +0ms
  TuyAPI Disconnect +1ms
false
  TuyAPI Socket closed: 192.168.2.121 +5ms
$ DEBUG=* tuya-cli set --id bf4e5ccb3edd6c4657kxqa --key b55dc2459f3f55a0 --ip 192.168.2.121 --protocol-version 3.3 --set false
  TuyAPI IP and ID are already both resolved. +0ms
  TuyAPI Connecting to 192.168.2.121... +15ms
  TuyAPI Socket connected. +102ms
  TuyAPI GET Payload: +3ms
  TuyAPI { gwId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   devId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   t: '1611791950',
  TuyAPI   dps:
  TuyAPI    { '1': null,
  TuyAPI      '2': null,
  TuyAPI      '3': null,
  TuyAPI      '101': null,
  TuyAPI      '102': null,
  TuyAPI      '103': null },
  TuyAPI   uid: 'bf4e5ccb3edd6c4657kxqa' } +0ms
  TuyAPI SET Payload: +25ms
  TuyAPI { devId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   gwId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   uid: '',
  TuyAPI   t: 1611791950,
  TuyAPI   dps: { '1': false } } +0ms
  TuyAPI Received data: 000055aa00000000000000080000004b00000000332e33000000000000004f000000017c35ace67528737c85a2b7d7d669e6550d5c371d4e45ca6fd14d18d783906e265f3c7e871b339f1d9fcaef960caf30d6250336dc0000aa55 +41ms
  TuyAPI Parsed: +4ms
  TuyAPI { payload: { dps: { '1': true }, t: 1611791949 },
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 8,
  TuyAPI   sequenceN: 0 } +0ms
  TuyAPI Disconnect +3ms
Set succeeded.
  TuyAPI Socket closed: 192.168.2.121 +5ms
$ DEBUG=* tuya-cli get --id bf4e5ccb3edd6c4657kxqa --key b55dc2459f3f55a0 --ip 192.168.2.121 --protocol-version 3.3 --all
  TuyAPI IP and ID are already both resolved. +0ms
  TuyAPI Connecting to 192.168.2.121... +11ms
  TuyAPI Socket connected. +54ms
  TuyAPI GET Payload: +2ms
  TuyAPI { gwId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   devId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   t: '1611791968',
  TuyAPI   dps:
  TuyAPI    { '1': null,
  TuyAPI      '2': null,
  TuyAPI      '3': null,
  TuyAPI      '101': null,
  TuyAPI      '102': null,
  TuyAPI      '103': null },
  TuyAPI   uid: 'bf4e5ccb3edd6c4657kxqa' } +1ms
  TuyAPI GET Payload: +22ms
  TuyAPI { gwId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   devId: 'bf4e5ccb3edd6c4657kxqa',
  TuyAPI   t: '1611791968',
  TuyAPI   dps:
  TuyAPI    { '1': null,
  TuyAPI      '2': null,
  TuyAPI      '3': null,
  TuyAPI      '101': null,
  TuyAPI      '102': null,
  TuyAPI      '103': null },
  TuyAPI   uid: 'bf4e5ccb3edd6c4657kxqa' } +0ms
  TuyAPI Received data: 000055aa00000000000000080000004b00000000332e33000000000000005100000001c702ac725df84da5d9d66420ec4c0cfb4ea9cd7dabee3a5f4d38be13975f5967ae37bb327e30a04c7ddb7ccf9cdd1cfe6b4daec50000aa55 +41ms
  TuyAPI Parsed: +4ms
  TuyAPI { payload: { dps: { '1': false }, t: 1611791967 },
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 8,
  TuyAPI   sequenceN: 0 } +0ms
  TuyAPI Received data: 000055aa000000010000000d0000000c00000000302b238a0000aa55 +2ms
  TuyAPI Parsed: +1ms
  TuyAPI { payload: false, leftover: false, commandByte: 13, sequenceN: 1 } +0ms
  TuyAPI Received data: 000055aa00000000000000080000004b00000000332e33000000000000005200000001c702ac725df84da5d9d66420ec4c0cfb4ea9cd7dabee3a5f4d38be13975f5967ae37bb327e30a04c7ddb7ccf9cdd1cfee8247e060000aa55 +27ms
  TuyAPI Parsed: +1ms
  TuyAPI { payload: { dps: { '1': false }, t: 1611791967 },
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 8,
  TuyAPI   sequenceN: 0 } +0ms
  TuyAPI Received data: 000055aa000000020000000d0000000c000000008de14f440000aa55 +1ms
  TuyAPI Parsed: +0ms
  TuyAPI { payload: false, leftover: false, commandByte: 13, sequenceN: 2 } +0ms
  TuyAPI Disconnect +1ms
false
  TuyAPI Socket closed: 192.168.2.121 +5ms
BarryW55 commented 3 years ago

I am having the same or a similar issue. I can turn a switch on and off ok, but cannot get the state to see if its on or off.

Set it on

`pi@raspberrypi:~ $ tuya-cli set --id bf50780f03636fe9ebjxxd --key 6eb72d1d45ef4a40 --set true
Set succeeded.
node:internal/process/promises:227
          triggerUncaughtException(err, true /* fromPromise */);
          ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Timeout waiting for status response from device id: bf50780f03636fe9ebjxxd')
    at new NodeError (node:internal/errors:329:5)
    at TuyaDevice.emit (node:events:368:17)
    at /usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:256:12
    at Timeout._onTimeout (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/p-timeout/index.js:25:13)
    at listOnTimeout (node:internal/timers:556:17)
    at processTimers (node:internal/timers:499:7) {
  code: 'ERR_UNHANDLED_ERROR',
  context: 'Timeout waiting for status response from device id: bf50780f03636fe9ebjxxd'
`

and then get the status


`pi@raspberrypi:~ $ env DEBUG='*' tuya-cli get state --id bf50780f03636fe9ebjxxd --ip 192.168.1.70 --key 6eb72d1d45ef4a40 --protocol-version 3.3
  TuyAPI IP and ID are already both resolved. +0ms
  TuyAPI Connecting to 192.168.1.70... +6ms
  TuyAPI Socket connected. +55ms
  TuyAPI GET Payload: +1ms
  TuyAPI {
  TuyAPI   gwId: 'bf50780f03636fe9ebjxxd',
  TuyAPI   devId: 'bf50780f03636fe9ebjxxd',
  TuyAPI   t: '1612092708',
  TuyAPI   dps: {},
  TuyAPI   uid: 'bf50780f03636fe9ebjxxd'
  TuyAPI } +0ms
  TuyAPI GET Payload: +12ms
  TuyAPI {
  TuyAPI   gwId: 'bf50780f03636fe9ebjxxd',
  TuyAPI   devId: 'bf50780f03636fe9ebjxxd',
  TuyAPI   t: '1612092708',
  TuyAPI   dps: {},
  TuyAPI   uid: 'bf50780f03636fe9ebjxxd'
  TuyAPI } +0ms
  TuyAPI Received data: 000055aa000000010000000a0000002c000000012be1e532c20b21630e87127b7f341717cf66ae55174d17af97da5c47e538f73782f3cba00000aa55 +7ms
  TuyAPI Parsed: +2ms
  TuyAPI {
  TuyAPI   payload: 'json obj data unvalid',
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 10,
  TuyAPI   sequenceN: 1
  TuyAPI } +0ms
  TuyAPI SET Payload: +2ms
  TuyAPI {
  TuyAPI   devId: 'bf50780f03636fe9ebjxxd',
  TuyAPI   gwId: 'bf50780f03636fe9ebjxxd',
  TuyAPI   uid: '',
  TuyAPI   t: 1612092707,
  TuyAPI   dps: { '1': null }
  TuyAPI } +0ms
  TuyAPI Received data: 000055aa000000020000000a0000002c000000012be1e532c20b21630e87127b7f341717cf66ae55174d17af97da5c47e538f737bd38b5350000aa55 +4ms
  TuyAPI Parsed: +1ms
  TuyAPI {
  TuyAPI   payload: 'json obj data unvalid',
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 10,
  TuyAPI   sequenceN: 2
  TuyAPI } +0ms
  TuyAPI Disconnect +1ms
TypeError: Cannot read property '1' of undefined
    at Object.get (/usr/local/lib/node_modules/@tuyapi/cli/lib/control.js:56:30)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
  TuyAPI Socket closed: 192.168.1.70 +4ms
node:internal/process/promises:227
          triggerUncaughtException(err, true /* fromPromise */);
          ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Timeout waiting for status response from device id: bf50780f03636fe9ebjxxd')
    at new NodeError (node:internal/errors:329:5)
    at TuyaDevice.emit (node:events:368:17)
    at /usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:256:12
    at Timeout._onTimeout (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/p-timeout/index.js:25:13)
    at listOnTimeout (node:internal/timers:556:17)
    at processTimers (node:internal/timers:499:7) {
  code: 'ERR_UNHANDLED_ERROR',
  context: 'Timeout waiting for status response from device id: bf50780f03636fe9ebjxxd'
`

Any help/suggestions very welcome or anything I can do to help please let me know

Barry

codetheweb commented 3 years ago

@AndreasMatthias thank you for confirming.

I don't currently have enough free time to implement 0d devices, but feel free to follow this issue for updates. Also happy to accept PRs. :)

@BarryW55 I'm pretty sure you're having the same issue as well.