DHT11 + D1mini/Tasmota/Sonoff + HABPanel Widget + Value Transformation

Trying to get a D1-Mini working with a DHT11 temperature/humididty sensor to send info to openhab and display on the HABPanel correctly.

I am able to send the info from the DHT11 to open hab and I can see it in the logs coming in, however on HABPanel it is not easy to read and I cannot figure out how to transform the incoming data to just display temperature or humidity.

For example, I added a “Selection” widget (only one I could get to do anything) and it displays
{“Time”:“2019-08-06T18:02:19”,“DHT11”:{“Temperature”:26.0,“Humidity”:64.0},“TempUnit”:“C”}

How do I get this to just display the current Temperature and Humidity only? Is this done via Value Transformation?

depends on your JSON format
if using tasmota it should be something like

JSONPATH:$.BME280.Temperature

search for name of your sensor in mqtt message
and you need two channels, one for humidity and one for temperature

I have for example three

Channels:
    Type number : temperature   "Temperature"   [ stateTopic="home/diningroom/climate/tele/SENSOR", transformationPattern="JSONPATH:$.BME280.Temperature" ]
    Type number : humidity      "Humidity"      [ stateTopic="home/diningroom/climate/tele/SENSOR", transformationPattern="JSONPATH:$.BME280.Humidity" ]
    Type number : pressure      "Pressure"      [ stateTopic="home/diningroom/climate/tele/SENSOR", transformationPattern="JSONPATH:$.BME280.Pressure" ]

I have tried the following in the field “Incoming value transformation” with errors.

JSONPATH:$.BME280.Temperature
JSONPATH:$.DHT11.Temperature
JSONPATH:$.barnrelay1.Temperature

All kick back the same error from the log of openhab

Transformation service JSONPATH for pattern $.BME280.Temperature not found!
Transformation service JSONPATH for pattern $.DHT11.Temperature not found!
Transformation service JSONPATH for pattern $.barnrelay1.Temperature not found!

On the console of my d1 mini I see this.

00:00:05 MQT: Connected
00:00:05 MQT: tele/barnrelay1/LWT = Online (retained)
00:00:05 MQT: cmnd/barnrelay1/POWER =
00:00:05 MQT: tele/barnrelay1/INFO1 = {“Module”:“Generic”,“Version”:“6.6.0(release-sonoff)”,“FallbackTopic”:“cmnd/barnrelay1_fb/”,“GroupTopic”:“sonoffs”}
00:00:05 MQT: tele/barnrelay1/INFO2 = {“WebServerMode”:“Admin”,“Hostname”:“barnrelay1-2228”,“IPAddress”:“10.1.5.16”}
00:00:05 MQT: tele/barnrelay1/INFO3 = {“RestartReason”:“Software/System restart”}
19:15:09 MQT: tele/barnrelay1/STATE = {“Time”:“2019-08-06T19:15:09”,“Uptime”:“0T00:00:16”,“Heap”:15,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:23,“Wifi”:{“AP”:1,“SSId”:“AP1”,“BSSId”:“84:16:F9:C8:D8:0C”,“Channel”:11,“RSSI”:38,“LinkCount”:1,“Downtime”:“0T00:00:04”}}
19:15:09 MQT: tele/barnrelay1/SENSOR = {“Time”:“2019-08-06T19:15:09”,“DHT11”:{“Temperature”:27.0,“Humidity”:61.0},“TempUnit”:“C”}

means you have prefix DHT11
just do

JSONPATH:$.DHT11.Temperature

means you don’t have Json transformation installed, go to your PaperUI -> Addons -> Transformations and install it

1 Like

ok here is what I get with that from the openhab Log file.

==> /var/log/openhab2/openhab.log <==
2019-08-06 14:26:39.881 [WARN ] [l.generic.ChannelStateTransformation] - Transformation service JSONPATH for pattern $.DHT11.Temperature not found!

I am missing something I think, but not sure what.

Screenshot of the channel config

Ok installed tranformations and set the config. All working now.
On to converting from Celsius to Farenheit somehow. :slight_smile:

well, it’s already built in tasmota

do not reinvent the weel :wink:

SetOption8	Show temperature in
0= Celsius (default)
1 = Fahrenheit

Well that was easy, thanks. Now its in Fahrenheit!!