RS-WS-N01-8 Modbus Temperature and Humidity sensor

Hi All,

I bought a RS-WS-N01-8 Modbus Temperature and Humidity sensor a few weeks ago and I did the integration to OpenHAB. There is a Youtube video describing how the sensor works and how to set it up:

Link for the modbus setup utility to change the station ID and baud (explained in the video):

Link for the image explaining the use of the above utility:

To communicate with the sensor, add the modbus binding to your OpenHAB installation.

These are my settings in openhab.cfg to configure the modbus communication:


The only thing to change in the above config is the station ID and communication details for your particular device.

The device sends the humidity and temperature values in 0.1% and 0.1C format. So the value needs to be divided by 10. Since there is no transformation for the modbus binding, I am reading the values to a temporary items, dividing them and posting the actual values to the final items using rules.

Let’s see the item configuration first:

// RS-WS-N01-8 Temperature and Humidity sensor
Number RSWShumidity_temp "Humidity [%d]" <rain> {modbus="rswstemp:0"}
Number RSWStemperature_temp "Temperature [%d]" <temperature> {modbus="rswstemp:1"}
Number RSWShumidity "Humidity [%.1f %%]" <rain> (rswstemp)
Number RSWStemperature "Temperature [%.1f C]" <temperature> (rswstemp)

Sitemap itself is very simple, there is no surprise there. Obviously only the final values as added to the sitemap:

        Text label="RS-WS Temperature and Humidity" icon="energy" {
                    Text item=RSWStemperature
                    Text item=RSWShumidity

And finally the rules which takes care of the conversion:

import org.openhab.core.library.types.*
rule "Convert Temperature value"
        Item  RSWStemperature_temp received update
        postUpdate(RSWStemperature, Float::parseFloat(RSWStemperature_temp.state.toString()) / 10)

rule "Convert Humidity value"
        Item  RSWShumidity_temp received update
        postUpdate(RSWShumidity, Float::parseFloat(RSWShumidity_temp.state.toString()) / 10)

I hope you like find this write-up useful. I certainly like this sensor and it is definitely a reasonable price for a temperature and humidity sensor. As far as I can tell, the actual sensor used is a reasonable good one, it does responds to changes very rapidly.



I have bought the same sensor, at least I think so and I’m trying to get it working with your instructions.

Unfortunately I am not able to communicate with the sensor. I tried using a Modbus master software with the default settings 4800 baud (8/1/N) slave address 1 and with the manufacturers configuration program but both seem to fail to get any response from the sensor.

Can you have a look at the pictures and let me know if this is the same sensor that you are using? Thanks.

I found out that my sensor has different default settings. It comes with 9600bps as factory default. Baudrate and slave address can be changed with a non standard custom Modbus request. This is described in the short instructions that come with the sensor. Unfortunately these are in chinese only but I figured it out :sunglasses:

Would you be able to share the custom ModBus request to send the device ID or a copy of the document?

Here is the source code of the utility I wrote for changing slave address and baudrate. You will find the message format in the comments.

Hi, Maybe you have available link to yours tool to change slave id?:slight_smile:

Here you go:
I moved to a new repository.