How to Install Tuya v2 Integration (Beta)

Last Updated on : 2024-06-20 06:58:10download

This topic describes how to install and use the Tuya v2 integration.

Prerequisites

  • You have created a cloud project of Smart Home type on the Tuya Developer Platform, added at least one real device or one virtual device, and authorized your project to use the required API services. For more information, see Configuration Wizard of Smart Home PaaS.

    If your cloud project was created before May 25, 2021, you need to perform project migration. For more information, see How to Migrate to Tuya v2.

  • You have installed Python 3.8 (including python3-dev) or a later version on your system.

Operation

After you have installed Home Assistant Core, copy the Tuya v2 integration folder to the Home Assistant directory.

Install Home Assistant Core

See the official installation guide and install Home Assistant Core.

Install Tuya v2 integration

Tuya v2 is compatible with the original Tuya integration (developed by a third party) so you do not need to uninstall the original Tuya integration to install Tuya v2.

Option 1: Copy method

  1. Download the tuya-home-assistant repo.

  2. Unzip it and copy the custom_components/tuya/ folder to the Home Assistant configuration directory, for example, ~/.homeassistant.

    How to Install Tuya v2 Integration (Beta)

Option 2: HACS installation

  1. See HACS Official Installation Guide and install HACS.

  2. See Initial Configuration Guide and complete the initial configuration.

  3. Open Home Assistant. Choose HACS > Integrations > > Custom repositories.

    How to Install Tuya v2 Integration (Beta)
  4. Enter https://github.com/tuya/tuya-home-assistant in the address bar at the bottom left of the window. Select Integration from the Category list and click ADD.

    How to Install Tuya v2 Integration (Beta)
  5. In the dialog box that appears, click INSTALL.

    How to Install Tuya v2 Integration (Beta)

Configure 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 Install Tuya v2 Integration (Beta)
  4. On the Integrations page in the configurations panel, click the + button in the lower right.
    How to Install Tuya v2 Integration (Beta)
  5. Search for Tuya v2.
    How to Install Tuya v2 Integration (Beta)
  6. In the Tuya Integration window, select Smart Home PaaS and click Submit.
    How to Install Tuya v2 Integration (Beta)
  7. Complete Tuya credential. Check out the table below and enter each item.
    How to Install Tuya v2 Integration (Beta)
    Fields Description
    Access ID and Access Secret Go to the Tuya Developer Platform and select your cloud project. Click the Overview tab and find the Access ID and Access Secret in the Authorization Key area.
    Mobile app The mobile app must be the one you use to scan the QR code for linking devices to your cloud project on the Tuya Developer Platform.
    Country code The country you select on logging in to Tuya Smart or Smart Life app.
    Account Your account of the Tuya Smart app or Smart Life app.
    Password Your password of 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 Developer Platform.

  8. 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 Developer Platform.
    How to Install Tuya v2 Integration (Beta)

FAQs


My devices have been paired with the Tuya Smart or Smart Life app. Can they be seamlessly migrated to the Tuya v2?
  • Yes, they can. All the pairing information is stored in the cloud. For the paired devices, you do not need to go through the pairing process again. However, you need to configure the automations in Home Assistant after migration.

I got an error saying ‘Invalid authentication’. How to fix it?

How to Install Tuya v2 Integration (Beta)
  • Please check the following things:

    • Your cloud project on the Tuya Developer Platform should be created after May 25, 2021. Otherwise, you need to create a new project or migrate data to a new project. For more information, see Operation on the Tuya Developer Platform.
    • You have linked devices to your cloud project on the Tuya Developer Platform with the Tuya Smart or Smart Life app.
    • You entered the correct account and password of the Tuya Smart or Smart Life app in the Account and Password fields. The mobile app must be the one you use to scan the QR code for linking devices to your cloud project on the Tuya Developer Platform.

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

  • After expiration, you can renew the subscription for free. 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 Developer Platform.
  • Incorrect country. Select the region of your account of the Tuya Smart app or Smart Life app.
1100 param is empty Account or mobile app is empty. You must enter the account or select a mobile app.
2017 schema does not exist Incorrect mobile app. You must select the mobile app you use to scan the QR code for linking devices to your cloud project on the Tuya Developer Platform.
2406 skill id invalid Your cloud project on the Tuya Developer Platform should be created after May 25, 2021. Otherwise, you need to create a new project. For more information, see Operation on the Tuya Developer 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
  • Device Connection Service
  • Smart Home Scene Linkage
  • IoT Data Analytics
  • Device Status Notification

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 Install Tuya v2 Integration (Beta)
  • 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 Install Tuya v2 Integration (Beta)
    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 Install Tuya v2 Integration (Beta)
    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 Install Tuya v2 Integration (Beta)