siku2 / hass-srf-weather

SRF Meteo forecasts for Home Assistant
MIT License
7 stars 3 forks source link

Use SRF Meteo API #2

Closed agners closed 3 years ago

agners commented 3 years ago

This change uses the new SRF Meteo API.

I am not sure if I should create a new component or if we should move your component over to the new SRF API.

Besides transitioning to the new API there are small fixes here and there (instead of rain_probability using precipitation_probability which is understood by the default weather card, better matching symbol_id condition translations).

I also added hourly forecast as that is what I am interested in for some automation :sunglasses:

agners commented 3 years ago

I've made some further changes getting rid of the extra hourly_forecast attribute. It seems that other Weather integrations (specifically OpenWeatherMap) provide hourly weather in the regular forecast attribute.

The SRF Weather API returns 4 days worth of hourly (1h and 3h forecasts) and 7 days worth of daily forecasts. I was thinking to provide hourly for the next 12 hours, then 3h forecasts for 2 days or so and the rest daily forecasts.

OpenWeatherMap allows to choose which forecasts should be in a given weather entity. However, that requires multiple entities. Since we fetch data as part of the entity class, it would lead to multiple requests to the API, which really hurts in this case since the free quota is rather low.

Ideally we would move to using DataUpdateCoordinator, but that is a larger change (which I might or might not come around doing :smile: ). Ideally I'd like to have something working for now we can merge before piling up too much changes. If you are ok I'd go with the adaptive model and then take it from there.

siku2 commented 3 years ago

Ideally I'd like to have something working for now we can merge before piling up too much changes. If you are ok I'd go with the adaptive model and then take it from there.

That's perfectly fine by me.

siku2 commented 3 years ago

Fantastic work, thank you!