[SOLVED] MQTT binding, things, item and sitemap

Hello all,

I have some items in my openhab2 that post data to a mqtt topic witch is then displayed in openhab sitemap. Works great.

I just added a ds18b20 temp sensor.
in my .things i added:

Type number : DS18B20Temperature "Temperature"[stateTopic="DS18B20/temp"]

In my .items i added:

Number DS18B20Temperature "DS18B20-Temperature [%.2f °C]" <temp> {channel="mqtt:topic:broker:miflora:DS18B20temp"}

In my .sitemap i added:

Text item=DS18B20Temperature

And i do see the name of the item and the [%.2f °C] sign, but i don’t see the actual temp data. What did i do wrong here?

Greets

1 Like

I could bet this MQTT Topic does not report a single value.
Maybe something like this

{"Time":"1970-04-13T21:47:30","ENERGY":{"Total":2.332,"Yesterday":0.000,"Today":2.332,"Period":0,"Power":5,"Factor":0.15,"Voltage":216,"Current":0.140}}

If that is the case you need to add a

transformationPattern="JSONPATH:$.Voltage"


There are many people who already did that, for example here

EDIT:

DS18B20Temperature "DS18B20-Temperature [%.2f °C]" <temp> {channel="mqtt:topic:broker:miflora:DS18B20temp"}

This also looks very wrong!
I bet your broker is not called “broker”

1 Like

@BrutalBirdie thanks for the reply.

Yes my broker is called broker, have multiple sensors and all post there data to the mqtt broker. And they are working.
I do receive the temp value in mosquitto i checked it with mqtt.fx
But i do see only one value in that topic like “14.00” my other sensors both read 23C so maby the sensors i broken, but i sould still see the value in openhab as it is posted in the mqt topic.

EDIT:
My miflora plant sensor is posting with JsonPath. In that topic i see multiple values coming-in. But the DS18B20 topic has only one val
This is the complete .things file:

Bridge mqtt:broker:broker [ host="192.168.178.192", secure=false, clientid="openhab", username="MyUser", password="MyPass" ]
{
  Thing topic miflora {
  Channels:
      Type number : temperature "Air Temperature"   [ stateTopic="sensor/temperature_celsius"]
      Type number : humidity "Humidity"  [stateTopic="sensor/humidity"]

      Type number : miflora "Miflora" [stateTopic="miflora/miflora1", transformationPattern="JSONPATH:$.temperature"]

      Type number : CO2 "CO2"[stateTopic="CCS811/CO2"]
      Type number : ETVOC "ETVOC" [stateTopic="CCS811/ETVOC"]

      Type number : CCS811BME280temperature "Temperature"[stateTopic="CCS811/BME280/temperature"]
      Type number : CCS811BME280humidity "Humidity"[stateTopic="CCS811/BME280/humidity"]
      Type number : CCS811BME280altitude "Altitude"[stateTopic="CCS811/BME280/altitude"]
      Type number : CCS811BME280pressure "Pressure"[stateTopic="CCS811/BME280/pressure"]



      Type number : SCD30co2 "CO2"[stateTopic="SCD30/co2"]
      Type number : SCD30temperature "Temperature"[stateTopic="SCD30/temperature"]
      Type number : SCD30humidity "Humidity"[stateTopic="SCD30/humidity"]

      Type number : BME280temperature "Temperature"[stateTopic="BME280/temperature"]
      Type number : BME280humidity "Humidity"[stateTopic="BME280/humidity"]
      Type number : BME280altitude "Altitude"[stateTopic="BME280/altitude"]
      Type number : BME280pressure "Pressure"[stateTopic="BME280/pressure"]

      Type number : DS18B20Temperature "Temperature"[stateTopic="DS18B20/temp"]

   }
}

My .items file:

Number Temperature "DHT11-Air Temperature[%.2f °C]" <temp>  {channel="mqtt:topic:broker:miflora:temperature"}
Number Humidity "DHT11-Humidity[%.2f %%]" <humidity>  {channel="mqtt:topic:broker:miflora:humidity"}


Number CO2 "CCS811-CO2 [%d ppm]"  <co2> {channel="mqtt:topic:broker:miflora:CO2"}
Number ETVOC "CCS811-ETVOC [%d ppb]"  <voc> {channel="mqtt:topic:broker:miflora:ETVOC"}

Number SCD30co2 "SCD30-CO2 [%d ppm]" <co2> {channel="mqtt:topic:broker:miflora:SCD30co2"}
Number SCD30temperature "SCD30-Temperature [%.2f °C]" <temp> {channel="mqtt:topic:broker:miflora:SCD30temperature"}
Number SCD30humidity "SCD30-Humidity [%.2f %%]" <humidity> {channel="mqtt:topic:broker:miflora:SCD30humidity"}

Number BME280altitude "BME280-Altitude [%.1f N.A.P]" <text> {channel="mqtt:topic:broker:miflora:BME280altitude"}
Number CCS811BME280altitude "CCS811/BME280-Altitude [%.1f N.A.P]" <text> {channel="mqtt:topic:broker:miflora:CCS811BME280altitude"}
Number BME280temperature "BME280-Temperature [%.2f °C]" <temp> {channel="mqtt:topic:broker:miflora:BME280temperature"}
Number CCS811BME280temperature "CCS811/BME280-Temperature [%.2f °C]" <temp> {channel="mqtt:topic:broker:miflora:CCS811BME280temperature"}
Number BME280humidity "BME280-Humidity [%.2f %%]" <humidity> {channel="mqtt:topic:broker:miflora:BME280humidity"}
Number CCS811BME280humidity "CCS811/BME280-Humidity [%.2f %%]" <humidity> {channel="mqtt:topic:broker:miflora:CCS811BME280humidity"}
Number BME280pressure "BME280-Pressure [%.2f hPa]" <barometer> {channel="mqtt:topic:broker:miflora:BME280pressure"}
Number CCS811BME280pressure "CCS811/BME280-Pressure [%.2f hPa]" <barometer> {channel="mqtt:topic:broker:miflora:CCS811BME280pressure"}

Number DS18B20Temperature "DS18B20-Temperature [%.2f °C]" <temp> {channel="mqtt:topic:broker:miflora:DS18B20temp"}




My .sitemap:

sitemap NeoPixel label="NeoPixel"
{
        Frame label="NeoPixel" {


Text item=home_miflora1_LightIntensity
Text item=home_miflora1_AirTemperature
Text item=home_miflora1_SoilMoisture
Text item=home_miflora1_SoilConductivity
Text item=home_miflora1_Battery



Text item=Temperature
Text item=Humidity

Text item=CO2
Text item=ETVOC

Text item=SCD30co2
Text item=SCD30temperature
Text item=SCD30humidity

Text item=DS18B20Temperature

Text item=BME280temperature
Text item=CCS811BME280temperature
Text item=BME280humidity
Text item=CCS811BME280humidity
Text item=BME280pressure
Text item=CCS811BME280pressure
Text item=BME280altitude
Text item=CCS811BME280altitude

The DS18B20 is the only sensor i don’t see the value of on my sitemap.

Greetings

Item has to be linked to

Number DS18B20Temperature "DS18B20-Temperature [%.2f °C]" <temp> {channel="mqtt:topic:broker:miflora:DS18B20Temperature"}

(if the Thing is called miflora and the broker is called broker)

2 Likes

@Udo_Hartmann Thanks for the reply.

I completely mist that. Thanks it is now working like a charm.

Greetings