tuyapi
tuyapi copied to clipboard
Retrieve Data for Dual Switch
Describe the bug I have a dual switch, two switches in a single device (with a single ID?). In Homebridge, and using the Home Assistant API, I see them numbered as devId with an appended _1 or _2. But trying that with the tuyapi, it doesn't work / hangs.
To Reproduce connect() to a device, using the id and key - works OK. But it only returns information for a single switch (i.e. energy monitoring). How to get the data for both switches? _1 or _2 appended to the devID only hangs.
Expected behavior Well, would like to see the information for both switches
Debug Output
Post the output of your program/app/script when run with the DEBUG environment variable set to *. Example: DEBUG=* node test.js. Copy the output and paste it below (in between the code fences):
Seeing that uid = devID. Should uid perhaps have the appended _1 or _2? Is there a way to force the uid?
Screenshots N/A
Desktop (please complete the following information):
- OS: Linux
- OS Version: Ubuntu, v20.10
- Node Version [output of
node -v]: v14.15.1
Additional context None.
Interesting. Do they appear as separate devices in the app?
I would recommend setting gwId to your device ID, then id to [id]_2.
Will give it a try, thanks! Right now, fighting with getting garbled data back (firmware was updated, now version 3.3 ... which I am passing, but wondering if I'm missing some needed dependency). Hmmm.
OK, the garbled data was me 🤣. Key had changed, but I forgot to update it in the js code - dang it! Fixed that, and can get the response. No luck accessing the dual devices. Have poked Tuya Tech Support, let's see what they say.
Thanks!