[BETA] Tuya Cloud Driver (Limited device support)

I have same issue, how did you solved?

I hope I'm not repeating a request, I went through all the posts, and didn't see this mentioned:

I'm using 9, soon to be 20, of the Luminar 6" RGBW Can Lights. This generic Tuya driver works for turning on and off fine.

What it doesn't seem to do is update, like at all. Do I need to schedule that with RM or something?

And is there a brightness/color control ability? It appears to only be on/off, which is FINE for my use case. I tried the RGBW code listed somewhere in the 100's posts, but then realized it was for a Chile device of...something?

The last oddity is when I group the lights, or even add them all to a simple light rule, they turn on/off one by one, slowly like over a second each. When I have them grouped via Alexa, there is a slight delay, but all come on/off pretty quickly.

Thanks for doing this work @jonathanb !

If the light state is not updating then you likely missed a step when setting up the account permissions and did not provide the driver specifically step 6 which says " In the Authorize API Services dialog, select Device Status Notification ." without which the driver will not be notified of changes to devices. This may fix the problem with the colors as the driver needs to know the state of the light to determine what commands it is to send, without that, it may error out.

You may also want to add "Smart Home Scene Linkage" permission in the same place which will allow you to create automations in the Tuya app and have the driver activate them. For example, you can have a single automation turn on all the lights at the same time and just activate it.

1 Like

Cool thank you @jonathanb I added that API service. The current state still doesn't seem to change unless I actually hit "Status" though.

I guess I don't get how Hubitat is supposed to control things then, since the driver isn't exposing any controls for color, just on/off?

If I add a Scene in the App, to turn on my kitchen Group, which is all the ligths, then how would I trigger it?

I think I'll stick with the on/off (with preset on state in app) to keep it simple, but I am very curious about the rest of what I can do!

I am wondering if the driver doesn't recognize the Luminar and it may need to be added to the driver database. To find out, I will need to know the section in one of the child devices data section, specifically the "category" and "functions" content in that section.

Ah that must explain it. There is no child device. After creating the virtual device, assinging the generic tuya driver, and entering the kep/secret/ip, this is all I get:



Now all makes sense, that is not my Tuya driver :rofl: The driver in this thread is for the Tuya Cloud and does not communicate locally.

If you'd like to try the cloud driver which may actually be faster with less popcorn effect then just download the one at the top of this thread which is here: https://raw.githubusercontent.com/bradsjm/hubitat-drivers/main/Tuya/TuyaOpenCloudAPI.groovy

It sounds like you may have set up your Tuya IOT account already so you should be all set but if you have any issues double check each step of the setup. This driver will create child devices for each device in the Tuya Cloud automagically and you will see your lights listed as a Generic RGBW child device. I've also found the speed fast enough that for 6 lights in my living room its fast enough I do not see the popcorn effect (though it is there if you watch carefully) though I do have gigabit internet so that might help too.

Even though local control should in theory be faster, I do not think the Tuya devices are optimized for that as much as they've optimized the cloud communications or maybe the heavy encryption overhead of their API negates the improvement.

1 Like

OMG I feel like a moron, I'm so sorry!

I went down a thread rabbit hole, and guess I ended up here with that other code.

I'll play with yours now keep the other as an offline backup.

Thank you for clarifying my stupidity!

I added the API for notifications, added your driver, it does control one light, but the status still doesn't update until I hit refresh. Would there be anything else I could have missed?

In this pic, the bottom entry is me using the HU button to turn the light off, I immediately turned it back on with the phone app for Smart Life, and waited a minute, then hit refresh to get the top entry.

I DID THIS ANFD WORKED
1.- CHANGED THE DRIVER TO A CLEAN DRIVER
HERE ARE IS THE DRIVER

2.-CLENA CHILDS, RESET REFESH
3.- CAHNGE THE DRIVER BACK TO tUYA cLOUD dRIVER
4.- CONFIG
5.- YOU WILL HAVE ALL NEW CHILD DEVICES

I've moved to your driver, it's so much easier!

