I developed this cloud driver for my personal use because I have some Tuya WiFi bulbs that can't be converted to Tasmota at this time and so I decided to port some of the code Tuya published on Github so I could get basic control of them from Hubitat. I have limited ability to support this driver but think it is useful and functional enough to share with the community.
Features:
- Downloads your device list from Tuya and creates child-devices automatically
- Supports push updates from Tuya for near immediate attribute updates
- Extendable to support other devices in the future
Pre-Requisites:
-
You will need to create a developer account at Tuya (if you have one, make sure it is recent as old accounts will not work due to changes in encryption made by Tuya for new projects)
-
Follow the instructions at Tuya Smart Home PaaS Configuration to create your developer account (it is free and you will not have to pay even after your first year according to Tuya devs)
-
The directions will have you create the project, make a note of your access key and secret and then link your existing Tuya app account to the new developer account so you can see your devices.
Ensure that you have selected the four required API services especially Device Status Notification, Smart Home Scene Linkage, IOT Core, Authorization.
-
Install the driver into Hubitat. You can either download directly from https://raw.githubusercontent.com/bradsjm/hubitat-drivers/main/Tuya/TuyaOpenCloudAPI.groovy or if you are using the Hubitat Package Manager you can find it listed in there.
-
Create a new virtual device and select the new Tuya user driver
-
You must populate the driver fields:
a. Tuya Access Key/Client Id (from the instructions in section 3 above)
b. Tuya Access Secret (also from the instructions in section 3)
c. Select the correct Tuya Application you are using on your phone, in my case, I use the Tuya Smart Life app (with Tuya logo). See this link for details Smart Life App Overview-Tuya IoT Development Platform-Tuya Developer
d. Provide your Smart Life app login email and password (this is not your cloud login but the one for the phone app)
e. Select the country that you are using with the Tuya app when you registered it
NOTE this step is the most often seen issue for the driver not to work, you may need to try other countries if you cannot authenticate.
-
The driver will now attempt to download the list of your devices from the cloud and create child drivers for each one, if the device is not known, it will just create a switch device for on/off
Remember that the API this driver uses is itself in beta. I've found that the API provided by Tuya is limited in its support for advanced features of devices and there are many revisions of Tuya products out there that have different protocol versions with tweaks required in the code for them so what works on one vendor device may not work the same on a different vendor device of the same type. Caveat emptor!
If things sudden stop working it is probably because your trial subscription has expired. Follow these instructions to renew it: ℹ️ Tuya integration not working · Issue #80278 · home-assistant/core · GitHub