Hi everyone.I’m new in OH and a I have a little problem.
First I followed this tutorial to install mosquitto:
Installing MQTT Broker(Mosquitto) on Raspberry Pi : In this instructables you will find how to install MQTT on Raspberry Pi. There are two methods to install mqtt, one is we directly connect keyboard mouse and monitor to a Pi , turn it on and go...
Then, this tutorial:
There are several items in the community forum about reading a DHTxx sensor, but I couldnt find anything comprehensive in the Tutorials and Examples… so, I guess the task to write a practical Tutorial is up to me.
As for coding it is no use to re-invent the wheel, I fortunately found someone on this forum (@psyciknz ) had done most of the work, albeit for a DHT22, while I am using a DHT11 but that was easy to alter.
For the next steps I presume you already have python installed. Jessie alread…
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.
I have followed this great guide Reading a DHT11/22 on a raspberry and send the results by MQTT to set up my DHT22 sensor but can not get it to show up in openhab and not sure why my config is as follows
dht.sh
/home/openhabian/mqtt.dhtsensor.py ‘house/temperature1’ ‘house/humidity1’ 4 50
Items file
Number GF_Hallway_Heating “Home temperature [%.1f °C]” (GF_Hallway, gHeating) {mqtt="<[mosquitto:house/temperature1:state:default]"}
Number GF_House_humidity “Home humidity [%.0f %%]” (GF_…
Any help?
I’m using Rpi 3 B+ with Raspbian and OpenHAB 2.4
Thanks for your help!
opus
(Jürgen Baginski)
August 8, 2019, 5:16am
2
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
opus
(Jürgen Baginski)
August 8, 2019, 5:59pm
5
Have a look into the documentation .
Much depends on how your device is reporting the values, or better how the mqtt message is setup.