Set Up Tuya Integration (Stable) in Home Assistant

Last Updated on : 2023-10-18 02:47:49download

This topic describes how to install the official Tuya integration in Home Assistant.

Requirements

This integration only supports the basic product categories, such as switches, lights, fans, thermometers, and hygrometers. For more information, go to GitHub to check the supported device categories.

It is not guaranteed that all the Powered by Tuya devices can work with the Home Assistant Integration. If your device is not supported by the integration, see this tutorial to develop the driver yourself.

Billing

For now, you can extend the trial period multiple times. However, Tuya does not promise it to be permanent. As the integration will make relevant adjustments accoding to the Tuya IoT Development Platform rules in the following years.

Prerequisites

Procedure

Install Home Assistant Core

After you have installed Home Assistant Core (v2021.10.4 or later), you can search for and set up the Tuya integration in Home Assistant.

Set Up Tuya Integration (Stable) in Home Assistant

Set up

  1. Enter localhost:8123 into the address bar in your browser and hit Enter to connect to Home Assistant.

  2. Register and log in.

  3. Click Configuration > Integrations.

    Set Up Tuya Integration (Stable) in Home Assistant
  4. On the Integrations page in the configurations panel, click the + button in the lower right.

    Set Up Tuya Integration (Stable) in Home Assistant
  5. Search for Tuya and click the icon to install.

    Set Up Tuya Integration (Stable) in Home Assistant
  6. Enter your Tuya credentials.

    Set Up Tuya Integration (Stable) in Home Assistant

    Parameters Description
    Country Select the region of your account of the Smart Life app.
    Note: Open the mobile app and tap Me > Setting > Account and Security > Region.
    Tuya IoT Access ID and Tuya IoT Access Secret Go to the Tuya IoT Development Platform and select your cloud project. Click the Overview tab and find the Access ID and Access Secret in the Authorization Key area.
    Account Your account of the Smart Life app.
    Password Your password for the Smart Life app.

    The mobile app mentioned in the above table must be the one you use to scan the QR code for linking devices to your cloud project on the Tuya IoT Development Platform.

  7. Click Submit.

    Click Overview in the sidebar on the left. You will find all the smart devices linked to your cloud project created on the Tuya IoT Development Platform.

    Set Up Tuya Integration (Stable) in Home Assistant

FAQs

I got an error saying ‘Config flow could not be loaded’ when setting up the Tuya integration. How to fix it?

Set Up Tuya Integration (Stable) in Home Assistant

Go to custom_components under the Home Assistant directory and delete the tuya_v2 folder. Restart Home Assistant and try to install the integration again.

Set Up Tuya Integration (Stable) in Home Assistant

I got an error shown in the following screenshot when I tried to scan a QR code to link my devices to my cloud project. How to fix it?

Set Up Tuya Integration (Stable) in Home Assistant

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.

  1. Here is how to find the region: open the Smart Life app and tap Me > Setting > Account and Security > Region.

    Set Up Tuya Integration (Stable) in Home Assistant
  2. See Mappings Between OEM App Accounts and Data Centers and find the data center that can serve your region.

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

    Set Up Tuya Integration (Stable) in Home Assistant
  4. 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.

    Set Up Tuya Integration (Stable) in Home Assistant

  5. Scan the QR code again to link devices.

Will I be billed after the free trial of the API service expires?

  • After your API service expires, go to Cloud > My Services on the Tuya IoT Development Platform to request extending your API service by up to 6 months.

    1. Click Extend Trial Period.

      Set Up Tuya Integration (Stable) in Home Assistant
    2. Complete this form.

      Set Up Tuya Integration (Stable) in Home Assistant
    3. You will get the result within one working day.

      Set Up Tuya Integration (Stable) in Home Assistant
  • 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.

How to deal with the following errors?

Error code sample:

[tuya-openapi] Response: {
  "code": 2406,
  "msg": "skill id invalid",
  "success": false,
  "t": 1624477851701
}
Error code Message Troubleshooting
1004 sign invalid The Access ID and Access Secret you entered are not correct. For more information, see Credentials Configuration.
1106 permission deny
  • Your Smart Life 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 Smart Life app that you have used to link devices to your cloud project on the Tuya IoT Development Platform.
  • Incorrect country. You must select the region of your account of the Smart Life app.
2406 skill id invalid
  • Make sure you use the Smart Life app account to log in to the integration and choose the data center endpoint applicable to your country or region. For more information, see Mappings Between OEM App Accounts and Data Centers.
  • Your cloud project on the Tuya IoT Development Platform should be created after May 25, 2022. Otherwise, you need to create a new project. For more information, see Operation on the Tuya IoT Platform.
  • You can try unlinking your Smart Life app account from the cloud project. Open your cloud project, click the Devices tab > Link Tuya App Account > and choose Unlink. Then, link your app account with this project again. For more information, see Link Devices.
28841105 No permissions. This project is not authorized to call this API Insufficient API permissions. 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
28841002 No permissions. Your subscription to cloud development plan has expired Your subscription to Tuya cloud development IoT Core Service resources has expired, please click to extend trial period.

