Tuya
The Tuya integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] integrates all Powered by Tuya devices you have added to the Tuya Smart and Tuya Smart Life apps.
All Home Assistant platforms are supported by the Tuya integration, except the lock and remote platform.
Prerequisites
You need to have the Tuya Smart or Smart Life app installed, with an account created and at least one device added to that account.
During the setup process, you will need:
- A second screen (such as a phone, tablet, or another computer) to display the QR code that appears during configuration
- The Smart Life or Tuya Smart app installed on your mobile device to scan the QR code
Obtaining User Code for sign-in
To sign-in, you will need to get your User Code from the Smart Life / Tuya Smart app. You can find it by opening the app and:
- On the tab bar, select Me.
- Select the ⚙️ (gear) icon in the top-right corner.
- Tap Account and Security.
- At the bottom, User Code will be shown; you need to when setting up this integration.
Configuration
To add the Tuya hub to your Home Assistant instance, use this My button:
Tuya can be auto-discovered by Home Assistant. If an instance was found, it will be shown as Discovered. You can then set it up right away.
Manual configuration steps
If it wasn’t discovered automatically, don’t worry! You can set up a manual integration entry:
-
Browse to your Home Assistant instance.
-
In the bottom right corner, select the
Add Integration button. -
From the list, select Tuya.
-
Follow the instructions on screen to complete the setup.
Scanning the QR code
To scan the QR code in the Smart Life app:
- Open the Smart Life app
- Tap the + button or Add Device
- Select Scan or look for the QR code scanner option
- Scan the QR code displayed on your Home Assistant screen
After adding new devices to your Tuya account through the Smart Life or Tuya Smart app, you need to reload the Tuya integration in Home Assistant for the new devices to appear:
- Go to Settings > Devices & services
- Find the Tuya integration
- Click the three dots menu
- Select Reload
Scenes
Tuya supports scenes in their app. These allow triggering some of the more complex modes of various devices such as light changing effects. Scenes created in the Tuya app will automatically appear in the Scenes list in Home Assistant the next time the integration updates.
Actions
The Tuya integration provide actions to manage the meal plan for feeders.
Action: Get feeder meal plan
The tuya.get_feeder_meal_plan action retrieves the meal plan data from a Tuya feeder device.
-
Data attribute:
device_id- Description: The device ID of the Tuya feeder to retrieve the meal plan from.
- Optional: No
Action: Set feeder meal plan
The tuya.set_feeder_meal_plan action set the mealplan data from a Tuya feeder device.
-
Data attribute:
device_id- Description: The device ID of the Tuya feeder to retrieve the meal plan from.
- Optional: No
-
Data attribute:
meal_plan- Description: The decoded data to update the feeder’s meal plan. Take a list of dictionary of attributes.
- Optional: No
-
Attributes:
- days: List[String] with monday-sunday. Indexed with monday as first day of week.
- time: String with HH:MM format
- portion: Numeric with number of portions
- enabled: Enable or disable the schedule.
This action returns response data containing the meal plan for the specified feeder device.
Example
action: tuya.set_feeder_meal_plan
data:
device_id: "1234567890abcdef"
meal_plan:
- days:
- Monday
- Tuesday
time: 10:00
portions: 2
enabled: true
Troubleshooting
Unsupported device or missing device functionality
This integration relies on the official Python SDK provided by Tuya, which does not expose all functionality available in SmartLife.
The data points provided by the SDK are visible in the Home Assistant device diagnostics JSON file, under the status, status_range and function keys:
- Go to Settings > Devices & services
- Find the Tuya integration
- Select the device
- Under the device information, click the three dots menu
- Select Download diagnostics
- Open the diagnostic file, and check manually the
status,status_rangeandfunctionkeys
If status, status_range and function are all empty, then only scenes declared inside Tuya (if any) will be available inside Home Assistant.
Integration requires re-authenticating after every integration reload
When Tuya updates the terms and conditions of iot.tuya.com, the integration will require repeated authentication.
To fix this:
- Login to iot.tuya.com, and accept the terms and conditions.
- Restart Home Assistant.
- Reconfigure the Tuya integration.
Feeder meal plan not supported
Symptom: “Feeder not supported” warning
Home Assistant shows a warning that this particular feeder is not supported.
Description
Feeders are dependent on tuya-device-handlers to be integrated based on feeders product_id.
Resolution
Open a issue to tuya-device-handlers with information provided from QueryThingsDataModel API result from iot.tuya.com (under Cloud / API Explorer / Device Control).