[BETA] Tuya Cloud Driver (Limited device support)

Can you check that the driver you have shows version 0.2.1 in the changelog and that you removed the previous child device. Then refresh the devices and in the logs it should have a few lines when it re-creates the device I'd like to see. I'm traveling the next few days so may be delayed in answering.

Yes, the driver is 0.2.1:

I deleted the child devices, then deleted and recreated the parent Tuya virtual device. I then hit "initialize," which recreated my 5 devices. Those for the 2 channel switches (I have two of them, called heat pump 1 and heat pump 2, each with two channels) show only one on/off control.

The log is verbose; I hope this includes pertinent info:

Just tested it on one of my lights. Connected up fine - but apparently this light uses DPS 20 for on/off ( :woman_shrugging:)
... parsing dps [20:false, 21:white, 22:165, 23:412, 24:000003e803e8, 25:000e0d0000000000000000c80000, 26:0]

Using the Send Custom DPS didn't work (I'm guessing because it was sending the string "false" not a boolean false). Had to edit the dps number in the driver on/off functions, and now it works perfectly for that light.

Could we make the on/off dps number configurable? :slightly_smiling_face:

@cometfish I added the power DPS as configurable in the development branch here to try. I also added code that will convert boolean "true" and "false" properly for custom DPS commands.


@eelton I'm really not sure why it didn't work so I have added some additional logging to help me understand in the development branch to try:


Just following up here. I had not tested the effect functionality because I was using the DPS values. I have configured for the 9 built in scenes with this driver and all the effects are calling by number and prev/next effect. I did some testing and I was confident enough to program out the year of lighting scenes in WC. thoroughly pleased with the results and the local part is working great too.

@jonathanb I assume you changed something other than logging, as it now works properly...unless of course I had made some error before, which wouldn't be surprising. At any rate, thanks so much!

It created one device called "switch," plus others called "socket 1" and "socket 2." The socket 1 and 2 devices work as expected, controlling the two switches of the relay. (The "switch" one turns both channels on and off together.)

Screenshot 2021-12-14 212944

Works perfectly, thankyou! :smiley:

I tested this but couldn't get it to work - the 'false' doesn't turn it off.
(Not a problem for me now that I have the DPS setting).

That turns out to be because I hadn't actually committed that change to github but now it is. Happy to hear it is working for you!

Hi, I noticed that my lights weren't turning on. I checked the logs and saw this:

dev:7312021-12-18 04:48:08.014 pm errorTuya tuyaSendDeviceCommandsAsync Error - Access token is null
dev:7312021-12-18 04:48:08.012 pm debugTuya device 0220049068c63aad61d2 command [[code:switch, value:false]]
dev:7312021-12-18 04:48:08.010 pm infoTurning Porch Lights off
dev:7312021-12-18 04:44:00.349 pm errorTuya tuyaSendDeviceCommandsAsync Error - Access token is null
dev:7312021-12-18 04:44:00.347 pm debugTuya device 0220049068c63aad61d2 command [[code:switch, value:true]]
dev:7312021-12-18 04:44:00.344 pm infoTurning Porch Lights on

I went into the parent Tuya device and hit refresh and initialize but they both gave errors too

-- hit refresh --
dev:7312021-12-18 04:49:55.501 pm errorTuya cloud request error Default URI is null, and no 'uri' parameter was given
dev:7312021-12-18 04:49:55.481 pm debugTuya API GET [uri:null, path:/v1.0/iot-01/associated-users/devices, query:[last_row_key:], contentType:application/json, headers:[t:1639864195472, client_id:7ssh3mjgb3qixla77woj, Signature-Headers:client_id, sign:9ABA70E8C7582DA44D5103800B393787D0378C60B750B27A50C0DEF9021D690E, sign_method:HMAC-SHA256, access_token:, lang:en], body:null, timeout:20]
dev:7312021-12-18 04:49:55.469 pm infoTuya requesting cloud devices batch
dev:7312021-12-18 04:49:55.466 pm infoTuya clearing json cache
dev:7312021-12-18 04:49:55.463 pm infoTuya refreshing devices

-- hit initialize --
dev:7312021-12-18 04:49:33.894 pm errorTuya cloud request error Default URI is null, and no 'uri' parameter was given
dev:7312021-12-18 04:49:33.866 pm debugTuya API POST [uri:null, path:/v1.0/iot-01/associated-users/actions/authorized-login, query:null, contentType:application/json, headers:[t:1639864173836, client_id:7ssh3mjgb3qixla77woj, Signature-Headers:client_id, sign:FE20E3F25D7FA01A7E150A8FA0E0F5E384B98EADDA6841290A56DCC33D6AA558, sign_method:HMAC-SHA256, access_token:, lang:en], body:{"country_code":1,"username":"XXX@gmail.com","password":"XXX","schema":"smartlife"}, timeout:20]
dev:7312021-12-18 04:49:33.811 pm infoTuya starting Tuya cloud authentication for XXX@gmail.com
dev:7312021-12-18 04:49:33.800 pm errorTuya Country not set in configuration
dev:7312021-12-18 04:49:33.773 pm infoTuya driver initializing

The last thing I did was hit Save Preferences at the bottom -- no changes to any of the settings -- and that worked. Everything is running again.

Just thought I'd share.. not sure if there's something happening in the Save Preferences that might need to be done periodically or isn't happening.

