English
English
简体中文
Contact Us
Register
Log In
layoutIndex

How to Set Up Tuya Integration (Stable) in Home Assistant

Last Updated on : 2022-08-11 06:20:12download

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

This integration only supports the basic product categories, such as switches, lights, fans, thermometers, and hygrometers. For more information, see the table for supported device categories. We do not promise 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.

Prerequisites

Set up

After you have installed Home Assistant Core, you can search for and set up the Tuya integration in Home Assistant.

Only Home Assistant 2021.10.4 and later versions support the official Tuya integration.
How to Set Up Tuya Integration (Stable) in Home Assistant

  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.

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

  5. Select Tuya and set up the integration.

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

    How to Set Up Tuya Integration (Stable) in Home Assistant

    Fields Description
    Country Select the region of your account of the Tuya Smart app or Smart Life app.
    Note: Open the mobile app you use 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 Tuya Smart app or Smart Life app.
    Password Your password for the Tuya Smart app or 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.

    How to 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?

How to 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 installing the integration again.

How to 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?

How to 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 mobile app you use and tap Me > Setting > Account and Security > Region.

    How to 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.

    How to 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.

    How to 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.

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

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

      How to 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 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.
2406 skill id invalid Your cloud project on the Tuya IoT Development Platform should be created after May 25, 2021. Otherwise, you need to create a new project. For more information, see Operation on the Tuya IoT Development Platform.
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

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 from the home-assistant.log file.

      How to 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.

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

What categories are supported by the Tuya Home Assistant integration?

See the following table for supported device categories.

First Class Category category code category[en] HA Core Supported Version HA Platforms
Large Home Appliances kt Air conditioner Release 2021.10 Climate, Switch
Small Home Appliances cwysj Pet Water Feeder Release 2021.10 Switch
qn Heater Release 2021.10 Climate, Switch
sd Robot Vaccum Release 2021.11 Vacuum
fs Fan Release 2021.10 Fan,Light
cl Curtain Release 2021.11 Cover
kj Air Purifer Release 2021.10 Fan, Switch
cs Dehumidifier Release 2021.11 Humidifier
cwwsq Smart Pet Feeder / Sensor, Binary Sensor
rs Heater / Climate, Switch
szjqr Fingerbot / Number
Electrician Category kg Switch Release 2021.10 Sensor, Switch
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 Switch, Binary Sensor
fskg Fan wall switch / Switch, Fan
xxj Diffuser / Switch
Security & Sensors wsdcg Temperature and Humidity Sensor Release 2021.11 Sensor
mc Door and 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 PIR Detector Release 2021.10 Sensor, Binary Sensor
sj Water Detector Release 2021.11 Sensor, Binary Sensor
pm25 PM2.5 Sensor Release 2021.11 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 Sensor
ms Lock Not Support Lock
sp Smart Camera Release 2021.11 Camera, Siren, Switch
sgbj Siren Alarm Release 2021.11 Number, Siren, Switch
zd Vibration Sensor Release 2021.11 Sensor, Binary Sensor, Number
co2bj CO2 Detector Release 2021.11 Sensor
cobj CO Detector Release 2021.11 Sensor
jqbj Formaldehyde Detector Release 2021.11 Sensor
jwbj Methane Detector Release 2021.11 Sensor
voc Volatile Organic Compound Sensor Release 2021.11 Sensor
ylcg Pressure Sensor Release 2021.11 Sensor
pm2.5 PM2.5 Sensor / Sensor, Binary Sensor
wkf Thermostatic Radiator Valve / Sensor, Binary Sensor
hjjcy Air Quality Monitor / Sensor
Lighting dj Light Release 2021.10 Light, Switch
dd Light Strip Release 2021.10 Light
fwl Ambient light Release 2021.10 Light
dc Light string 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, Humidifier
jsq Humidifier Light Release 2021.10 Light
tgkg Dimmer Switch Release 2021.11 Light, Number, Select
tgq Dimmer Release 2021.11 Light, Number
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
kfj Coffee Maker Release 2021.10 Number, Select
Energy zndb Smart Electricity Meter Not Support Sensor, Switch