home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.1k stars 31.1k forks source link

Weatherflow air pressure is incorrect #103231

Closed asjmcguire closed 8 months ago

asjmcguire commented 1 year ago

The problem

The air pressure being reported by the weather flow integration is either the incorrect value or is not being adjusted for the station height.

Screenshot_20231102-100958 Reported by integration

Screenshot_20231102-101015 Reported by tempest app

Screenshot_20231102-101116 Reported by weatherflow2mqtt

As you can see weatherflow2mqtt reports 2 values:

Screenshot_20231102-101216

What version of Home Assistant Core has the issue?

core-2023.11.0

What was the last working version of Home Assistant Core?

None

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Weatherflow

Link to integration documentation on our website

https://www.home-assistant.io/integrations/weatherflow

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @natekspencer, @jeeftor, mind taking a look at this issue as it has been labeled with an integration (weatherflow) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `weatherflow` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign weatherflow` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


weatherflow documentation weatherflow source (message by IssueLinks)

natekspencer commented 1 year ago

The air pressure you are seeing is not incorrect per se. It's just the air/station pressure as measured by the device itself. You can see that it matches the "Station Pressure" provided in WeatherFlow2MQTT. The Tempest app shows only Sea Level Pressure, which is the elevation adjusted pressure. Additionally, the WeatherFlow2MQTT integration provides this useful calculation in a different sensor entity as you've pointed out.

That being said, it should probably be made more clear which pressure this is referring to by renaming it to Station pressure or updating the documentation. Additionally, a new sensor can be added for sea level pressure which is the elevation adjusted pressure, similar to what is done in WeatherFlow2MQTT and what is shown in the Tempest app.

@jeeftor might know more as to why it was renamed to Air pressure instead of Station pressure as it started out.

asjmcguire commented 1 year ago

Obviously it's only my opinion, but - station pressure is of limited use to normal users. All forecast maps online and on TV refer to sea level pressure. It will be utterly confusing for people why the sensor being exposed by this integration is so wildly different from any forecasts they have seen. For what it's worth I'm only 150m above sea level.

I did spend several hours trying to find the relevant calculation that WeatherFlow2MQTT is performing, having seen the actual calculation on the WeatherFlow docs.

https://weatherflow.github.io/Tempest/api/derived-metric-formulas.html

natekspencer commented 1 year ago

Obviously it's only my opinion, but - station pressure is of limited use to normal users. All forecast maps online and on TV refer to sea level pressure. It will be utterly confusing for people why the sensor being exposed by this integration is so wildly different from any forecasts they have seen. For what it's worth I'm only 150m above sea level.

I agree that station pressure is the less useful of the two. I would argue, though, that this is a necessary feature request rather than being incorrect (aside from some clarification). It is slightly more complicated to add only because it requires an input of the elevation from somewhere so that it can be used in the calculation. It took a long time just to get the integration approved, but that doesn't mean we are done enhancing it or making it better. Now that October is over (I'm a huge Halloween fan and spend way too much time preparing for the holiday), I can get back to sparing some time on these enhancements and improvements.

I did spend several hours trying to find the relevant calculation that WeatherFlow2MQTT is performing, having seen the actual calculation on the WeatherFlow docs.

https://weatherflow.github.io/Tempest/api/derived-metric-formulas.html

The library actually has the formula for it already: https://github.com/briis/pyweatherflowudp/blob/main/pyweatherflowudp/calc.py#L132

asjmcguire commented 1 year ago

Oh that should make things a lot easier then, especially because Home Assistant already knows height above sea level - it's part of the general config, so presumably you can use that by default, before adding a field to the config flow (which could default to the same value Home Assistant already knows).

aburow commented 11 months ago

The station pressure is not corrected to sea level. Here is a bit of a snippet I've used. It was based on some other ESPHome stuff I did. Insert the following into configuration.yaml; adjusting for altitude - this is for the observation units we use in Australia. Works fine for me -YMMV

It would have been nice to have some of these calcs done. Not everyone has the patience and capability and it broke a handful of my automations.

sensor:
  - platform: template
    sensors:
      altitude:
        friendly_name: "Altitude"
        unit_of_measurement: "m"
        icon_template: mdi:altimeter
        value_template: "{{ 111.8 }}"
#
### Convert Station Pressure to Pressure at Sea Level ###
# Use Babinet's formula to approximate hPa@asl
# Uses sensor.altitude (from above)
#
  - platform: template
    sensors:
      weatherflow_sea_level_pressure:
        friendly_name: "Weatherflow Sea Level Pressure"
        unit_of_measurement: "hPa"
        value_template:
          "{{ ( float(states('sensor.weatherflow_station_pressure')) *
                  ( 16000.0 +
                  (64.0 * float(states('sensor.weatherflow_air_temperature')))
                  + float(states('sensor.altitude')))
                  /
                  ( 16000.0 +
                  (64.0 * float(states('sensor.weatherflow_air_temperature')))
                  - float(states('sensor.altitude')))
                  ) | round(2)
          }}"
issue-triage-workflows[bot] commented 8 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

jeeftor commented 8 months ago

@aburrow - want to make a PR? :)

aburow commented 8 months ago

@aburrow - want to make a PR? :)

The missing component is altitude, but it needs to be specific to the actual sensor if you want to be accurate. Any PR would be to store the altitude with the sensor data as opposed to a separate entity as I have done here. I have a range differential of approx 20m across my property. If I were to change the location of the weatherstation install the house wouldn't move, the sensor would.