[App][Pro] Tuya Cloud

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)

:exclamation: Important note about not by default supported devices or functions, there is hope; so please read on :exclamation:

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

:one: 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

:two: 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.

  1. 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)
    • 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
  1. Now go to the Tuya Cloud app setup/configuration page in Homey mobile app or Homey web app
  2. Set the API to use to Use Official only
  3. 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
  4. 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
  • The Access ID and Access Secret you entered are not correct. For more information, see entering credentials step in Install Tuya Integration.
1106 permission deny
  • Your app account is not linked to your cloud project. This operation is a must-do. For more information, see Link devices by app account.
  • Incorrect account or password. You must enter the account and password of the mobile app that you use to scan the QR code for linking devices to your cloud project on the Tuya IoT Development Platform.
  • Incorrect country. You must select the region of your account of the Tuya Smart app or Smart Life app.
1100 param is empty
  • Empty parameter of username or app. Fill the parameters refer to the entering credentials step in Install Tuya Integration.
2406 skill id invalid
28841105
  • no permissions
  • this project is not authorized to call this API
  • insufficient API permissions.
  • <l/ul>
  • You need to subscribe to the required API services and authorize your cloud project to use these API services. → The following API services are required:
    • Authorization
    • IoT Core
    • Smart Home Scene Linkage
    • IoT Data Analytics
    • Device Status Notification

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. ←

  1. (Optional) If you do not find the data center you want to use, click the Overview tab and then Edit to add data centers.

  2. 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.

  3. 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.
  1. Click Extend Trial Period.

  2. Complete this form.

  3. 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: :exclamation: 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. :exclamation:


(2024/06/03 Adjusted, updated and refreshed by @Peter_Kawa )

12 Likes

Changelog

0.0.2 First version in App store

2 Likes

Great! Thanks for adding this app to homey. I already did a feature request on github; but can you add support for the water sensor? Here is a link to the product:

€ 15,47 26%OFF | NEO Smart WIFI Water Flood Sensor WIFI Water Lekkage Detector App Kennisgeving Waarschuwingen Water Sensor Alarm Lek Alarm Thuis Securit
https://s.click.aliexpress.com/e/0lwSFZ3XH

1 Like

Sensors are currently not supported by the Tuya API. When the Tuya API supports sensors, I will look into it.

I have this thingie conected via this app:

4 sockets to be operated separately. 4 USB ports to be operated as 1 switch. And 1 switch to turn them all on/off at once.
Needed to build in a delay of 2 seconds to turn all the sockets on tho.

4 Likes

Great App. I bought myself an LSC Smart light by the Action and it works verry good

1 Like

Did you try to make a scene inside Tuya/Smart life app where you turn on or off all the sockets and call this scene from homey? I do this for my 6 living spots and works well. They turn on and off faster then my lights in dinner room which still have Ikea zigbee spots ( tried direct to homey and gateway).

Gonna try, ill let u know.

Edit: Did try to make a mood but same behavior. So maybe some interference from some other devices here.

1 Like

Too bad the solution didn’t work for you.

Hi @Jurgen_Heine.
I have a color problem with the lights from several brands (Deltaco and Kjell) using your app.

Example:
Deltaco SH-LE27RGB-f160 adds nicely and everything but color works great.
The device does not have a color wheel.

Using the other Tuya app the devices have the color wheel and all is working.

Any ideas what’s wrong?

This looks promising. I have 2 ceiling fans that uses TUYA embeded controllers
 I use the smart life app to control them
 looking forward to this app supporting fans!

1 Like

How can you use a mood? I have a few moods in my smart life app, but homey says there’s nothing?

Can u also try that with the Tuya app instead of the smart life app?

Haven’t tried the Tuya app, because I like the smart life app better. But this is maybe the problem, when it only works with the tuya app.
I use a hue motion sensor in the bathroom with the lsc ceiling light, so it would be nice to use the moods, for example morning, day and night

is it possible to add the LCS Sirene to the app. The app itself look good, but it didn’t find the sirene, i saw only 2 options for adding.

@johan_bendz, how are those lights coupled in the Tuya/Smart life app? If this is ledstrip, then colors don’t work in Homey. This app uses the Home Assistant Tuya API which not supporting this for ledstrips yet. The other App is using a different method with local control. You can stay with that app, also you can control the colors with scenes.

@viix, fans are possible to add. I have to look into this, I don’t own one of those. Maybe you can help testing when I add those.

@Marina_Rietveld, I am using Smart life myself and should work. But I looked this morning in Smart life app and they changed the user interface. I still see my scenes, but they are called in the app now “tap-to-run”. You have now set condition to “click to execute” and in the task you define what your device has to do. The name you enter here is also the name of the mood in Homey. This name was limited, but not anymore. It looks like too long names are not working correctly.

@marcel_ridder, Sirens are not possible at the moment.

That’s correct Jugen, I have a few of these tal-to-run but none of them are visible?!
homey|241x500


Have you tried to set a mood?

1 Like

Yes, I have made a test this morning. The last one is the test mood of this morning.

But can you see/select it when you make a flow?

When I select “kies een item” there is nothing