MQTT Heartache

I’m having difficulty getting a value into OH from an PSI sensor that I’ve built.

Here’s what I have done.

  1. Utilized ESPEasy to connect to the sensor and broadcast back the data to OH.

  2. Using MQTT Spy and MQTT Box I have subscribed to the topic and I can see data coming in.

  3. Currently the data is comming in as a negative value ex: -350.00, -329.00, -305.00 etc.

The item looks like this…

Number poolpump_psi "DE Filter PSI [%.1f]" {mqtt="<[broker:Pressure_Sensor/PSI_Sensor/PSI:state:REGEX((.*?))]"}

Simple Sitemap

Text item=poolpump_psi

This is what I see on my sitemap:

Just the - sign

I’ve tried different transformations and nothing seems to work…

What am I missing???

Sample MQTT message

<MqttMessage id="180" timestamp="1538371910558" topic="/Pressure_Sensor/PSI_Sensor/PSI" qos="0" retained="false">-329.00</MqttMessage>,


It looks like the MQTT message is sent to a topic with a leading slash (*), however, your item is setup to subscribe to the topic without the leading slash. If possible, try removing the leading slash from the publisher (your ESPEasy device). Alternatively, try to add it to the subscriber (openHAB).

(*) Although fully compliant to the “MQTT specification”, I believe most sources recommends to not use a leading slash in your MQTT topics.

Correct, it adds a layer to the topics and can cause confusion. As it did just here

@KjetilA / @vzorglub

Thanks to both of you - after looking at it for hours…it all melted together - and it was right there in front of my eyes.

I have since gone in to ESPEasy and adjusted the configuration for the MQTT topic and removed the leading slash.