[BETA] Tuya Cloud Driver (Limited device support)

Hi Jonathan, Thanks for that!

I tried this exact same thing yesterday without success ( I also tried different variations )

result:
Unable to determine open function code in [switch_1:[type:Boolean], countdown_1:[unit:s, min:0, max:86400, scale:0, step:1, type:Integer], tr_timecon:[unit:s, min:10, max:120, scale:0, step:1, type:Integer], countdown_alarm:[unit:s, min:0, max:86400, scale:0, step:1, type:Integer], door_control_1:[range:[open, close], type:Enum], voice_control_1:[type:Boolean], door_state_1:[range:[unclosed_time, close_time_alarm, none], type:Enum]]

based on the available functions:

  • functions: {"switch_1":{"type":"Boolean"},"countdown_1":{"unit":"s","min":0,"max":86400,"scale":0,"step":1,"type":"Integer"},"tr_timecon":{"unit":"s","min":10,"max":120,"scale":0,"step":1,"type":"Integer"},"countdown_alarm":{"unit":"s","min":0,"max":86400,"scale":0,"step":1,"type":"Integer"},"door_control_1":{"range":["open","close"],"type":"Enum"},"voice_control_1":{"type":"Boolean"},"door_state_1":{"range":["unclosed_time","close_time_alarm","none"],"type":"Enum"}}

and the status of the component when I manually press the physical button on the device ( it is just plugged in on my desk ):

Current States

  • door : closed
  • switch : on

I would imagine that "switch"/"switch_1" is the one to activate.

I did not find any specifc instructions on the parent driver ( maybe it needs to be added, idk)

soooo

I tried multiple things, and utimately, this worked - but not perfectly:

// Component command to open device
void open() {
if (device.currentValue('door') != 'open') {
//parent?.componentOff(device)
parent?.componentOn(device)
// pauseExecution(200)
// parent?.componentOff(device)
//parent?.componentRefresh(device)
}
}

// Component command to close device
void close() {
if (device.currentValue('door') != 'closed') {
parent?.componentOff(device)
parent?.componentOn(device)
//pauseExecution(85)
//parent?.componentRefresh(device)
//parent?.componentOff(device)
}
}

that is the only way it physically worked (it needs the off before ON when requesting a close commend -- go figure )

as you can see, i tried ( lines added as comments will be removed) to set the device switch status to off ( to reflect reality ) without success, in hubitat, the device status for "Switch" always stay as "on" for open command, and OFF for close command, so i suspect that the functione is not perfectly the right one...

now... the physical switch returns automatically to OFF after 1 second, which is as expected for a garage door activation, I simply need to find a way to either update from physical, or program it to off
physically pressing the button on the device shows "on" for one second in the Hubitat device status, then back to "off" --> that is the expected behavior.

hope this helps

I have this Tuya light that has both a main CCT light and a RGB strip on the back. 35W Smart Wi-Fi Ceiling Light Flush Mount Compatible with Alexa Dimmable Low Profile Ambient Light for Bedroom Living Room | Ceiling Lights | Tuya Expo

The to controllable outputs show up as a single device in the Smart Life app. When attempting to control the light from Hubitat the device reports a CCT mode when the main light is on, RGB when the RGB was last controlled from the app, scene mode, and music mode. If I press ON/OFF it will turn on/off the light of the select mode. I am also able to put in a color temperature and the light will switch to CCT mode. However, there is no way on the device page to switch the device mode and even when in RGB mode I am unable to change the color. Can functionality for this device be added to the driver?

Really impressed with the resu!ts above ... but I'm stuck at the authentication -- any ideas, suggestions? :expressionless:

I tried to add a screenshot, was blocked; here's the text:
Errors include:

  • Cloud API request failed: {"code":2406,"msg":"skill id invalid","success":false,"t":,"tid":""}
  • Unable to request homes (null uid token: [access_token:, expire:])

Hi guys, have not read the entire thread but did manage to get hubitat to detect my 2 devices last night. By following the instructions in the first few posts. After installing the universal blind driver i managed to get one child device (but it does detect 2 devices on my tuya cloud)

My question is.... i accidently purchased a bluetooth am43 blind roller, which although works from the tuya app, i understood bluetooth was no good.

I then purchased (£10) the tuya wifi mesh gateway hub, in the app the hub recognises the blinds so thumbs up.

But i cannot get hubitat to see the wifi hub, but even if it does detect it, will i be able to use these 2 items together to get hubitat to be able to open my blind? Or should i just cut my losses and buy a zigbee am43 :joy:

It is not needed for this integration that the Tuya WiFi gateway shows up as a child device. It will be a transparent device, communicating via BlueTooth to the blind roller and via Wifi -> your home router -> Tuya Cloud -> this Hubitat driver.

Is the child device created by this integration assigned the Generic Component Window Shade driver? If yes, then you should be able to control your BlueTooth blind roller.

