[BETA] Tuya Cloud Driver (Limited device support)

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.

If you can send me the "Data" section from the child device showing the category, status and function sets JSON I'll see how easy it is to add it.

Thanks!

@jonathanb is there any chance you can modify the “generic component window shade” Driver to more consistently get open/close status updates please?

I frequently see them stuck like this:

And they never change to open.

It seems to cause some issues with Alexa and homekit integration too. Eg open blinds or close blinds via vice command doesn’t do anything because the status is wrong.

I installed the tuya integration on my Home Assistant server out of curiosity, and it does get the status from tuya cloud.

Finally had time to reset the child devices to generic rgbw. The group dimmer works to turn on and off and dim.

Once I use the group dimmer, or individual lights, in Room Lighting, they only work when set to switch.

The funny part is the group dimmer device shows on/off appropriately but nothing happens.

Hi Jonathan, I followed the steps and all working super, I have only smart bulbs. Tiny problem with the status, it does update automatically, I have to refresh manually. Is there any solution or the only way is to create a virtual switch to control each bulb ?

Two changes in the development branch for the above issues:

  1. Added more support for cover state, it did not support the 'fully_open' and 'fully_closed' states which may be the cause of the erroneous state (per @dJOS)

  2. When setting brightness/dimmer value, enforce power on state, this may resolve the issue for @michaelahess

Development download link:

https://raw.githubusercontent.com/bradsjm/hubitat-drivers/development/Tuya/TuyaOpenCloudAPI.groovy

2 Likes

Hello, do you think that the Tuya M500 smart lock will work.

Probably not without some additional development work but shouldn't be too difficult to add.

2 Likes

Thank you for developing! I hoping I can get this to work for me. I'm having issues on the last step to add the child devices. It authenticates successfully but ends with an error.

Cloud API request failed: {"code":28841101,"msg":"No permissions. This API is not subscribed.","success":false...

My region is set to Bermuda, I'm wondering if that might be apart of the issue?

Likely one of two reasons:

  1. In Tuya portal go to Cloud>Projects>"MyProject">API then click "Go to authorize", "Select API", then click subscribe on "Smart Home Devices Management" in the dropdown. It takes you to the page for the API, click subscribe again, then click "basic edition" and "buy now" (basic edition is free).
    If the "Smart Home Devices Management" API is not listed under Cloud>Projects>"MyProject">API, you need to click "New Authorization" and select it.

If that is already selected then it is likely that the datacenter setting isn't actually mapping to the right Tuya datacenter or maybe country code. Bermuda is mapped to the EU data center (line 932).

Just wanted to report that the cloud integration works with the Cree branded PAR38 bulbs. You just have to pair them using the Tuya app instead of the Cree app. I wasn't able to get the local control to work. Even uninstalled the app from my phone to make sure there was no conflict. I was getting ACKs back from the bulb when sending commands, but nothing would happen. Even simple on/off control.

@jonathanb If you have any interest in seeing the logs, I can shoot them over, but not a huge deal for me.

https://www.lowes.com/pd/Cree-Lighting-Connected-Max-120-Watt-EQ-LED-Par38-Full-Spectrum-Dimmable-Smart-Flood-Light-Bulb/5013497225

1 Like

I cannot get my wifi curtain track to operate.
I have joined it successfully and it is seen as a child device



but getting the following error in Logs:

I can see these value in my Tuya developer project:

Is there something I need to edit in the Tuya JSON?
Thanks in advance, Ian

Fixed by updating to latest development branch release - thanks @jonathanb

Got my new color led strip lights last night and the color settings aren't working. More investigating this morning, this was in the log: 022-07-31 11:32:06.727 am errorgroovy.json.internal.Exceptions$JsonInternalException: Not that kind of map on line 486 (method componentSetColor)
So if this could be fixed in the repo, it would be appreciated :smiley: