[BETA]TuyaHubitat - (jinvoo, smart life, tuya smart - switches only)


interested as well. I have some of those Tuya power strips with USB and one in-wall switch and some other regular smart plugs from Tuya.

I have tried it running the node server on a RP3B+ alongside the other node (TP-Link). I had to get an old S3 rooted to find the key/dev ids. However it fails and punts as soon as the first command is sent from Hubitat. Haven't had the time to dig deeper except I might today

something like this:
Command sending to IP: Command: status
var len = tmp.length();

TypeError: tmp.length is not a function
at forge.aes.Algorithm.initialize (/home/pi/node_modules/node-forge/lib/aes.js:203:19)
at new forge.cipher.BlockCipher (/home/pi/node_modules/node-forge/lib/cipher.js:118:18)
at Object.forge.cipher.createCipher (/home/pi/node_modules/node-forge/lib/cipher.js:42:10)
at new TuyaCipher (/home/pi/node_modules/tuyapi/lib/cipher.js:14:30)
at new TuyaDevice (/home/pi/node_modules/tuyapi/index.js:54:26)
at processDeviceCommand (/home/pi/TuyaHub/TuyAPI_Server_v1.js:87:13)
at Server.onRequest (/home/pi/TuyaHub/TuyAPI_Server_v1.js:53:4)
at Server.emit (events.js:182:13)
at parserOnIncoming (_http_server.js:657:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)


Did you npm install the codetheweb/tuyapi?

They have made leaps and bounds since I made this.

I set this up again the other day so I am sure we can still make it work. I simply replaced the contents of the node server with what is in my forked repo.

Use the driver in the test branch. I currently only have the one power strip with 4 switches and the USB group.

Single switch devices may need a different driver. I'd be willing to make something if we can get you going.


Let me try and update and install the codetheweb/tuyapi again. I have two strips of the same you got (4 switches with USB group) so hope to get those working first.


Hi man... good to see you spreading your coding wings!!!

I just picked up 6 of these plugs for a bargain price and would love to try your code. Just need to carve out some time. It will be a good use of my Hubitat hub since I moved all my lights back to ST.


It is too bad you've been having so much trouble on this side ken.

What sort of plugs did you get? Are they single outlets?

It has been awhile since I worked on it. The guys who mad this a pi have taken it quite a bit further. I believe you can do everything from discovery and registration right from your pi and never use any of the tuya apps. I have not played with that yet.

They also have made changes to the a pi which do not work with my driver.
I was able to get this going again though with the files in the test branch of my repo.

I have a feeling we may have issue with a single plug device. I ordered one this morning. Hopefully I can make a driver specific for it.

I appreciate the support. Hit me up when you go to give it a shot.


Yea - my troubles with Hubitat all stem from erratic behavior of my GE Zwave switches. Everything else is pretty good.

On the Tuya stuff I bought 6 single plugs. They were dirt cheap and work great using the SmartLife app. IFTTT is my default path to linking them into Hubitat or ST but your code will be much better.


So my single plug arrived today. I just confirmed that with the code as is I am able to control the device and get status. It should not be much trouble to scale the back to have it be for a single outlet. On my days off I will see if I can make that happen.

If and when you do go to install use the files in my test branch, until I get everything cleaned up and presentable. I will try and post clear instructions to install as well. As I am a using a version that is FAR behind the master repo we need to make sure it is installed.