unparagoned / njsTuya

Openhab interface for Tuya home automation devices sold under various names
27 stars 11 forks source link

Can't read the schema #31

Closed kart-able closed 5 months ago

kart-able commented 3 years ago

The schema of my device is maybe in chinese?

When I run node node_modules/njstuya -ip 192.168.1.13 -get '{ "schema": true}' the payload is apparently unreadable.

njstuya booting njstuya +0ms njstuya "{argName} value is: 192.168.1.13 +4ms njstuya "{argName} value is: { +0ms njstuya local mode +1ms njstuya api {} or undefined +1ms TuyAPI Finding missing IP 192.168.1.13 or ID +0ms TuyAPI Received UDP message. +4s TuyAPI UDP data: +9ms TuyAPI { TuyAPI payload: { TuyAPI ip: '192.168.1.13', TuyAPI gwId: 'xxxxxxxxxxxxxxxxxxxxx', TuyAPI active: 2, TuyAPI ablilty: 0, TuyAPI encrypt: true, TuyAPI productKey: 'xxxxxxxxxxxxxxxxxxxxx', TuyAPI version: '3.3' TuyAPI }, TuyAPI leftover: false, TuyAPI commandByte: 19, TuyAPI sequenceN: 0 TuyAPI } +0ms njstuya ip undefined id: undefined +4s TuyAPI Connecting to 192.168.1.13... +21ms TuyAPI Socket connected. +68ms njstuya Connected to device! +75ms TuyAPI GET Payload: +4ms TuyAPI { TuyAPI gwId: 'xxxxxxxxxxxxxxxxxxxxx', TuyAPI devId: 'xxxxxxxxxxxxxxxxxxxxx', TuyAPI t: '1600941684', TuyAPI dps: {}, TuyAPI uid: 'xxxxxxxxxxxxxxxxxxxxx' TuyAPI } +1ms TuyAPI Received data: 000055aa000000010000000a0000002c0000000143f419dc669d9137904f7f66bd026f20c4e1dc5dff0aaf61cbdcf2ad87dc02ad1db3708b0000aa55 +21ms TuyAPI Parsed: +3ms TuyAPI { TuyAPI payload: 'C�\u0019�f��7�O⌂f�\u0002o ���]�\n�a����\u0002�', TuyAPI leftover: false, TuyAPI commandByte: 10, TuyAPI sequenceN: 1 TuyAPI } +2ms njstuya runCommand has started with data "C�\u0019�f��7�O⌂f�\u0002o ���]�\n�a����\u0002�" +33ms (node:4824) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '1' of undefined at TuyaDevice.runCommand (C:\Users\jcwal\Documents\Kitematic\openhab\openhab\conf\scripts\node_modules\njstuya\njstuya.js:300:33) at TuyaDevice.emit (events.js:315:20) at TuyaDevice._packetHandler (C:\Users\jcwal\Documents\Kitematic\openhab\openhab\conf\scripts\node_modules\tuyapi\index.js:444:10) at C:\Users\jcwal\Documents\Kitematic\openhab\openhab\conf\scripts\node_modules\tuyapi\index.js:343:43 at Array.forEach (<anonymous>) at Socket.<anonymous> (C:\Users\jcwal\Documents\Kitematic\openhab\openhab\conf\scripts\node_modules\tuyapi\index.js:339:19) at Socket.emit (events.js:315:20) at addChunk (_stream_readable.js:297:12) at readableAddChunk (_stream_readable.js:273:9) at Socket.Readable.push (_stream_readable.js:214:10) (node:4824) 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:4824) [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 Disconnect +5s njstuya undefined +5s TuyAPI Socket closed: 192.168.1.13 +3ms njstuya Disconnected from device. +1ms

unparagoned commented 3 years ago

If you use the phone app then the device switches to encrypted mode for a while. So make sure you have the phone app disabled and don't use any cloud tools for a while.

unparagoned commented 3 years ago

Maybe try setting version 3.3 and also the id and key

node node_modules/njstuya -ip 192.168.1.13 -id ID -key KEY -v 3.3 -get '{ "schema": true}'