How to get the diagnostic log?

You can get the diagnostic log with the following two options.

  • Option 1: Edit the configuration file. You can get the complete log but you need to restart Home Assistant after editing the file.

    1. Copy the following code to the configuration.yaml and save.

      logger:
        default: critical
        logs:
          custom_components.tuya_v2: debug
      
    2. After your Home Assistant is restarted, you can check the log of Tuya integration from the Terminal or the home-assistant.log file.

      Set Up Tuya Integration (Stable) in Home Assistant
  • Option 2: Export the log directly.

    1. On the homepage of the Home Assistant, choose Configurations > Devices & Services.

      Set Up Tuya Integration (Stable) in Home Assistant
    2. Find the Tuya integration and click > Download diagnostics to download the log file.

      Set Up Tuya Integration (Stable) in Home Assistant

What categories does Tuya Home Assistant Integration support?

The following table lists the supported product categories:

Level-1 category Category code Category Supported HA Core version HA Platform
Large Home Appliances kt Air Conditioner Release 2021.10 Climate, Switch, Light
Small Home Appliances cwysj Pet Feeder Release 2021.10 Switch
qn Heater Release 2021.10 Climate, Switch, Select, Sensor
sd Robot Vacuum Release 2021.11 Vacuum
fs Fan Release 2021.10 Fan
cl Curtain Motor Release 2021.11 Cover
kj Dehumidifier Release 2021.10 Fan, Switch
cs Dehumidifier Release 2021.11 Humidifier
xxj Aroma Diffuser Release 2021.11 Switch
cwwsq Pet Feeder / Sensor, Binary Sensor
rs Water Heater / Climate, Switch
szjqr Fingerbot / Number
Electrical Products kg Switch Release 2021.10 Sensor, Switch, Light, Select
cz Socket Release 2021.10 Sensor, Switch
pc Power Strip Release 2021.10 Sensor, Switch
clkg Curtain Switch Release 2021.11 Cover
jdcljqr Curtain Robot Release 2021.11 Cover
wk Thermostat Release 2021.10 Climate
dlq Circuit Breaker Release 2021.10 Switch
ckmkzq Garage Door Opener Release 2021.11 Cover, Switch
fskg Fan Wall Switch / Switch, Fan
xxj Diffuser / Switch
Sensor and Security wsdcg Temperature and Humidity Sensor Release 2021.11 Binary Sensor, Sensor
mc Door/Window Controller / Sensor, Binary Sensor
mcs Door/Window Sensor Release 2021.10 Sensor, Binary Sensor
ywbj Smoke Detector Release 2021.11 Sensor, Binary Sensor
rqbj Gas Detector Release 2021.11 Sensor, Binary Sensor
pir Passive Infrared Sensor Release 2021.10 Sensor, Binary Sensor
sj Water Detector Release 2021.11 Sensor, Binary Sensor
pm25 PM2.5 Sensor Release 2021.11 Binary Sensor, Sensor
hps Human Presence Sensor Release 2021.11 Binary Sensor, Number
sos Emergency Button Release 2021.10 Binary Sensor, Sensor
ldcg Luminance Sensor Release 2021.10 Binary Sensor, Sensor
sp Smart Camera Release 2021.11 Camera, Siren, Switch, Light, Number, Select, Sensor
sgbj Siren Release 2021.11 Number, Siren, Switch, Select
zd Vibration Sensor Release 2021.11 Sensor, Binary Sensor, Number
co2bj CO2 Sensor Release 2021.11 Binary Sensor, Sensor
cobj CO Sensor Release 2021.11 Binary Sensor, Sensor
jqbj Formaldehyde Detector Release 2021.11 Binary Sensor, Sensor
jwbj Methane Detector Release 2021.11 Binary Sensor, Sensor
voc VOC Sensor Release 2021.11 Binary Sensor, Sensor
ylcg Pressure Sensor Release 2021.11 Binary Sensor, Sensor
pm2.5 PM2.5 Detector / Sensor, Binary Sensor
wkf Thermostatic Radiator Valve / Sensor, Binary Sensor
hjjcy Air Quality Monitor / Sensor
Lighting Products dj Light Release 2021.10 Light, Switch
dd Strip Lights Release 2021.10 Light
fwl Ambient Light Release 2021.10 Light
dc String Lights Release 2021.10 Light
xdd Ceiling Light Release 2021.10 Light, Switch
fsd Ceiling Fan Light Release 2021.11 Light
fwd Ambient Light Release 2021.11 Light
gyd Motion Sensor Light Release 2021.11 Light
jsq Humidifier Release 2021.10 Light, Humidifier
tgkg Dimmer Switch Release 2021.11 Light, Number, Select
tgq Dimmer Release 2021.11 Light, Number, Select
tyndj Solar Light Release 2021.11 Light, Sensor, Switch
ykq Remote Control Release 2021.11 Light
Kitchen Appliances bh Smart Kettle Release 2021.10 Switch, Number, Sensor
kfj Coffee Maker Release 2021.10 Number, Select