openhab example for reading DHT22 sensor

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Niklas
New user
Posts: 4
Joined: 26 Oct 2015, 22:57

openhab example for reading DHT22 sensor

#1 Post by Niklas » 26 Oct 2015, 23:08

Hello together,

First, let me say, that ESPeasy is really great.
I configured my ESP to use the openhab MQTT protocol and set up openhab with Mosquitto MQTT broker.
I can switch a LED on and off as explained in the example in the wiki but the question is how I can read the sensor values of my DHT22? In the configuration of the ESP I can see that the sensor is working but I cannot receive anything in openhab.

My item looks as follows:
Number MQTTTEMP "Temperature [%.1f °C]" {mqtt="<[localbroker:/openhabdemo/DHT/Temperature:state:default]"}

localbroker is my MQTT broker, openhabdemo the name of the ESP and DHT the name of the Task in whitch I configured the DHT22.

In the sitemap file I want to make the value viewable by:
Text item=MQTTTEMP

But I never receive a value. How should the binding look like?

ronnyvs
New user
Posts: 6
Joined: 18 Oct 2015, 22:53

Re: openhab example for reading DHT22 sensor

#2 Post by ronnyvs » 29 Oct 2015, 19:53

Hello Niklas,

I have exactly the same question, and I'm searching for over a week now...

dht22_ESPEasy.jpg
dht22_ESPEasy.jpg (116.64 KiB) Viewed 7553 times
Can someone tell me (us) how the line in the item-file will look like?

regards,

Ronny

fluppie
Normal user
Posts: 89
Joined: 09 Oct 2015, 13:23

Re: openhab example for reading DHT22 sensor

#3 Post by fluppie » 29 Oct 2015, 23:13

.sitemap file

Code: Select all

sitemap demo label="ESP Easy MQTT"
{
   Frame label="Sensors" {
      Text item=SlpkPhil_temp
      Text item=SlpkPhil_temp2
      Text item=SlpkPhil_press
      Text item=Bureau_temp
      Text item=Bureau_temp2
      Text item=Bureau_press
      /* Text item=Flukso_power */
      Text item=Switch1
      Switch item=Relay1 mappings=[ON="Go!"]
   }
.items file

Code: Select all

Group All
Group Weather 	(All)
Group Sensors (All)

/*Sensors */
Group Sensors
Number SlpkPhil_temp	"Slaapkamer Philippe temperatuur 	[%.2f °C]" 		<temperature>	(temperature, Sensors) 	{mqtt="<[localbroker:/ESPEasy01/DS18B20_1/Temperature:state:default]"}
Number SlpkPhil_temp2	"Slaapkamer Philippe temperatuur2	[%.2f °C]" 		<temperature>	(temperature2, Sensors)	{mqtt="<[localbroker:/ESPEasy01/BMP085_1/Temperature:state:default]"}
Number SlpkPhil_press	"Slaapkamer Philippe luchtdruk		[%.2f mbar]"	<pressure>		(pressure, Sensors) 	{mqtt="<[localbroker:/ESPEasy01/BMP085_1/Pressure:state:default]"}
Number Bureau_temp 	"Bureau temperatuur 	[%.2f °C]" 		<temperature>	(temperature, Sensors) 	{mqtt="<[localbroker:/ESPEasy02/DS18B20_1/Temperature:state:default]"}
Number Bureau_temp2 "Bureau temperatuur2	[%.2f °C]" 		<temperature>	(temperature2, Sensors)	{mqtt="<[localbroker:/ESPEasy02/BMP085_1/Temperature:state:default]"}
Number Bureau_press "Bureau luchtdruk		[%.2f mbar]"	<pressure>		(pressure, Sensors) 	{mqtt="<[localbroker:/ESPEasy02/BMP085_1/Pressure:state:default]"}

/* Number Flukso_power "Flukso huidig vermogen	[%.2f W]"	<power>		(power, Sensors) 	{mqtt="<[flukso:/sensor/ea7f86e230989e980c39efec3ab38218/gauge:state:default]"} */
Number Switch1         "Door Status [MAP(switch.map):%d]"    <garagedoor>       (Sensors) {mqtt="<[mqttbroker:openhab/garage/switch1:state:default]"}
Switch Relay1 "Garage Door"           <garagedoor>    (All) {mqtt=">[mqttbroker:openhab/garage/relay1:command:ON:GO]"}
Attachments
garagedoor.zip
(970 Bytes) Downloaded 364 times

fluppie
Normal user
Posts: 89
Joined: 09 Oct 2015, 13:23

Re: openhab example for reading DHT22 sensor

#4 Post by fluppie » 29 Oct 2015, 23:17

ESPeasy_1.PNG
ESPeasy_1.PNG (16.72 KiB) Viewed 7538 times

fluppie
Normal user
Posts: 89
Joined: 09 Oct 2015, 13:23

Re: openhab example for reading DHT22 sensor

#5 Post by fluppie » 29 Oct 2015, 23:18

ESPeasy_2.PNG
ESPeasy_2.PNG (24.49 KiB) Viewed 7538 times

jhleloux
New user
Posts: 1
Joined: 06 Nov 2015, 23:44

Re: openhab example for reading DHT22 sensor

#6 Post by jhleloux » 06 Nov 2015, 23:50

Hi there,
is this problem already solved ??? I got a solution !

Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests