[SOLVED] Setting up BME280 sensor with Paper UI errors

I got rid of all the old MQTT ver 1 stuff. Reloaded everything and installed the upgrades bringing me up to MQTT 2.5. I am trying to set up the BME280 sensor in Paper UI. I have made the main MQTT broker connection in Things and pointed it to my IP of the Rpi. I have set up a generic MQTT connection to the ESP8266 reading the BME280 using the Bridge connection to the main MQTT broker. I click on the Add channel button to add a number value so I can get the temperature reading. I add BME280-1T for the channel ID. MQTT topic is tele/BME280-1/Sensor and the MQTT command topic is cmnd/BME280-1/POWER from the tasmota information shown below.

00:00:08 MQT: tele/BME280-1/LWT = Online (retained)
00:00:08 MQT: cmnd/BME280-1/POWER = 
05:40:12 MQT: tele/BME280-1/SENSOR = {"Time":"2019-03-02T05:40:12","ANALOG":{"A0":111},"BME280":{"Temperature":72.7,"Humidity":32.6,"Pressure":996.8},"PressureUnit":"hPa","TempUnit":"F"}

When I get to the Incoming value transformation line I was entering JSONPATH:$.BME280.Temperature
and it accepted it until I tried to link the channel to the reading on the screen. It pops up with a message box
Error

I thought I had the correct json entry but I guess I don’t and not sure what should go in there.

Here is the screen from MQTT.fx so now I’m really confused on what I should be entering.

I really want to make this work but I’m just about ready to pull the plug for good and scrap the whole project. Any last minute help??

John

Have you tried JSONPATH:$.BME280-1.Temperature or just $.BME280.Temperature? I use files only so it’s just a guess.:neutral_face:

Another guess is to try $.SENSOR.BME280.Temperature

Hi,
JSONPATH:$.BME280.Temperature is correct.
Do You have all transformation services installed?.
Command topic is unnecessary becouse you only reading value from sensor.
Readings are in strings so if you want to store them in database, this rule will convert it to a number.

rule "MQTT Temperature String to Number"
when
    Item MQTTThing_Temperature changed
then
    MQTTThing_Temperature_num.postUpdate(Float::parseFloat(String::format("%s",MQTTThing_Temperature.state).replace(' ','')))
    MQTTThing_Preasure_num.postUpdate(Float::parseFloat(String::format("%s",MQTTThing_Preasure.state).replace(' ','')))
    MQTTThing_Seepreasure_num.postUpdate(Float::parseFloat(String::format("%s",MQTTThing_Seepreasure.state).replace(' ','')))
    MQTTThing_Humidity_num.postUpdate(Float::parseFloat(String::format("%s",MQTTThing_Humidity.state).replace(' ','')))
end

Edit:
I was read again your post :slight_smile: Chanel must be string typ not number. And You need to add Generic MQTT Thing in Paper UI and all channels should be in it, not in the MQTT Broker
Best Regards
Rafal

H102 I have not tried those other combinations yet. If it’s easier to do the files maybe I should look into that. At this point I’m where I can get things to work but the log files have errors with MQTT. Now that I have moved up to 2.5, the things that worked before now don’t. I have been reading over the help files a lot but things just don’t click. If I can get one sensor to work without errors then the rest should be easier.

Thanks for the suggestions!

John

Rafal Thanks for the information. I assumed it should be a number since it is a number value being read from the sensor. I will try text and see if that works. I did have the json binding loaded and I was using the Generic MQTT Thing

Thanks for the info.
John

John, I have connected the BME 280 on esp with Tasmota to openHab via MQTT. If You wish I can show you config screenshots.

Regards
Rafal

Rafal
I would greatly appreciate it if you could do that! I have had such a hard time figuring this all out.
Thank you!!

john

Here You go :slight_smile:
Items:

String   MQTTThing_Temperature   "Temperature [%s °C]"        {channel="mqtt:topic:sky:temp"}
String   MQTTThing_Preasure      "Preasure [%s hPa]"          {channel="mqtt:topic:sky:Preasure"}
String   MQTTThing_Seepreasure   "Seepreasure [%s hPa]"       {channel="mqtt:topic:sky:seepreasure"}
String   MQTTThing_Humidity      "Humidity [%s %%]"           {channel="mqtt:topic:sky:Humidity"}

Number MQTTThing_Temperature_num  "Temperature [%.1f °C]"  <temperature>  (Sensor)
Number MQTTThing_Preasure_num     "Preasure [%.1f hPa]"    <pressure>     (Sensor)
Number MQTTThing_Seepreasure_num  "Seepreasure [%.1f hPa]" <pressure>     (Sensor)
Number MQTTThing_Humidity_num     "Humidity [%.1f %%]"     <pressure>     (Sensor)

Rules:

rule "MQTT Temperature String to Number"
when
    Item MQTTThing_Temperature changed
then
    MQTTThing_Temperature_num.postUpdate(Float::parseFloat(String::format("%s",MQTTThing_Temperature.state).replace(' ','')))
    MQTTThing_Preasure_num.postUpdate(Float::parseFloat(String::format("%s",MQTTThing_Preasure.state).replace(' ','')))
    MQTTThing_Seepreasure_num.postUpdate(Float::parseFloat(String::format("%s",MQTTThing_Seepreasure.state).replace(' ','')))
    MQTTThing_Humidity_num.postUpdate(Float::parseFloat(String::format("%s",MQTTThing_Humidity.state).replace(' ','')))
end

Esp:

Paper UI:
1


Rafal

1 Like