SolarWS icon indicating copy to clipboard operation
SolarWS copied to clipboard

Pressure adjustment

Open sybux opened this issue 3 years ago • 1 comments

Hello, I've found why my pressure sensor read wrong value. It's because of the sea level adjustment. Values that we can read on meteo maps are always based on sea level. So if you're higher than sea, you need to adjust this value. There is a formula to correct this but I don't know how to implement it in the ESP yaml file.

We need :

  • Pressure from sensor (P)
  • Actual temperature for more accurate value (T)
  • altitude of the installation (h)

The formula is : image

P0 is the value we want to read in HA :)

Do you think you can add this in the sensor template ?

sybux avatar Aug 01 '22 23:08 sybux

Finally I made it working. Here is the code. You can if you want include it in yours

- platform: bme280 address: 0x76 temperature: name: '${display_name} WS Temperature' oversampling: 8x unit_of_measurement: "°C" icon: "mdi:thermometer" device_class: "temperature" state_class: "measurement" accuracy_decimals: 1 id: internal_temp pressure: name: '${display_name} Pressure' oversampling: 16x unit_of_measurement: "hPa" device_class: "pressure" state_class: "measurement" id: pressure filters: - lambda: |- return ((x * powf((1 - (0.0065*${elevation})/(id(internal_temp).state+(0.0065*${elevation})+273.15)),-5.257) )); humidity: name: '${display_name} Humidity' oversampling: 4x unit_of_measurement: "%" icon: "mdi:thermometer" device_class: "humidity" id: internal_humidity state_class: "measurement"

and add this line in the substitution section : elevation: 'value of elevation of your home'

sybux avatar Aug 02 '22 22:08 sybux