But even though I have a group dimmer with the child devices added, or even just the child devices, I'm unable to make them work in an app as a dimmer, they just don't do anything. I have to choose them as a switch. So I can't easily automate levels/colors, just on/off.

Is this expected behavior? Do you use the cloud somehow to work around that?

I'm going to need some more details, right now I have 10 RGBWW Tuya ceiling lights working with the driver, in fact, it is why I wrote the driver because I can't flash them with Tasmota.

To help me understand, lets start with one of the child light devices (created by my driver, they will be of type "Component something") and show me the Data section which should be populated, this way I can check that your lights are being recognized properly by the driver. I may then need to get you to turn on some debugging logs but lets take it one step at a time.

Most were set to generic rgbw so I changed them all to Tuya Local RGBW Light.

I think they are working now. I'll report back after I have time to fiddle with all my rules.

The Generic Component will use the cloud, the Tuya Local if it is configured with the device IP address will try to use local and I think has a cloud fallback. I consider it an experimental driver, if it works great but if not, go back to the Generic Component RGBW and we can diagnose any issues.

Congradulations Jonathan for this driver and integration, it's really appreciated !

I have a question: my device is a smart garage controller, si it's a switch (controlling 2 wires for the garage motor) and a contact sensor ( to detect wether the door is open or not)

I tried selecting virtual switch, virtual Garage Door Controller, virtual contact sensor, i can't seem to find the right one.

oddly enough, the parent device receives all the info correctly:

dev:9072022-06-06 15:43:49.722 infoGarage Door contact is closed
dev:9072022-06-06 15:43:42.882 infoGarage Door switch is on
dev:9072022-06-06 15:41:41.737 infoGarage Door contact is closed
dev:9072022-06-06 15:41:34.759 infoGarage Door switch is on
dev:9072022-06-06 15:41:34.728 infoGarage Door switch is on
dev:9072022-06-06 15:41:32.033 infoGarage Door contact is closed
dev:9072022-06-06 15:41:25.047 infoGarage Door switch is on
dev:9072022-06-06 15:41:25.017 infoGarage Door switch is on
dev:9072022-06-06 15:41:16.323 infoGarage Door contact is closed
dev:9072022-06-06 15:41:14.521 infoGarage Door contact is open
dev:9072022-06-06 15:36:04.945 infoGarage Door contact is closed
dev:9072022-06-06 15:36:00.549 infoGarage Door contact is open

if you have any advice to give me it would be greately appreciated

