[ALPHA] Basic Tuya Cloud Driver (Limited device support)

I developed this cloud driver for my personal use because I have some Tuya WiFi bulbs that can't be converted to Tasmota at this time and so I decided to port some of the code Tuya published on Github so I could get basic control of them from Hubitat. While the driver can be extended to support other Tuya devices, I do not currently have plans to do so due to my limited time (but am accepting pull requests if anyone else wants to add support for other devices). This also means I have limited ability to support this driver but think it is useful and functional enough to share with the community.


  1. Downloads your device list from Tuya and creates child-devices automatically
  2. Supports push updates from Tuya for near immediate attribute updates
  3. Extendable to support other devices in the future


  1. You will need to create a developer account at Tuya (if you have one, make sure it is recent as old accounts will not work due to changes in encryption made by Tuya for new projects)
  2. Follow the instructions at Tuya Smart Home PaaS Configuration to create your developer account (it is free and you will not have to pay even after your first year according to Tuya devs)
  3. The directions will have you create the project, make a note of your access key and secret and then link your existing Tuya app account to the new developer account so you can see your devices
  4. Install the driver into Hubitat from https://raw.githubusercontent.com/bradsjm/hubitat-drivers/master/Tuya/TuyaOpenCloudAPI.groovy
  5. Create a new virtual device using the above driver
  6. You must populate the driver fields:
    a. Tuya Access Key/Client Id (from the instructions in section 3 above)
    b. Tuya Access Secret (also from the instructions in section 3)
    c. Select the correct Tuya Application you are using on your phone, in my case, I use the Tuya Smart Life app (with Tuya logo). See this link for details Tuya Smart and Smart Life App-Documentation-Tuya Developer
    d. Provide your Smart Life app login email and password (this is not your cloud login but the one for the phone app)
    e. Enter the same country code that you are using with the Tuya app when you registered it, for the US this is 1
    f. Turn on the debug logging
  7. The driver will now attempt to download the list of your devices from the cloud and create child drivers for each one, if the device is not known, it will just create a switch device for on/off

Remember that the API this driver uses is itself in beta, and this driver has only been tested with my account and for my lamp. I've found that the API provided by Tuya is limited in its support for advanced features of devices and there are many revisions of Tuya products out there that have different protocol versions with tweaks required in the code for them so what works on one vendor device may not work the same on a different vendor device of the same type. Caveat emptor!


Hello there,

Cameron Diaz Shut The Front Door GIF
I couldn't believe my eyes as I read this thread and I gleefully tried putting this together like a child at Christmas. I only have a few remaining Tuya devices because they'd be fairly unpleasant to swap and I understand how the driver capability is limited at this time.

I got the connection working. In HE, I got the driver to create child devices for two of my devices. One is a multi plug power strip that's not even plugged in (but I'll gladly plug it in for testing). And the other is a humidifier. I didn't get any response out of the humidifier and I'm certain it's because it's not supported yet.

None of my ceiling fans came over (I figured they'd autopop as a switch) and this could be because they also aren't supported. I have a set of string lights but it too did not create a child device. My assumption is because string lights offer different functionality than just 'bulb' and are probably also not yet supported. Unfortunately, I got rid of all my regular tuya bulbs.

In total, I have 9 devices. In the device notification API page, it shows the connection and detects that there are 9 devices but none are actually shown.

That's probably a question for Tuya but the net of it is, the connection is definitely established even if I can't see the actual devices, I can see a device count. Furthermore, because I can actually see 2 child devices in HE, I know the connection is working.

I am perfectly fine with none of my devices working because it means progress and I was able to successfully test proof of concept with the connection.

Professionally, I manage all the betas for my software company. I will gladly test/provide whatever logs that will assist you in your endeavor (even if you just want validation) let me know and I'll be happy to try to break things.

Edit: I noticed in the driver screen, it IS giving an accurate device count even if it only created two devices:


@jonathanb would love to see this grow. Tuya links to so many cool cheap products that have no obvious alternatives so it will be great to see this develop over time. I have a micro camera that works in Tuya and in Google Assistant but I can't find a way to get motion into HE (it fails to link with tinyCam locally in my LAN). Hopefully we can support that too in the future. Thanks for getting this started!

1 Like

Well overall that is a good sign as it means the low level encryption and communication to the Tuya servers seems to be working and something failed in the types of devices it was parsing. I'll PM you and get a log (don't post logs publicly as they may contain keys) to see where it failed.


