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
70.06k stars 29.13k forks source link

WeatherFlow Cloud is returning hail condition during snow/sleet/wintry mix #113310

Open itpeters opened 4 months ago

itpeters commented 4 months ago

The problem

I have an automation that feeds WeatherFlow Cloud hourly forecast details to an LLM to get a summary of the next 24 hours of weather. I'm currently expecting (according to NWS forecasts) 12-24" of snow starting late tonight and into the next day, but my LLM summary keeps talking about hail.

Upon inspecting the returned results from weather.get_forecasts targeting my WeatherFlow Cloud entity, turns out that's because the returned forecast lists hail as the condition quite a bit.

Here's the next 8 hours as returned by weather.get_forecasts:

    - datetime: "2024-03-13T23:00:00Z"
      condition: lightning
      uv_index: 1
      wind_bearing: 70
      temperature: 43
      apparent_temperature: 36
      wind_gust_speed: 15.66
      wind_speed: 8.95
      precipitation: 0
      humidity: 75
    - datetime: "2024-03-14T00:00:00Z"
      condition: lightning
      uv_index: 0
      wind_bearing: 40
      temperature: 39
      apparent_temperature: 34
      wind_gust_speed: 13.42
      wind_speed: 8.95
      precipitation: 0
      humidity: 80
    - datetime: "2024-03-14T01:00:00Z"
      condition: rainy
      uv_index: 0
      wind_bearing: 350
      temperature: 37
      apparent_temperature: 30
      wind_gust_speed: 13.42
      wind_speed: 8.95
      precipitation: 0.04
      humidity: 86
    - datetime: "2024-03-14T02:00:00Z"
      condition: rainy
      uv_index: 0
      wind_bearing: 330
      temperature: 36
      apparent_temperature: 30
      wind_gust_speed: 13.42
      wind_speed: 8.95
      precipitation: 0.08
      humidity: 91
    - datetime: "2024-03-14T03:00:00Z"
      condition: hail
      uv_index: 0
      wind_bearing: 330
      temperature: 36
      apparent_temperature: 28
      wind_gust_speed: 13.42
      wind_speed: 8.95
      precipitation: 0.08
      humidity: 92
    - datetime: "2024-03-14T04:00:00Z"
      condition: hail
      uv_index: 0
      wind_bearing: 340
      temperature: 34
      apparent_temperature: 28
      wind_gust_speed: 11.18
      wind_speed: 8.95
      precipitation: 0.08
      humidity: 93
    - datetime: "2024-03-14T05:00:00Z"
      condition: hail
      uv_index: 0
      wind_bearing: 350
      temperature: 34
      apparent_temperature: 27
      wind_gust_speed: 13.42
      wind_speed: 8.95
      precipitation: 0.08
      humidity: 92
    - datetime: "2024-03-14T06:00:00Z"
      condition: hail
      uv_index: 0
      wind_bearing: 350
      temperature: 34
      apparent_temperature: 27
      wind_gust_speed: 13.42
      wind_speed: 8.95
      precipitation: 0.08
      humidity: 92

Here's the same information captured from my station at tempestwx.com:

Screenshot 2024-03-13 16 14 19

lightning and rainy seem to match up, but when the forecast condition starts saying hail, inspecting the element of the tempestwx.com forecast shows <span style="background-image: url(/images/Updated/sleet.svg"></span>, and sleet seems more accurate than hail.

Is it possible that some condition(s) are not being mapped correctly? My Tempest app and the web page summarize the days overall as "wintry mix", and the Tempest API at https://weatherflow.github.io/Tempest/api/swagger/#!/forecast/getBetterForecast doesn't seem to list hail as a potential condition string, so I'm not sure where that's coming from.

What version of Home Assistant Core has the issue?

core-2024.3.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

WeatherFlow Cloud

Link to integration documentation on our website

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

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 4 months ago

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

