HowTo: Zigbee - Integrate TuYa room temperature and humidity sensor TS0201 into Node Red via zigbee2mqtt

I stumbled across the TuYa TS0201 temperature and humidity sensor while looking for a simple humidity sensor.

Actually, I was looking for a simple humidity sensor with a display to show the humidity in the basement. The background was that I wanted to ensure that the stored boxes, files and all the other stuff typical of the cellar would not get too damp and mold could possibly develop.

The cool thing about the TS0201 is that it doesn't just display the measured values. He also sends them to you via Zigbee SmartHome. For example, you can also have the measured values monitored automatically. For example, an alarm would be conceivable as soon as the room temperature exceeds a certain limit value. (I have an example of this in the article Node Red - High humidity warning described.)

How to put the TuYa room temperature and humidity sensor TS0201 in your Node Red entity or cigbee2mqtt integrated and read the data, I have described in the following article.

Safety instructions

I know the following tips are always somehow annoying and seem unnecessary. But unfortunately, many people who knew "better" have already lost eyes, fingers or other things or injured themselves due to carelessness. In comparison, a data loss is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth an injury or other trouble.

Affiliate links/advertising links

The links to online stores listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, will receive a commission from the respective online store or provider. For you the price does not change. If you make your purchases through these links you support to be able to offer more useful projects in the future. 🙂 


Helpful articles:
Before you start this article, you should have prepared a Raspberry Pi so that it can be reached via the network and controlled via SSH. Of course, zigbee2mqtt and Node Red should also be installed and configured.

The following articles describe what needs to be done to prepare the Raspberry Pi.

In the following lists you will find all the parts you need to implement this article.

Required tools:

1xScrewdriver set  Buy at Amazon
1xSD card reader  Buy at Amazon

Material needed:

1x eMylo Smart Wireless ZigBee Thermometer Hygrometer... 
1xSONOFF Zigbee 3.0 USB Dongle Plus  Buy at Amazon
1xUSB extension cable  Buy at Amazon
1x Raspberry Pi  Buy at Amazon
1x Raspberry Pi power supply  Buy at Amazon
1x Raspberry Pi case  Buy at Amazon
1x Micro SD card 64GB  Buy at Amazon

Log into the NodeRed configuration interface

Before you can edit your NodeRed configuration, you must - if activated - first log into the NodeRed configuration interface.

View of the login dialog. Here you have to enter the login data that you specified during the configuration of the login. You can find information about this in the article NodeRed - set up user login.

Enable Zigbee2mqtt Dashboard

In my opinion, the easiest way to add new devices to your Zigbee network is to use the zigbee2mqtt dashboard. In case you haven't activated this yet, you will find helpful hints in the article Zigbee - Administration of Zigbee2mqtt via the dashboard.

Register sensor to zigbee2mqtt

Before you can evaluate the sensor using NodeRed, you must of course first integrate it into your Zigbee network.

I have a little more detail on how to integrate devices into your own Zigbee network in the article Zigbee – register devices or sensors and actuators with zigbee2mqtt described. The following two steps summarize this briefly.

View of the log tab of the zigbee2mqtt dashboard. The area marked in red contains the button with which access to the Zigbee network can be controlled. Click on this to unlock access to the Zigbee network.

To put the sensor into pairing mode, you have to insert the battery and the button on the top

  • hold down for approx. 5 seconds

The signal indicator in the display should then flash. The sensor then connects to your Zigbee network shortly afterwards. You can tell by the fact that the signal display stops flashing and is displayed permanently.

You can track the status of the connection process in the zigbee2mqtt log.

Import node code

The dashboard node should already be installed and configured so that you can also control your Zigbee device via the NodeRed dashboard or display the values. You can find information about this in the following article.

After that, all you have to do is import the NodeCode linked below into your NodeRed environment. Information on how to import NodeRed code can be found in the article NodeRed - Import and export node code .

As always, you can find the NodeRed code in the Nerdiy Git repository under the following link:

View of the NodeRed code in the NodeRed configuration view.

Of course you still have to adapt the code to your sensor. In order for this to work correctly, you still have to enter the IEEE address or the "friendly name" of your sensor in the NodeRed code.

To do this, open the properties of the marked node and enter your IEEE address in the marked area under "Payload...". How to find out the IEEE address of your Zigbee device is in the article Zigbee – register devices or sensors and actuators with zigbee2mqtt described.

In order for the update function to work via the NodeRed dashboard, you must also enter the address here in the marked area.

You can of course also use the newly registered Zigbee device via the zigbee2mqtt Dashboard control or read out.

In the following category I have also listed other Zigbee devices which can be controlled or read out with the NodeRed code offered there.

More articles on the topic

I have summarized other articles on the subject of Zigbee and zigbee2mqtt in the following category. There you will also find articles on various Zigbee devices and how they look like NodeRed can be controlled.

External links:

Have fun with the project

I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are also always welcome 🙂 .

P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do it because I enjoy it, but if you think it's cool that I share the info about it with you, I'd appreciate a small donation to the coffee fund 🙂 .

Buy Me a Coffee at       

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert