TuyaAPI / cli

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

list-app returning undefined for key #43

Closed arrancorbett closed 4 years ago

arrancorbett commented 4 years ago

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

codetheweb commented 4 years ago

Interesting; is the ID the same for the devices connected via the gateway and the gateway itself?

If they're different, I'm guessing you can use the gateway ID as the optional gwId parameter, and then use the connected device ID as the actual id.

arrancorbett commented 4 years ago

Looking in the Tuya app at the device info the id that are being show on the intercept are correct for the individual devices.

I have also used Burp Suite to try and capture the key's but, again, here only the ID's are shown.

I'm trying to get the required info to use the tuyapi library to connect up event listeners to my other custom home automation.

These are the sensors i have

codetheweb commented 4 years ago

Have you tried plugging the parameters into TuyAPI yet? I would try using the gateway device ID as gwId, the individual sensor ID as id, and the gateway device key as key.

arrancorbett commented 4 years ago

hey @codetheweb, i've just tried passing the parameters to TuyaAPI and still now luck.

(node:15486) UnhandledPromiseRejectionWarning: Error: find() timed out. Is the device powered on and the ID or IP correct?

So i passed the IP of the device as well, and this throws a socket error

    at Socket.client.on.err (/services/tuya-listener/node_modules/tuyapi/index.js:323:30)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211: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)
Disconnected from device.

Although it shows Disconnected from device it doesn't seem to have connected as the connection message didn't show (i'm using the example code from tuyAPI

codetheweb commented 4 years ago

Try executing your script (with the IP) prefixed with DEBUG=* to show debug output.