[BETA] Tuya Cloud Driver (Limited device support)

dev:112023-07-19 10:39:05.591 AMerrorCloud API request failed: {"code":1106,"msg":"permission deny","success":false,"t":1689788345213,"tid":"281b606f265b11ee804ade073cb82c5d"}
dev:112023-07-19 10:39:05.245 AMdebugAPI POST [uri:https://openapi.tuyaus.com, path:/v1.0/iot-01/associated-users/actions/authorized-login, query:null, contentType:application/json, headers:[t:1689788345244, nonce:b5b28617-1e8b-4d36-b950-0ead75c5d17c, client_id:ymj3y7gjnxe3yhwyqtrt, Signature-Headers:client_id, sign:A035EB5E425B2C1FC4F02DC332E5BC4A0605AAB1A9F2464C027A6B50DA9084B7, sign_method:HMAC-SHA256, access_token:, lang:en, dev_lang:groovy, dev_channel:hubitat, devVersion:0.3], body:{"country_code":"1","username

Permission Denied, that sounds like maybe part of the setup was done correctly. Did you do this as instructed:

Ensure that you have selected the four required API services especially Device Status Notification , Smart Home Scene Linkage , IOT Core , Authorization .


Are these the right services?

I also have Industry Basic Service not sure why, its not in the instructions.
Could really be any step you missed in the instructions of authorizing things.

@jonathanb are you familiar with this error posted above? Permission Denied

Greetings from Australia and thanks @jonathanb and other contributors. I just found this thread and driver today.

Got the integration going up to the point where it interrogates the API to get child devices. I can see a deviceCount of 3 but it fails to create them and has a state: error

The log shows it executing API GET [uri:https://openapi.tuyaeu.com, path:/v1.0/devices/xxx/specifications

However I'm getting a code:2009 "not support this device". JSON response is:

{"code":2009,"msg":"not support this device","success":false,"t":1689843869060,"tid":"6ee6802e26dc11ee8ac9ce4d0cb672c1"}
{"code":2009,"msg":"not support this device","success":false,"t":1689843868998,"tid":"6ede8f6926dc11ee94e0a2e0adfc0b14"}
{"code":2009,"msg":"not support this device","success":false,"t":1689843868692,"tid":"6eb0614526dc11eea28d7e2a94be2486"}

This is an IR/RF blaster and two remote commands for roller shutters (open/close).

I'm way out of my depth with I look at the driver code and API support doco. If it can't determine the category through the specifications API then I suppose there is a fudge required to create the devices in HE?

Hey @jonathanb ,

Great work!

All of my switches are the fan+light dimmer combo--the fan is working but the light isn't. I noticed earlier you mentioned adding more support for the combo switches, did you ever get around to adding/fixing this?

// EDIT: for clarity, your driver did enumerate the combo switch properly and split it out into a separate fan and dimmer control.

// EDIT #2: finished reading the thread; didn't see anything to address my particular issue. Did anyone else encounter this?

PS: if this is already answered, apologies--I''ve read through the entire thread but it's gotten LARGE :slight_smile: so possible I missed something.

Thx!

Adding Logs for light control events.

@limeypride I had a very similar problem with my fan which has a built in Tuya wifi controller. I could get the fan to work but not the light.

So far I’ve only got as far as getting the light to work on / off in hubitat and not change colour or dimmer settings. If this stop gap measure would help you take a look at my posts 430 and 433 in this thread and see if this works for you

1 Like

Thanks, @CharlesD!

I'll begin working through those steps once I'm done with work. I already have the IoT direct driver assigned to my loft fan but I'm having a helluva time pinning down its IP address--over 80 WiFi devices and 11 Tuya devices/switches. I figured I'd just use MAC vendor prefixes to narrow the list down only to find that Tuya have 14 or so assigned prefixes... sigh. Anyhoo, I'll figure it out. :slight_smile:

I'm assuming you had to tweak OP's original driver code. If so, could you post your mods--it'll probably save me a ton of time later if our switches happen to be compatible.

The ON/OFF only functionality is enough since what I'm really trying to get to for now is the ability to have the Hubitat keep my lighting sane during daytime hours and when we go to bed--OFF would be great.

Appreciate you jumping in!

Please see the solution provided by Jeff Page @jtp10181 here:

It's non-local but permits complete control over both the fan and the light including dimming functionality.

Thanks again, @jtp10181

1 Like

Has anyone had success removing scene/groups that have been deleted? I still have a couple that just won't go away, and new ones are not synching. Says [Deprecated] on the scene api thing, and won't let me renew...Seems they changed something.

I wish I had read this b4 I tried to work out why my Tuya automations had stopped working....

Hi @jonathanb

I've configured local control for RGB lights with the library/driver you linked a few years back. The one thing is that my lights are running the 3.4 protocol so I don't think it's working correctly and it just falls back to the cloud control. I tried searching but didn't see if there was an update for 3.4 bulbs.

I had wondered for a while why my device count was always 20 when I have more than 20 devices. So it appears in the json the code is looking for has_more but the json contains hsa_more :wink:
lines 1841 and 1842
LOG.info "Received ${result.devices.size()} cloud devices (hsa_more: ${result.hsa_more})"
if (result.hsa_more) {
once I made that change I get the proper count.

New to the Tuya world today, picked up a Treatlife DS03 Fan Light switch to retire the insufferable Hampton Bay zigbee controller.

So far I’ve gotten the FAN only working via this driver. Has anyone figured out how to get the light side working as well? Tried switching the child driver to Generic Component Fan Light Control, but that didn’t seem to do anything.

Has anyone got one of the Diffusers working with this?

i'm all set up, 2 child devices created, but as they are not recognised they are created as generic switches - the on/off switches the LED on and off on the diffuser.

Hey, did you find any solution for the camera? @Angus_M @jonathanb ?

Hi Guys, i'm completely new to this thread and its a very long one. i'm just beginning to set things up from post 1, point number 3. It's a brilliant piece of kit and thank you!

2 questions, where do i find these settings below? Secondly, it appears that groups of lights set up in Tuya don't appear in HE. If I set a group up in HE by using the Tuya devices, what would be the best driver to use. NB these are RGBW wall lights branded as Atomi but are actually Tuya https://www.costco.co.uk/Garden-Sheds-Patio/Garden-Decor/Outdoor-Lighting/Atomi-Smart-WiFi-Wall-Light-Pack-of-2/p/413762. Many thanks and appreciated... Stu

Is there anything I can do that will enable someone to help me add functionality to this driver for the Oil Diffusers that are commonly used?

They have the following functions:

LED - Switch On / Off
Spray - Switch On / Off
Spray Mode - Switch Large / Small

As it stands this driver will switch on/off the LED - is there a way the other functions can be added?

Device Status shown if it helps.

Thanks.

Hi,
I used this for a while with tuya app and smartlife app. But now my smartlife do not work anymore. I click initialize but it tell me: Cloud API request failed: {"code":1106,"msg":"permission deny","success":false,"t":2423525252,"tid":"235243gfd25252wer"}
The tuya still working... anybody with the same issue or an idea on how to solve it? My tuya account is up to date with all autorization that I renew each time!
Thanks!

Ok, I found out that if I create a new device from the start, it discover child devices and seems to work fine... So I turn the question like this: Why my parent device stopped working? And is there a way to replace old child devices with new one where its used, like webcore? One by one is a little too long and they have the same name so hard to choose the right one and I m not sure if I remove one device and allow the other if it would keep the name or if I wont be able to know wich device it was within pistons...