Brilliant job, @jonathanb ! :champagne:

Your work is a great base for an alternative solution for bringing to Hubitat these Tuya devices, that are not supported via direct integration.

Thank you very much again!

Edit: some real events from the problematic to integrate directly to Hubutat Tuya switch TS004F


I just wanted to provide a generic update for those who might come looking for it because I think the reality is people are hungry for this and many of us have at least a FEW Tuya devices.

There's been some successful behind the scenes testing done not shown in the thread

I have 4 Tuya device types in total:

Ceiling fans - Connection successful: Basic on/off functionality confirmed. More dev work will be needed to expand the functionality to the fan speeds. Ceiling fan lights work but not at the same time as the fan controls (until more work is complete). Promising outlook.

Color outdoor string lights - Connection sucessful: On/Off, Color, H,S,L all work magnificently. No response with CT but I think its because the bulbs only mimic CT. I consider this one validated completely.

Humidifier - Connection successful: No control. More dev work needed. This will probably be a later phase enhancement due to complex controls.

Multi plug power strip - Connection successful: no control because of a lack of differentiation between plugs/switches. More dev work needed. Promising outlook.

@jonathanb has done great work here already in a short period of time.


Some additional devices are now supported by the driver:

  • Scene Switch (kkossev)
  • Sensors (brightness, temperature, humidity, CO2, CO) (kkossev)
  • Sensors (motion, contact, water, smoke)
  • Fan control

Multi-driver devices (e.g. power strip or other devices that have combination of capabilities such as a fan with a light) are not yet supported (but is on the roadmap)


Is this the same as Smart Life app? I've seen Tuya and Smart Life used interchangeably in other places.

For some reason Tuya has two different apps, one is Tuya Branded (Tuya Smart) with the Tuya logo and the other is just branded "Smart Life". Both should work with this driver, you select in the settings which app you are using.


@kkossev, I own a Zemismart button with almost the same signature, TS0044. It's a scene selector with 4 buttons - click, double click and long press are recognized -, and it is working fine here with a driver that a friend adapted from SmartThings. If you want to try it let me know that I send it to you.

@marcusvrsilva that's correct, a lot of Tuya Zigbee 3.0 devices can be connected directly to Hubitat (including TS0044) and this should always be the preferred method, when available.

However, Tuya has a wide range of interesting (and cheap) devices that use WiFi or even Bluetooth for communication, so this integration is the way to bring these to Hubitat,


Hi @jonathanb. got this working yesterday, thanks; all my devices showed up and I was able to play with them! Now my RBGW controllers don't exactly match up and only work ~75% so I started digging into the driver code. I'm not completely illiterate when it comes to reading code but I'm very green on groovy syntax. Among other compatibility issues which I'm learning and working on I think I came across a generic issue with a couple lines of code that I wanted to run by you to see if my thinking was correct.
There are few lines that use "?:" operator in some of the 'set___' functions for setting a default value of 100 for hue and saturation if the existing value is invalid. What I'm finding is that if the value is a valid '0' then that line of code assumes a 'bad' value and applies the default of 100. I tested by setting the value to 1 and it stays 1 (or any number 1-100) but if I set to '0' it gets changed to 100. Is that expected or do I need to study more :grin: ?

I think you are on the right track, it seems the ternary operator in Groovy doesn't just check for null but also false and since 0 is false, it gets triggered too which means I need a different test for when I just want to check for null!

1 Like

I just removed those tests from the code so I think that should fix the zero problem

Thanks, good to know I'm not nuts :slight_smile:. Yea, I just tried removing the ?: 100 from each line and the number stayed '0'. Now on to the hard stuff... my light controllers use color temp to switch between white and color but it does not have a 'temperature' heading in the available functions so that test fails in the setColorTemperature routine and it just sets a color instead. I need to rework my routine to get the controller to switch to white mode and set the level when I want white.

Again, thanks for all your work, been hoping for a Smart Life interface. I am currently setup HE <-> Node Red <-> Alexa <-> Smart Life which is a little cumbersome.

1 Like

First of all, I would like to congratulate you on the development of the integration, it is still in its initial stage but it is something that promises a lot.

I was able to import my devices, but I still couldn't make their command work

I was even happy because I imported the air conditioning control that works through an Tuya IR Blaster

1 Like

Send me a PM with a copy of the Data section (like you did above) for each device that doesn't work and we can see if it is simple enough that support can be added.

1 Like

Download the Hubitat app