Using DHT11 with MQTT

Hi everyone.I’m new in OH and a I have a little problem.
First I followed this tutorial to install mosquitto:

Then, this tutorial:

But I had 2 problems:

1- I can’t, the

dht.sh

automatically start at boot, I added the file to rc.local but nothing happens. Then, once started the system run ./dht.sh manually and mqtt runs perfectly.

2-Running mqtt correctly and having the readings of the values. I can’t transfer those values to my OpenHab. With MQTTLens I can also see the values of humidity and temperature (attached image below)

This is my setup in Openhab

Sitemap

sitemap demo label="Menú"
{
Frame label="Habitación" {
		Default item=Cupboard_temp
        Default item=Cupboard_humidity
	}
}

Items

 Number Cupboard_temp "Temperature [%.1f °C]" <temperature> {mqtt="<[mosquitto:habitacion/temperature1:state:default]"}
 Number Cupboard_humidity "Humidity [%.0f %%]" <line> {mqtt="<[mosquitto:habitacion/humidity1:state:default]"}

Things: No.
No mqtt.cfg file.
Install binding-mqtt via PaperUI.

I’ve also tried this delivery without any results.

Any help?

I’m using Rpi 3 B+ with Raspbian and OpenHAB 2.4

Thanks for your help!

Welcome to the openHAB Forum.

No MQTT.cfg file points to the new MQTT binding, the syntax for the item to the MQTT Version 1 binding!

1 Like

Can you help me with the syntax of mqtt binding 2? What would be the correct way to write it?

Welcome to the OpenHAB community!
Search this forum for clues. Search mqtt2 in the tutorial section. I’m on phone so best I can do right now but you have to create a generic mqtt thing

1 Like

Have a look into the documentation.
Much depends on how your device is reporting the values, or better how the mqtt message is setup.