[BETA] Tuya Cloud Driver (Limited device support)

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:

Hi there - I have a ceiling fan smart switch I just cannot get to work in Hubitat. It's a Tuya compatible "Treatlife" branded fan switch with 4 speed settings. Model DS02F

It appears automatically after syncing with Smartlife/Tuya as a "Generic Component Switch" but none of the functions work in Hubitat. I have tried every other device type and still cannot get it to even simply turn on and off (through preferably I would like the speed settings to work as well.)

I have logging enabled but nothing seems to imply what the issue is. It just shows that I clicked "off" or "on" but nothing happens with the fan itself. How do I begin to get this working?

Yep, that device was not in the driver and it turns out there are some quirks to deal with but I think I may now have it supported in the development branch.

Update the driver from https://raw.githubusercontent.com/bradsjm/hubitat-drivers/development/Tuya/TuyaOpenCloudAPI.groovy and then remove the device and refresh the driver and it should pick up the fan as an actual fan device.

That is an interesting error that I have not come across before and I don't see anything on line 486 that seems to be a problem so I may need some additional details to track this down by enabling the logging in the driver and capturing a log when you are trying to set the color.

Hmm. Well I did what you instructed but it still doesn't control the fan. I updated the groovy file for the device driver code. Removed the fan from Tuya Smartlife devices, then resynced with Tuya and the fan re-appeared in the sub list of Smartlife devices with the fan device type as Generic Fan Control. It says the fan is "on" and speed "low", but I cannot change any of the settings. ie. cannot turn off.

I'll need some debug logging, enable debugging in the main Tuya driver and then change speeds and power etc. so I can see what commands are being sent and received.

I put a log statement in just ahead of that line and for what ever reason, the map didn't include the level property at all. so I commented out the line and used:
if (colorMap.level == null) {
colorMap.put("level", dw.currentValue('level'))
}
which works.
So a few minutes ago, I left the debug statement in and swapped the code back to the original line. I'm seeing the level value in the map this time, but the line still fails with that error message.

    log.debug("my color map ${colorMap}")
    colorMap.level  = (colorMap.level != null) ? colorMap.level : dw.currentValue('level')
    //if (colorMap.level == null) {
    //    colorMap.put("level", dw.currentValue('level'))
    //}

Logs dev:6502022-08-04 12:50:00.786 pm errorgroovy.json.internal.Exceptions$JsonInternalException: Not that kind of map on line 487 (method componentSetColor)

dev:6502022-08-04 12:50:00.745 pm debugmy color map [saturation:94, hue:17, level:89]

So now I'm confused :smiley: