The new official Home Assistant Tuya integration v2 is here and it is here to stay. It is developed to control Powered by Tuya (PBT) devices using the officially maintained Tuya Open API. Most probably it will replace the currently existing Tuya integration as soon as it gets out from the beta version. Let’s see how to install it and how to use it.

Home Assistant Tuya v2 integration

What is Tuya?

What’s Tuya you may ask? Simply said – this is one of the biggest IoT platforms that enables brands and manufacturers to make their products smart. In other words if you see on a product that is Tuya compatible or Powered by Tuya, that means you will be able to control that product with your phone for example or from now on officially with Home Assistant.

Is the new Tuya Home Assistant Cloud or Local?

The Home Assistant Tuya V2 integration is Cloud based at least for now, but local access will be also possible in the near future. Also have in mind that the new Tuya V2 Home Assistant integration is still in beta testing, but beta is good enough for me.

Let’s see what we need to make it work!

Home Assistant Tuya V2 Integration requirements

  • First, You will need a working Home Assistant. I have several tutorials that can guide you if you wish to install HA.
    • Home Assistant Supervised 👉 LINK
    • Home Assistant OS on Windows 👉 LINK
  • Second, you will need at least one Tuya compatible device. I will use one Tuya downlight for example. But don’t worry too much if you still don’t have any Tuya device. You can create a virtual one in the Tuya IoT Platform if you just want to test the things upfront before you commit to buy some Powered by Tuya stuff.
  • Third and final, you need the TuyaSmart App as well as to create a project in the Tuya IoT Platform. Let’s do this together.

Download and install TuyaSmart App

Download and install the free TuyaSmart app on your phone from Apple App Store or Google Play. There is another app called Smart Life (App Store & Google Play) that is virtually the same and you can use it as well.

QUESTION: I’m not sure why the apps are are two! If you happen to know, let me know in the comments.

Anyway, create a free account in either of the apps and login. If you have a Tuya device – now it is the best time to add it in the mobile app. Just follow the pairing procedure described in your product user manual.

Login to the Tuya IoT Platform (Home Assistant beta test invitation)

Next, log in to the Tuya IoT Platform (Home Assistant beta test invitation). You can use this link 👉 LINK

Home Assistant Tuya Beta Test invitation web page for registration.
Home Assistant Tuya Beta Test invitation web page for registration.

The main idea of this whole exercise is to get an Authorisation key or Access ID & Access secret. Later we are going to use them in Home Assistant to make API requests. Here is how to get them.

When you log in the Tuya IoT Platform go to Cloud > Create Cloud Project.

Creating a Cloud Project inside the Tuya IoT Platform for the Home Assistant Integration.
Creating a Cloud Project inside the Tuya IoT Platform for the Home Assistant Integration.

On the next dialog enter a the following:

  • Project Name – It is a good idea to be something meaningful for you, but can be anything.
  • As Industry – select Smart Home.
  • As Development Method – also select Smart Home.
  • To set the Availability Zone you have to open the Tuya Smart or Smart Life app. Tap Me > Setting icon in the top right corner of the page > Account and Security > Region. Get the info from there and use the same in the Availability Zone field. My registration/region was China for some reason (although I’m in Europe), but I also added Europe and America.
  • When you are ready with everything click on Create button.
Cloud Project settings in Tuya IoT Platform
Cloud Project settings in Tuya IoT Platform

In the Configuration Wizard (next dialog) you have to add the Device status notification setting to the Selected API Products and to click Authorize button.

On the next screen you will see your Authorisation Key that consist of Access ID and Access Secret. Store your Access ID & Access Secret somewhere safe.

Authorisation Key that consist of Access ID & Access Secret
Authorisation Key that consist of Access ID & Access Secret

Link TuyaSmart App devices and Tuya IoT Platform

Time to link the devices available in TuyaSmart app to your newly created Cloud project in Tuya IoT Platform. That way the Home Assistant will be able to interact with those devices as we are going to see later.

Go to Devices > Link Tuya App Account > Add App Account.

To link the Cloud Project and TuyaSmart App - follow these steps
To link the Cloud Project and TuyaSmart App – follow these steps

When you see the QR Code use your TuyaSmart app (or Smart Life) on your mobile device to scan it.

That is everything needed and we can proceed to the actual installation of the official Tuya Home Assistant integration.

Installation of the official Home Assistant Tuya V2 integration

I’m pretty sure that in the future the Tuya integration installation will become much easier. You will be able to just add it from the Home Assistant integrations menu.

But that is the future! For now you have two options to install the Tuya V2 Home Assistant integration:

Both methods leads to the same result, so it doesn’t matter which way you’ll choose.

Manual installation of Home Assistant Tuya integration

Follow these steps to manually install the Tuya Integration:

  • Go to the GitHub page of the Home Assistant Tuya integration and download the code as Zip file.
  • Uncompress the archive and copy the custom_components/tuya/ folder to your Home Assistant configuration folder. To transfer the files I used the Home Assistant Samba Add-on to connect to the device where my Home Assistant is. You can use that as well by installing the Samba Add-on from the Home Assistant Add-on store.
  • Restart your Home Assistant.
At the end you should have the following structure inside your Home Assistant config folder

At the end you should have the following structure inside your Home Assistant config folder.

Add Tuya V2 integration in Home Assistant

After the Official Tuya V2 integration files are in place and Home Assistant is restarted, we have to add the new Tuya integration in Home Assistant using the web interface. That is as easy as smashing the subscribe button for my newsletter 👉 LINK

Anyway, go to Home Assistant > Configuration > Integrations and search for Tuya > select the Tuya V2 integration

Select the Home Assistant Tuya Integration V2 here
Select the Home Assistant Tuya Integration V2 here

TIP!: If you happen to have the old Tuya integration already, don’t worry as the old and the new V2 official Home Assistant Tuya integrations can work at the same time.

On the next window enter the following:

  • Your Access ID & Access Secret (that ones that we have during the cloud project creation).
  • As Mobile App select either tuyaSmart or Smart Life.
  • For Country Code open https://countrycode.org website, select the country you used during the Mobile App registration to get the country code for that country. For China the code is 86, For USA the code is 1, for UK is 44, and so on.
  • As Account and Password enter your Mobile App credentials.
  • Click Submit when you are ready.
A dialog where you should enter your Access ID & Access Secret, Mobile App type, Country Code, and your Mobile App credentials.
A dialog where you should enter your Access ID & Access Secret, Mobile App type, Country Code, and your Mobile App credentials.

After you successfully authorize yourself, the new Tuya integration will be added in your list with Home Assistant Integrations. Ready to be used.!

Add Tuya Device to Home Assistant Dashboard

To add your Tuya device(s) in the Home Assistant Dashboard and to control it from there do the following:

  • Under the new Tuya Integration (available in Home Assistant > Configuration > Integrations) click on the device that you wish to add.
  • Under Entities section click on Add to Lovelace and then again Add to Lovelace UI.
Adding Tuya device on Home Assistant Dashboard/Lovelace
Adding Tuya device on Home Assistant Dashboard/Lovelace

Is Tuya V2 Home Assistant integration free of charge?

You may wonder is the Home Assistant Tuya V2 integration can be used for free? Yes, It is. Trial Edition allows you to use all free API products but adds some quotas of the API calls. See the limits here 👉 LINK

Of course there are also paid tiers with bigger limits if the Trail edition is not enough for you.

Most Interesting part about the new Tuya V2 integration 

The most interesting part to me about the new Home Assistant Tuya integration is that the initiative is coming right from the Tuya itself. On top the project is open sourced and everyone can contribute to make the official Home Assistant Tuya integration even better and with wider device support.

That makes the new official Tuya Home Assistant integration a very, very good example that I hope to become a trend. A trend in which every big vendor out there is going to develop an official open-sourced and fully supported integration for Home Assistant. That will be beneficial for the vendors, for the Home Assistant, and of course to us – the Home Assistant community and end users.

Home Assistant Tuya Integration Outro

Make sure that you subscribe to my YouTube channel and hit that notification bell. It is quick, easy and free and I will be thankful forever.

Follow me on Twitter and join my Discord server, stay safe and don’t forget – Home Smart, but not Hard!

To secure this blog existence support my work by using either of the channels listed here 👉 LINK

or buy my Smart Home Guide!

Thank you for reading and I will see you next Wednesday.


2 Comments

Doria · 05/08/2021 at 10:45 am

that’s very detailed and helpful!

    Kiril · 05/08/2021 at 10:52 am

    Thank you very much Doria! Check my other tutorials as well 🙂

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.