Add athmospheric pressure from BME - mqtt problems?

I’m trying to parse athmospheric pressure from BME sensor. I modifyed the sh script in order to parse pressure from python. It worked ok.
The next step:
added a new “thing” - something similar to this:

Thing exec:command:getpress [ command="/home/pi/scripts/", interval=10, timeout=5 ]

It seems that also works ok.
When I try to get the command info on the habmin panel on “things” section, I get the pressure value:

Next step:
Add a new item taking temp and humi as examples:

String MyPress “Pressure” { channel=“exec:command:getpress:output” }
Number MyPressProxy “Pressure [%.0f %%]” { mqtt=">[mosquitto:hestia/local/pressure:state:*:default]" }

At this point start my problem: I can get a new topic called " pressure" to be consumed via mqtt on hesti/local/pressure.
When I try to connect to the hestia mqtt topic and subscribe to humi or temp topic, I can get the published valued, but for the pressure topic, I can get anything published.

Obviously, when I try to use on the sitemap, any value is parsed.

I’m not sure If I’m forgetting some important step, related with the mqtt pressure values published. I try to search in the forum for any information that can help me, but unfortunately I can’t found anything.
Any idea?
Many thanks!

Great idea. Could you please do a PR on github for your script or copy-paste it here with the credits as you want them to appear in the file and we will do the rest.

I assume the typo “hesti/…” is not how you entered it in HestiaPi, right? Please chack.
Additionally once you edited the items/sitemap/rules file it may take up to five minutes for RaspberryPi Zero to process and update. A reboot is the safest way to be honest if you want to be 100% sure (and wait :)).

Try this command from a Linux machine

mosquitto_sub -h [HESTIA_PI_IP] -d -t hestia/#

and tell us the output after 1-2 minutes.
Lastly please check permissions and owner of .sh script and report back

ls -la /home/pi/scripts

Hello! Finally I solved my problem. Was a stupid mistake related with the rule “convertproxy”. I forget to assign the value of MyPressure to MyPressureProxy.

At default rules:

Summary ( To get some atmospheric pressure) - Not necessary any credits, thanks for the offer, it’s just some modifications about your work.

Generate a new script at /home/pi/scripts — with this content (you can copy some of the existing scripts, and just modify the content. Remember to setup the correct owner and property and make a chown root:root, when you cp the file using the pi user, the property and the content is changed. Try to validate it with ls -la


python /home/pi/scripts/ | grep Pressure | awk ‘{print $3}’ | cut -c -6

Modify the file default.things and add a new line with this content:
Thing exec:command:getpress [ command="/home/pi/scripts/", interval=10, timeout=5 ]

// Adjust the interval refresh at your needs, may be its not necessary to refresh the pressure value every 10s.

Modify the file default.items and add this two lines for pressure:

String MyPressure “Pressure” { channel=“exec:command:getpress:output” }
Number MyPressureProxy “Pressure [%.2f hPa]” { mqtt=">[mosquitto:hestia/local/pressure:state:*:default]" }

Finally modify default.sitemap at your needs and the default.rules

Frame label=“Current values” {
Text item=MyTempProxy
Text item=MyHumiProxy
Text item=MyPressureProxy

and modify the “convertproxy” rule at default.rules:

rule “convertproxy”
Item MyTemp changed or
Item MyHumi changed or
Item MyPressure changed

/*CELSIUS/ if ((Double::parseDouble(MyTemp.state.toString) < (Double::parseDouble(PreviousTempReading.state.toString)) - 0.2) || (Double::parseDouble(MyTemp.state.toString) > (Double::parseDouble(PreviousTempReading.state.toString)) + 0.2)) {
if ((Double::parseDouble(MyHumi.state.toString) < (Double::parseDouble(PreviousHumiReading.state.toString)) - 0.4) || (Double::parseDouble(MyHumi.state.toString) > (Double::parseDouble(PreviousHumiReading.state.toString)) + 0.4)) {

Finally I get something similar to this (My language strings are in Catalan, but sure that you can get an idea…)

tcrrct, I had this working a while ago, sorry I didn’t see your post in time! You can graph it as well using Groups in the items file, rrd4j persistence and a Chart.

As you can see I’m still having occasional glitches coming through on the Sensirion sensors I have as well as the BME280’s; note I planned to move persistence over to my full OpenHab instance eventually, so the Hestiapi wouldn’t have so much storage traffic.

If you have further trouble hopefully I can help!

@tcrrct and @Strawberry your work is now officially released and will be included in next image file :wink:

Thank you guys!