tuyapi icon indicating copy to clipboard operation
tuyapi copied to clipboard

Retrieve Data for Dual Switch

Open arrmo opened this issue 3 years ago • 3 comments

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.

arrmo avatar Nov 20 '20 03:11 arrmo

Interesting. Do they appear as separate devices in the app?

I would recommend setting gwId to your device ID, then id to [id]_2.

codetheweb avatar Nov 22 '20 03:11 codetheweb

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.

arrmo avatar Nov 23 '20 12:11 arrmo

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!

arrmo avatar Nov 23 '20 16:11 arrmo