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:
MyPressureProxy.postUpdate(Double::parseDouble(MyPressure.state.toString)).
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 — getBMEpressure.sh 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
#!/bin/bash
python /home/pi/scripts/bme280.py | 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/getBMEpress.sh", 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
//default.sitemap
Frame label=“Current values” {
Text item=MyTempProxy
Text item=MyHumiProxy
Text item=MyPressureProxy
}
and modify the “convertproxy” rule at default.rules:
rule “convertproxy”
when
Item MyTemp changed or
Item MyHumi changed or
Item MyPressure changed
then
MyTempProxy.postUpdate(Double::parseDouble(MyTemp.state.toString))
MyHumiProxy.postUpdate(Double::parseDouble(MyHumi.state.toString))
MyPressureProxy.postUpdate(Double::parseDouble(MyPressure.state.toString))
/*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)) {
PreviousTempReading.postUpdate(Double::parseDouble(MyTemp.state.toString))
/*CELSIUS/ }
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)) {
PreviousHumiReading.postUpdate(Double::parseDouble(MyHumi.state.toString))
}
end
Finally I get something similar to this (My language strings are in Catalan, but sure that you can get an idea…)