Tuya Cloud app
NOTE: This app is no longer actively maintained, only PR (Pull Requests) will be merged and published as update;
The developer does not respond to questions / requests any longer.
App store:
Test version (with more supported devices):
Homey App for the Tuya cloud
The word API will be used often. So, what is that about?
API = special developed connection between Homey and Tuya servers
The official API is now supported.
It requires an extra development account and keys.
This app was based on the Home Assistant implementation. Tuya has an undocumented API for Home Assistant that differs from the official API.
When you were already using this app, please note the existing devices will still use the old API! Itâs best to migrate them
So, please read carefully:
You have to remove the current Tuya Cloud device from Homey;
only after youâve completed this procedure succesfully, you can add those devices again to use the functionality of the official API.
If you donât need the legacy devices anymore, you can just delete the legacy devices. And then, when you donât have legacy devices anymore, set the API dropdown (= item selector) to âUse Official only
â.
Supported devices
- Light
- Switch
- Socket
- Dehumidifier
- Air conditioner
- Thermostat
- Garage Door Opener
- Window coverings / Blinds / Curtains
- Heater
Sensors:
- Presence
- Motion (PIR)
- Contact
- Smoke
- CO
- Flood (water detection)
Important note about not by default supported devices or functions, there is hope; so please read on
Now, thereâs no need to ask for support or make requests, because there are two little workarounds make it work anyways:
A. Homey can talk to almost any Tuya Cloud device
B. Almost any Tuya Cloud device can talk to Homey
Only when device is supported by API, itâs possible to add the device to this app. because I donât own all device types, itâs hard to implement a device type which I donât own. Contributions to code are welkom to add unsupported devices. Other possibility is to use raw commands
Raw commands
When youâre familiar with MQTT: this is Tuyaâs kind of flavor
Every event (a switch turned on, a temperature dropped) emits a message, containing the device ID, a Function name, and, its Value.
You can receive all those messages with special trigger cards (a.k.a. WHEN cards), and by creating the necessary flows with it, control Homey devices this way!
Thereâs also action cards (a.k.a. THEN cards) available as well, in order for you to send commands to your Tuya device.
This way, you can interact with not directly supported devices using commands. Combine it with the Virtual Devices app, or with advanced virtual devices (Device Capabilities app), and you can control most of your devices.
Itâs a functionality you have to learn at first to get the hang of it, but once you get it, it is pretty straight forward.
Note: Itâs a âfire-and-forgetâ functionality; a command to your device isnât getting confirmed/acknowledged.
To get the device idâs, commands and possible values, you can create a flow with the text event received trigger card. This card is returning device id, command and value for each action. Log the returned values to log app to know the commands of your devices, device idâs and possible values.
Pls read the detailed RAW commands howto by @Peter_Kawa
Scenes / tap-to-run scenes
This app support the use of scenes. In the mobile Tuya/Smart life app you can make âTap to runâ actions( In the past they where called scenes). Those actions can be called in a flow from this app.
The scenes for the official API are not automatically updated, for now new scenes will only appear after a restart of this app.
Pls read the detailed tap-to-run howto by @Peter_Kawa
App setup @ Homey
In order to use the new API, you should follow the same basic instruction manual as for Home Assistant / Homebridge.
- Follow this link, and read the contents carefully: Tuya IoT Platform Configuration
The services have some new names and are not updated in official Tuya documentation:
-
- IOT Core (Controlling devices from Homey)
-
- Authorization => Authorization Token Management (Authentication)
-
- IOT Data Analytics => Data Dashboard Service ( See
Devices
in Development Portal)
- IOT Data Analytics => Data Dashboard Service ( See
-
- Smart Home Scene linkage (Needed for trigger scenes from Homey)
-
- Device Status Notification ( Needed for getting data from Tuya to Homey)
To actually watch the steps youâd take, take a look at this video
- Device Status Notification ( Needed for getting data from Tuya to Homey)
- Now go to the Tuya Cloud app setup/configuration page in Homey mobile app or Homey web app
- Set the API to use to
Use Official only
- The authorization âAPI Access IDâ and âAPI Access Secretâ from step 1, have to be entered on this settings page.
The COUNTRY CODE is used to determine which data center has to be used and must match with your android app and region of your project. Only the number is allowed, no leading zeroâs or + sign: SEE SCREENSHOT .
Look in the link for correct numbering, it can be different for some countries then the known phone prefix.
Mappings Between OEM App Accounts and Data Centers-Documentation-Tuya Developer - The Username (which actually is the email address you used) and Password are the same as the ones you registered the mobile app with.
â Make sure you used a REAL email address, it wonât work with Google, Facebook or other login methods!
â Itâs your mobile phone app login credentials, not your Tuya iot developer portal credentials, these are only used to logon to iot.tuya.com!
.
Error Codes and Troubleshooting
The app is passing the values to the Tuya API, and if the API is returning an error, you can find some solutions here.
You can view the error on the settings page of this app.
Please use the web app because it shows extended error messages.
When on settings page, you first must change a setting (just temporaryly)!
Without a change, there is nothing to saveâŠ
then press Save
, you should get an error message if somethingâs wrong,
or you get message to restart the app.
When you install the appâs test version, some of the errors should become available when using advanced flows, like this:
Error code | Message | Troubleshooting |
---|---|---|
1004 | sign invalid |
|
1106 | permission deny |
|
1100 | param is empty |
|
2406 | skill id invalid |
|
28841105 |
|
|
Tuya Integration FAQ
Q1: An error occurred, when I tried to scan a QR code to link my devices to my cloud project, see screenshot. How to fix it?
A1: This is because the data center you selected for your cloud project, cannot serve the region of your app account.
You must switch to the correct data center and scan the QR code again.
Mistake no. #1 :
selecting âWestern-Europeâ, without actually looking up your data center name in the sheet.
Itâs about DATA CENTER NAMES, NOT REAL REGIONS
â Check this sheet please: Mappings Between OEM App Accounts and Data Centers
and find the data center that can serve your region. â
-
(Optional) If you do not find the data center you want to use, click the Overview tab and then Edit to add data centers.
-
Click the Devices tab > Link Tuya App Account. Select the correct data center from the drop-down menu in the top right corner and click Add App Account.
-
Scan the QR code again to link devices.
Q2-a: Noooo, suddenly nothing works anymore, it was fine for months?
A2-a: When you entered your public IP address into the Cloud Application IP Allow list:
check if your public IP changed in the meantime, it happens. Adjust it in the allow list to fix it;
If not: most probably your IOT Core trial period expired, continue to A2-b please.
Q2-b: Will I be billed after the free trial of the API service expires?
A2-b: No. After your API service expires, go to Cloud > My Services on the Tuya IoT Development Platform to request extending your IOT Core trial period by up to 6 months.
-
Click Extend Trial Period.
-
Complete this form.
-
You will get the result within one working day.
- The Trial Edition allows you to use all free API services but puts limits on the quota of API calls. For more information about the quota, see Pricing.
Q3: Can I request Tuyaâs cloud services from an IP address outside of the data center region?
A3: Please note that data transfer across regions has a risk of violation of the data security regulations. If you request Tuyaâs cloud services from an IP address outside the data center region, you are at risk of illegally transferring data. For example, using an IP address in the U.S.A. to access cloud services in Chinaâs data centers will be regarded as data transfer across regions, and vice versa. Tuya will completely prohibit cross-region API calls and message subscriptions. Please deploy your cloud services properly to ensure data security.
(2024/06/03 Adjusted, updated and refreshed by @Peter_Kawa )