Hi, I'm having an issue and trying to track it down. I have 2 Tuya smart plugs configured.

  • one of them (porch lights) is setup to turn on at sunset and off again at 10 PM
  • the other (garage fridge) isn't used.. I want it to stay on all the time and only added it so I could get an 'offline notification' that Tuya sends in case the power goes out for some reason.

But, what I'm seeing is the garage fridge plug is turning on and off (in addition to the porch lights one). I verified in the Tuya app (SmartLife) that there's no schedules setup so I have to think it's being controlled by the Hubitat driver.

In fact in the garage fridge 'events' page I see the device being switched on and off (screenshot). Any idea why? I verified this plug isn't used in any other apps

The 1 thing I did do recently is change the name of the plug in the SmartLife app. Could this have messed something up?

@jonathanb Just added suppoort for this and more :slight_smile:

1 Like

I just merged it, I had no idea that option even existed in Tuya, that could open up a bunch of possibilities.

1 Like

I see that though you will see that regardless of how the switch is being toggled because Tuya cloud will send that attribute change update and the driver will update the value creating an event. If the driver sends the command it will be in the Tuya (parent device) logs.

Changing the name should not have been an issue because everything in the code uses the internal ID not the name which would not have changed.

When you look at the garage switch device at the bottom of the page in the "In Use By" section, is anything listed there?

This is one of the most maddening errors without a specific single cause. It is often attributed to having the country not match with the datacenter your devices are in and/or the region set up when you created the Tuya project.

What country code did you use when you first set up the Tuya app on your phone? What datacenter is selected for the project in the Tuya Cloud and which country are you choosing in this app?

It is yeah. So the good news is, im on the right track :grin:

I will fettle around more with the tuya app and the cloud settings etc.

Thankyou for pointing me in the right direction

1 Like

Hi Jonathan and guys,

I wrote a post a few days ago asking for help. I realized I didn´t explain myself with my comments because I posted a screenshot with wrong data, and when I realized about it, I mentioned that I was using now the right data. I never mentioned that anyways it was still not working.

The news is that somehow (don´t really know why), the app started working after a couple day´s struggling, and IT WAS GREAT!!!

The bad news is that after a couple of weeks, it quit working without any reasonable cause. Now I have a bunch of Tuya devices on it´s way, and this better work! :wink:

BTW, when it worked, it was with the TUYA SMART app, and NOT the Smart Life app.

I´ve been playing and struggling with this for two weeks without any success, erasing, reconfiguring, resetting, etc., with no luck.

I just realized there are some differences between a screenshot I made when it worked, and now that it doesn´t. FYI, I´m in Mexico (Code 52).

I´ll post both screenshots and will appreciate any help to make this app work again for me.

Screenshot when the app worked (Please notice the MQTTINFO line on the State Variable section, under endPoint)

Screenshot when the app doesn´t work where there is no MQTTINFO line

Any help will be much appreciated, besides Santa will be generous to you guys!

You will need to look at the log file, when it shows "error" state then the actual error will be logged. It is unusual to be able to get a valid token and then get an error so we might need to turn on the debug logging but first we need the error message itself.

I chose US east, and USA for country; there were too many choices to try other countries without some guidance, although I did try China and Canada, with no improvement.

I would suggest selecting the Western America Data Center (or just select both eastern and western) since most likely the Tuya application on your phone that you are using will be using the default Western.

On your phone app, make sure it is set to use the US and country code 1. Everything must line up for this to work, the phone app and the cloud and the driver must all be set to the same datacenter! If any one of them isn't, then it won't work...

Jonathan last night I did as suggested, turned on the Debug Logging option, and here is what I got:

As you can see, the error was this:

errorCloud API request failed: {"code":28841002,"msg":"No permissions. Your subscription to cloud development plan has expired."

So now I had a better way to focus on a problem. I never considered this option as I only registered a few weeks earlier and didn’t think Tuya would cancel my permissions so early,

I searched on the web how to solve this, and I found a link with all instructions to do so:

I discovered that Tuya gave me just ONE month authorization, so
I followed all instructions to renew it, and the most I could get was 6 months!! And had to wait for the authorization (hours or days), and this morning my Dashboard lit up as a Christmas tree and everything worked again!

Many people mention that they just discovered they had been working with voided authorizations for months, but it seems Tuya just noticed it, and suddenly they shut the door to voided authorizations.

I hope my experience will be of help to anyone having the same problem.

Thank you very much Jonathan for your support.

4 Likes

Thank you, I noticed my subscription has also expired and I can no longer see my devices in the IOT portal or change anything but for some reason it has not stopped working for my existing devices yet...

I just tried to set up my HE link to Tuya and its giving me an error on authentication. Apparently it's trying to access https://openapi.tuyaus.com, and is giving an error of Temporary failure in DNS Resoulution, so it can't log in. Did I miss something in an update?

I Have a Treatlife Ceiling Fan and Dimmer Switch Combo. DS03. This driver pulls in both however only the fan control switch works. The light dimmer portion of it is not responding to commands from Hubitat. It works fine in the Tuya app.

Will try -- in the app, I can't change region, says "United States of American/Can..." [cuts off]. The linked mobile number is region 1