Skip to content

How to Use Tuya Homebridge Plugin

Hanh94 edited this page Aug 6, 2021 · 8 revisions

TEST TEST

With the Tuya Homebridge plugin, you can easily control smart devices connected to the Tuya IoT Cloud by using HomeKit. This tutorial describes how to install the Tuya official Homebridge plugin to connect smart devices and develop Homebridge plugins.

Click to watch the video on youtube. image.png

Prerequisites

  • You have created a cloud project of Smart Home PaaS type on the Tuya IoT Platform, added at least one device or one virtual device, and authorized your project to use related smart home APIs. For more information, see Tuya IoT Platform Configuration Guide Using Smart Home PaaS.

    Note: You must use a cloud project created on or after May 25, 2021. If your cloud project of Smart Home PaaS type is created before May 25, 2021, you need to create a new project.

Install the plugin

  1. Open the Terminal on your Mac.

    Terminal
  2. Install Tuya Homebridge plugin.

    Note: If you encounter any problems with the installation, you may need to preface this command with sudo to make it run as an administrator.

    1. Install plugins.

      npm install homebridge-tuya-platform
      
    2. Wait for the plugin to install and check whether the installation is successful. For more information, see the video below.

Edit the configuration file

Before you run the plugin, you need to edit the config.json file of the Homebridge plugin.

  1. Navigate to the directory homebridge-tuya-platform/config.

    cd ./node_modules/homebridge-tuya-platform/config
    
  2. Edit the config.json file.

    vim config.json
    
  3. Specify values for options.

  4. Save and exit.

Run the plugin

  1. Navigate to the directory homebridge-tuya-platform.

    cd ..
    
  2. Run the plugin.

    homebridge -D -U ./config/ -P ./
    

Bridge to HomeKit

  1. Open the Home app on your Apple device.

  2. Pair with Homebridge by scanning the QR code printed in the step of running the plugin, or entering the 8-digit PIN code. You can also find the PIN code in the config.json file.

Control devices on HomeKit

Now, you can see and control all the smart devices connected to the Tuya Smart or Smart Life app on the HomeKit dashboard.

Error code and troubleshooting

Error code Error message Troubleshooting
1004 sign invalid Incorrect accessId or accessKey. To fix the error, see Edit config.json file.
1106 permission deny
  • Your app account is not linked with your cloud project: Link devices by using the Tuya Smart or Smart Life app with your cloud project on the Tuya IoT Platform. For more information, see Link devices by app account.
  • Incorrect username or password: Enter the correct account and password of the Tuya Smart or Smart Life app in the Account and Password fields. Note that the app account must be the one you used to link devices with your cloud project on the Tuya IoT Platform.
  • Incorrect endpoint: See Endpoint and enter the correct endpoint.
  • Incorrect countryCode: Enter the code of the country you select on logging in to the Tuya Smart or Smart Life app.
1100 param is empty username or appSchema is empty: See Edit config.json file and enter the correct parameter.
2017 schema does not exist Incorrect appSchema in config.json: See Edit config.json file and enter the correct parameter.
2406 skill id invalid
28841105 No permissions. This project is not authorized to call this API You have not authorized your cloud project to use the required APIs. Subscribe to the following required API products and authorize your project to use them.
  • Authorization
  • Smart Home Devices Management
  • Smart Home Family Management
  • Smart Home Scene Linkage
  • Smart Home Data Service
  • Device Status Notification

FAQ

Q: Will I be billed after the 1-year free trial of the API product expires?

A: After expiration, you can renew the subscription for free. The Trial Edition allows you to use all free API products but puts limits on the quota of API calls. For more information about the quota, see Pricing.