Is there any functionality for Tuya connected cameras? I have a device which is listed, but just has on and off status listed:

Would it be possible to get motion alerts somehow? (these are possible in the Smartlife app).

My switches work lovely, thank you very much!

Edit: captured the camera details from the device page in case it helps…

Thank you!

Wow, I have been searching for this for ever! Thank you! :slight_smile: (Would be great if Ewelink can work like this as well.)

I have two sockets with LED in them (one of them is RGB), and I can control the lights, however not the relays. I haven't found the right drivers for them ... Can somebody help?

1 Like

Same here. I have a glut of sockets so never got around to asking.

1 Like

Can you provide me with the data section from the child switch device it created, specifically, I need the category and the functions lines to see how it might be supported in the future :slight_smile:

1 Like

It should be possible however even after looking at the documentation it is not clear to me which Tuya code is used for motion alerts so if you could enable debug mode and then watch the logs and capture which code is sent when it detects motion, I am guessing it might be "motion_switch" that changes to true but I could be wrong.

Ok, thank you very much, will try it and revert.

I have the same issue so here are mine also. Thanks :slight_smile:

category: dj    
functions: {"switch_led":{"type":"Boolean"},"bright_value":{"min":25,"scale":0,"unit":"","max":255,"step":1,"type":"Integer"},"work_mode":{"range":["white","colour","scene","scene_1","scene_2","scene_3","scene_4"],"type":"Enum"},"colour_data":{"h":{"min":1,"scale":0,"unit":"","max":360,"step":1},"s":{"min":1,"scale":0,"unit":"","max":255,"step":1},"v":{"min":1,"scale":0,"unit":"","max":255,"step":1},"type":"Json"},"scene_data":{"h":{"min":1,"scale":0,"unit":"","max":360,"step":1},"s":{"min":1,"scale":0,"unit":"","max":255,"step":1},"v":{"min":1,"scale":0,"unit":"","max":255,"step":1},"type":"Json"},"flash_scene_1":{"h":{"min":1,"scale":0,"unit":"","max":360,"step":1},"s":{"min":1,"scale":0,"unit":"","max":255,"step":1},"v":{"min":1,"scale":0,"unit":"","max":255,"step":1},"type":"Json"},"flash_scene_2":{"h":{"min":1,"scale":0,"unit":"","max":360,"step":1},"s":{"min":1,"scale":0,"unit":"","max":255,"step":1},"v":{"min":1,"scale":0,"unit":"","max":255,"step":1},"type":"Json"},"flash_scene_3":{"h":{"min":1,"scale":0,"unit":"","max":360,"step":1},"s":{"min":1,"scale":0,"unit":"","max":255,"step":1},"v":{"min":1,"scale":0,"unit":"","max":255,"step":1},"type":"Json"},"flash_scene_4":{"h":{"min":1,"scale":0,"unit":"","max":360,"step":1},"s":{"min":1,"scale":0,"unit":"","max":255,"step":1},"v":{"min":1,"scale":0,"unit":"","max":255,"step":1},"type":"Json"},"switch":{"type":"Boolean"},"countdown_1":{"unit":"s","min":0,"max":86400,"scale":0,"step":1,"type":"Integer"}}


This is for this device: https://www.aliexpress.com/item/4000976177677.html?spm=a2g0s.9042311.0.0.27424c4d7e4pqV

  • functions: {"switch_1":{"type":"Boolean"}}
  • local_key: 4a23a332f05985cc
  • product_id: dYn2mDKmgV2Zz2YX
  • name: 欧规情景插座
  • online: true
  • label: Dóri Socket 1
  • id: 33705654500291446f29
  • statusSet: {"switch_1":{"type":"Boolean"}}
  • category: cz

And this is for this: https://www.aliexpress.com/item/4001054135948.html?spm=a2g0s.9042311.0.0.27424c4d7e4pqV

  • functions: {"switch_1":{"type":"Boolean"},"countdown_1":{"unit":"s","min":0,"max":86400,"scale":0,"step":1,"type":"Integer"},"switch_led":{"type":"Boolean"},"work_mode":{"range":["white","colour","scene","music"],"type":"Enum"},"bright_value":{"min":10,"max":1000,"scale":0,"step":1,"type":"Integer"},"countdown":{"unit":"s","min":0,"max":86400,"scale":0,"step":1,"type":"Integer"}}
  • local_key: a8f19148bd6de505
  • product_id: zl2a1zvzfwcdwq3n
  • name: 小夜灯智能插座
  • online: true
  • label: Konyha lámpa
  • id: bf54a4eff2c7e4eb79vkok
  • statusSet: {"switch_1":{"type":"Boolean"},"countdown_1":{"unit":"s","min":0,"max":86400,"scale":0,"step":1,"type":"Integer"},"switch_led":{"type":"Boolean"},"work_mode":{"range":["white","colour","scene","music"],"type":"Enum"},"bright_value":{"min":10,"max":1000,"scale":0,"step":1,"type":"Integer"},"countdown":{"unit":"s","min":0,"max":86400,"scale":0,"step":1,"type":"Integer"}}
  • category: qjdcz

Thank you! :slight_smile:

Please give my development branch code a try and see if it creates an additional switch device that will control the relay in each of the sockets.


Please try my updated development driver but remove the night light device and then refresh or initialize the main parent and I think it will create the correct devices for your night light.