I measure a number of factors in my home but this one eludes me. It takes the pressure at sea level which is static in my case. I would like it to update dynamically!
But my altitude above sea level changes? I know that I am 150 mtrs above sea level (according to OS)
Here is my relevant yaml.
There’s the issue.
There is no static air pressure. You need to get the data from some weather source (most likely).
Currently our pressure here is 987 and will go up to 992 by night.
That’s correct - the pressure altitude will change from day to night, and with the passage of high or low pressure systems.
The elevation of your home (i.e. its height above mean sea level) is fixed, unless you have earthquakes or live in a mobile home.
It can’t be accurately measured with a barometer, you would need a surveyor to tell you that, though a GPS altitude would come close if averaged over a period of time. But once you know the elevation you don’t need to re-measure it since it doesn’t change.
The measurement of altitude, based on barometric pressure, once essential to knowing altitude in an aircraft in flight, is a novelty now mostly replaced by GPS.
For accurate elevation, Google Earth Pro will provide ground-elevation for any location, probably accurate to one meter.
For doing dynamic ‘barometric elevation’ based on live pressure reading, the documentation is already there. Replace STANDARD_SEA_LEVEL_PRESSURE with a live pressure reading from a known source.
Weather stations report local barometric pressure, and may or may not adjust the reading taken from the location elevation back to an equivalent value at average sea-level (0.6 metres in the UK). It is necessary to find a reporting station in the close vicinity since weather fronts can change pressure even over a few miles. Then you need to uplift this information when reported. If the station reports only every hour, the value will only be valid at report, again because advancing pressure fronts can change the situation rapidly. If the weather station does not adjust pressure for altitude at the reading point, then again this figure needs to be adjusted back to sea-level to obtain the sea-level equivalent reading.
BMP280 devices are remarkably sensitive, and in experimentation I found it possible to detect an elevation difference from the taken reading at just 10 cm, which means I could use the device to determine the elevation of my desk off the floor. As long as I took a reference pressure reading at the floor at the start of the process. Useful if you want to know if you have gone up stairs or not.
Since your house is (I assume) not floating around, the reverse computation is more useful. Take the current measured barometric pressure, at your known elevation, and back-calculate the sea-level pressure equivalent.
Most UK-wide weather forecasts should report pressure, which changes according to weather, based on sea-level equivalent. Taking a pressure reading above sea-level and then adjusting for reading-elevation means that comparison between your pressure and reported pressure becomes like-for-like. Easier to do this too…
The notes for this are in the section below the link I quoted - just remember that you can do one (altitude) or the other (sea level pressure) not both.