Code owner commands Code owners of `weatherflow_cloud` 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_cloud` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


weatherflow_cloud documentation weatherflow_cloud source (message by IssueLinks)

jeeftor commented 4 months ago

I have NO idea exactly ... because I'm just taking raw endpoint data. I know there are some "bugs" in the .0 release which will get fixed in .1 ...

Are you able to pull your raw better_forecast endpoint?

jeeftor commented 4 months ago

https://weatherflow.github.io/Tempest/api/swagger/#!/forecast/getBetterForecast

Thats what I'm using for forecasts.. its very possible something is off but I'm not sure exactly what/how to track it down yet.

I'd say can we validate 3 things>

Tempest App Home Assistant Raw endpoint

And maybe get more info from there

jeeftor commented 4 months ago
image

Also they may not have a hail.svg

jeeftor commented 4 months ago
image

These are their supported icons I think

jeeftor commented 4 months ago

I think either:

HA is converting stuff to hail - or - better_forecast is returning something that doesn't match the api

jeeftor commented 4 months ago

I think sleet isn't supported...

https://github.com/home-assistant/core/blob/bf02befe4a5f37b26102548588350b2bcbbe9658/homeassistant/components/weather/__init__.py#L97-L112

itpeters commented 4 months ago

Here's my raw getBetterForecast result. No hail, lots of sleet. betterForecast.json

I see your point about the underlying HA weather component not supporting sleet. Any chance we can get that added? At least in this part of Colorado, those are very different things -- sleet is little ice pellets mixed with rain and/or snow, whereas hail is golf ball-sized chunks of ice that can total your car or destroy your shingle roof.

jeeftor commented 4 months ago

I looked at my forecast and figured you must be near by (Colorado).

Getting hail in likely would require a discussion on the architecture repo.

https://github.com/home-assistant/architecture/discussions

If you open an issue link it here and maybe on the forums under weather flow. I think it's a reasonable option to add.

jeeftor commented 4 months ago

Have you considered a raw rest sensor to feed the llm?

You can hit the API 100 times a min I believe

jeeftor commented 4 months ago

Also I don't see hail in your forecast (but I'm also on my Phone )

jeeftor commented 4 months ago

And... now I'm at my computer.

Is the argument that Hail should become Sleet? Or tha the should have both sleet and hail as options?

itpeters commented 4 months ago

Wait, I think things got a bit confused here.

hail is already in the HA weather component, but sleet is not. It looks to me like when the WeatherFlow API getBetterForecast returns sleet, that is getting mapped to hail inside HA because there is no sleet condition, so I would propose adding sleet to HA.

Alternatively, if we could coerce the sleet response from getBetterForecast to the HA snowy-rainy condition that would at least be more accurate.

A raw rest sensor is a good idea for my LLM use case, but still leaves issues with things like weather dashboard components that need to be fed by a HA service.

jeeftor commented 4 months ago

If you can be patient we could add a config option - just the pr process takes sooo long. You could ping @briis to see if he would put the option into the hacs integration Sent from my iPhoneOn Mar 13, 2024, at 6:55 PM, itpeters @.***> wrote: Wait, I think things got a bit confused here. hail is already in the HA weather component, but sleet is not. It looks to me like when the WeatherFlow API getBetterForecast returns sleet, that is getting mapped to hail inside HA because there is no sleet condition, so I would propose adding sleet to HA. Alternatively, if we could coerce the sleet response from getBetterForecast to the HA snowy-rainy condition that would at least be more accurate. A raw rest sensor is a good idea for my LLM use case, but still leaves issues with things like weather dashboard components that need to be fed by a HA service.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

briis commented 4 months ago

There is unfortunately not a 1-1 mapping between the icons returned by Better Forecast and Home Assistant. Here is how I map them:

ICON_LIST = {
    "clear-day": "sunny",
    "clear-night": "clear-night",
    "cloudy": "cloudy",
    "foggy": "fog",
    "partly-cloudy-day": "partlycloudy",
    "partly-cloudy-night": "partlycloudy",
    "possibly-rainy-day": "rainy",
    "possibly-rainy-night": "rainy",
    "possibly-sleet-day": "snowy-rainy",
    "possibly-sleet-night": "snowy-rainy",
    "possibly-snow-day": "snowy",
    "possibly-snow-night": "snowy",
    "possibly-thunderstorm-day": "lightning-rainy",
    "possibly-thunderstorm-night": "lightning-rainy",
    "rainy": "rainy",
    "sleet": "snowy-rainy",
    "snow": "snowy",
    "thunderstorm": "lightning",
    "windy": "windy"
}
itpeters commented 4 months ago

Hi @briis, the approach and that mapping makes sense.

I have more winter weather arriving soon, and once again I have hail showing up in the forecast as returned inside HA. Here is the first hour in question as returned by the Better Forecast endpoint:

      {
        "air_temperature": 47,
        "conditions": "Wintry Mix Likely",
        "feels_like": 40,
        "icon": "sleet",
        "local_day": 24,
        "local_hour": 17,
        "precip": 1.52,
        "precip_icon": "chance-sleet",
        "precip_probability": 60,
        "precip_type": "sleet",
        "relative_humidity": 54,
        "sea_level_pressure": 984,
        "time": 1711321200,
        "uv": 2,
        "wind_avg": 6,
        "wind_direction": 320,
        "wind_direction_cardinal": "NW",
        "wind_gust": 10
      },

And here is the corresponding hour from the weather.get_forecasts service in HA:

    - datetime: "2024-03-24T23:00:00Z"
      condition: hail
      uv_index: 2
      wind_bearing: 320
      temperature: 46
      apparent_temperature: 41
      wind_gust_speed: 22.37
      wind_speed: 13.42
      precipitation: 0.04
      humidity: 54

Is it possible there's confusion between the icon and precip_icon? sleet has a mapping but chance-sleet does not.

Would it be helpful if I shared with you my station ID and an API token to look at yourself? If interested.

Thanks!

briis commented 4 months ago

@jeeftor is maintaining the Core Integration, that we are discussing here, so any chnges to the Icon mapping needs to come from him. The example I showed is from the Custom Integration Weatherflow Forecast which does the same (Plus currently a bit more) and I just put it there for inspiration.

jeeftor commented 4 months ago

@jeeftor is on a beach right now :)Sent from my iPhoneOn Mar 23, 2024, at 1:03 PM, Bjarne Riis @.***> wrote: @jeeftor is maintaining the Core Integration, that we are discussing here, so any chnges to the Icon mapping needs to come from him. The example I showed is from the Custom Integration Weatherflow Forecast which does the same (Plus currently a bit more) and I just put it there for inspiration.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

jeeftor commented 3 months ago

Ok @jeeftor managed to brave the denver airport and is now back in the country and apparently talking about himself in the 3rd person :)

@itpeters -> can we connect on the HA discord and discuss in more detail what mods you are looking for?

There is a limitation between what home Assistant supports and what tempest provides ... and ... we can come to a happy medium and/or have an "options flow"

[x] Colorado Mode

itpeters commented 3 months ago

Hey @jeeftor ! Congrats on navigating the perpetual disaster area that is KDEN. Hope your vacation was great!

I am happy to jump on discord if you'd like. I totally understand that there's a mapping that has to happen between the ontologies of Tempest vs Home Assistant. For the time being I have switched back to the custom integration built by @briis, which maps the Tempest sleet icon to the Home Assistant snowy-rainy condition. This feels like a more appropriate interpretation than mapping Tempest's sleet icon to the Home Assistant hail condition.

Again, happy to jump on discord if this doesn't make sense.

jeeftor commented 3 months ago

I guess since I don't have a strong feeling - I'm happy to adopt the other mapping if you prefer it because ... 1 person vs 0 persons = SURE :)

Just need to find the time to do it (maybe this weekend since its a VERY small change )...

I'm hoping the next release should nix most of the errors in the backing library.

In retrospect I probably should have parsed some of the endpoints differently -> as the tempest response will advertise which fields are present. In stead I had my station go offline for 3 days and so now I have what I think is a valid base set of "required" fields ... the rest I've made optional.

jeeftor commented 3 months ago

Ok I have a pull request ...

issue-triage-workflows[bot] commented 3 weeks 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 2 weeks ago

Can we close this? I the PR got merged a last month.