meanwhile, I get these frim the child app if it helps:
dev:9082022-06-06 15:43:49.733 errorjava.lang.IllegalArgumentException: wrong number of arguments on line 1251 (method parse)
dev:9082022-06-06 15:43:42.932 errorgroovy.lang.MissingMethodException: No signature of method: virtualContact.parse() is applicable for argument types: (java.util.ArrayList) values: [[[name:switch, value:on, descriptionText:switch is on]]] Possible solutions: parse(java.lang.String), close(), use([Ljava.lang.Object;), wait(), run(), run() on line 1251 (method parse)
dev:9082022-06-06 15:41:41.748 errorjava.lang.IllegalArgumentException: wrong number of arguments on line 1251 (method parse)
dev:9082022-06-06 15:41:34.776 errorgroovy.lang.MissingMethodException: No signature of method: virtualContact.parse() is applicable for argument types: (java.util.ArrayList) values: [[[name:switch, value:on, descriptionText:switch is on]]] Possible solutions: parse(java.lang.String), close(), use([Ljava.lang.Object;), wait(), run(), run() on line 1251 (method parse)
dev:9082022-06-06 15:41:34.743 errorgroovy.lang.MissingMethodException: No signature of method: virtualContact.parse() is applicable for argument types: (java.util.ArrayList) values: [[[name:switch, value:on, descriptionText:switch is on]]] Possible solutions: parse(java.lang.String), close(), use([Ljava.lang.Object;), wait(), run(), run() on line 1251 (method parse)
dev:9082022-06-06 15:41:32.044 errorjava.lang.IllegalArgumentException: wrong number of arguments on line 1251 (method parse)
dev:9082022-06-06 15:41:25.064 errorgroovy.lang.MissingMethodException: No signature of method: virtualContact.parse() is applicable for argument types: (java.util.ArrayList) values: [[[name:switch, value:on, descriptionText:switch is on]]] Possible solutions: parse(java.lang.String), close(), use([Ljava.lang.Object;), wait(), run(), run() on line 1251 (method parse)
dev:9082022-06-06 15:41:25.034 errorgroovy.lang.MissingMethodException: No signature of method: virtualContact.parse() is applicable for argument types: (java.util.ArrayList) values: [[[name:switch, value:on, descriptionText:switch is on]]] Possible solutions: parse(java.lang.String), close(), use([Ljava.lang.Object;), wait(), run(), run() on line 1251 (method parse)
dev:9082022-06-06 15:41:16.335 errorjava.lang.IllegalArgumentException: wrong number of arguments on line 1251 (method parse)
dev:9082022-06-06 15:41:14.540 errorgroovy.lang.MissingMethodException: No signature of method: virtualContact.parse() is applicable for argument types: (java.util.ArrayList) values: [[[name:contact, value:open, descriptionText:contact is open]]]

Thanks in advance !

I got it to work ! : Generic Component Switch/Sensor
I can control the Tuya device from that and get the contact status at the same time !

Halleluyah ! :slight_smile:

only thing I have to work out is having a dashboard garage button displaying open or closed and serving as a button at the same time

You need a "Garage Door Control" device. Could use one of the garage door apps the community posted, or create a new virtual device and then some sort of a rule or mirroring to keep it sync with the actual component device.

I just threw this child driver together quickly, it might work for your needs to turn that into a garage door opener instead of switch/sensor:

https://raw.githubusercontent.com/bradsjm/hubitat-drivers/development/Component/ComponentGarageDoorContactSwitch.groovy

2 Likes

Hi Jonathan,
thanks a lot for taking time to do this !
maybe i did a mistake, but it does not work for me, the parent still receives the door/contact status as open or closed, and if i press the button also, but not the child device if I select "generic component garage door contact/switch" in the user drivers, it throws errors:

dev:9092022-06-08 15:32:43.645 errororg.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: user_driver_component_Generic_Component_Garage_Door_Contact_Switch_960.refresh() is applicable for argument types: () values: [] Possible solutions: every(), parse(java.util.List), every(groovy.lang.Closure), grep() (method refresh)
dev:2482022-06-08 15:32:43.485 infoMaison is 23.4°C
dev:9092022-06-08 15:32:40.828 errororg.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: user_driver_component_Generic_Component_Garage_Door_Contact_Switch_960.refresh() is applicable for argument types: () values: [] Possible solutions: every(), parse(java.util.List), every(groovy.lang.Closure), grep() (method refresh)
dev:9092022-06-08 15:32:37.746 debug[]
dev:9072022-06-08 15:32:37.737 infoGarage Door contact is open
dev:9092022-06-08 15:32:21.424 infoGarage Door contact is closed
dev:9092022-06-08 15:32:21.422 debug[[name:contact, value:closed, descriptionText:contact is closed]]

I have Carro Smart Ceiling Fans (specifically, the Innovator fans from Home Depot.) I went looking to try and connect them to Hubitat, but couldn't find any info on it. Eventually I discovered they're just rebranded Tuya/Smart Life WiFi fans. Carro even has it's own app, which is just a rebranded Tuya/Smart Life app.

For anyone else like me looking for information on how to automate these fans, you can add them to Hubitat with this driver. The important step is to create an a separate Smart Life account, and re-add your fans to that account. The Carro account/app won't let you get the API and Secret keys you need for this. Once you do, you can control them with the SmartLife app just like you could the Carro app.

These fans are interesting because they're three devices. The fan, the yellow LED light, and the white LED light. Unfortunately, this driver will only work to turn the fan on and off. It won't control the speed or the lights. Possibly because it's using non-standard values for things. I poked around and discovered the fan speeds are from 1 to 10, and the brightness on the lights is from 1 to 1000.

Are you still actively developing this driver? I know enough about programming and scripting that I could probably get a version of it working on my fans, but you would have a better idea about how to do it faster.