Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pressure adjustment #1

Open
sybux opened this issue Aug 1, 2022 · 1 comment
Open

Pressure adjustment #1

sybux opened this issue Aug 1, 2022 · 1 comment

Comments

@sybux
Copy link

sybux commented Aug 1, 2022

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
Copy link
Author

sybux commented Aug 2, 2022

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant