jdejaegh / irm-kmi-ha

Home Assistant weather provider using data from Belgian IRM KMI 🇧🇪 🇱🇺 🇳🇱
MIT License
40 stars 0 forks source link

Improve hourly labelling at night #16

Closed JanDetrez closed 5 months ago

JanDetrez commented 5 months ago

Hi

Great integration to have as a Belgian!

Would it be possible to improve the labelling during the night, so weather Lovelace integrations would show a moon instead of a sun in case it is 'partly cloudy' during the night?

I'm not sure if this is accessible through the KMI data you pull, although the KMI website does properly show a moon during 'partly cloudy' at night. If not available, perhaps sunrise and sundown hours are available so one could write a workaround to have a 'partly cloudy night' condition.

I also asked if perhaps the Lovelace integration I use can add this particular label, or if it can make an override during the night.https://github.com/decompil3d/lovelace-hourly-weather/issues/662

As you see below, it is a bit odd that during the night we see this 'partly cloudy' condition with a sun.

Thanks for considering this improvement.

For example Screenshot_20240331-064528 Screenshot_20240331-064129 Screenshot_20240331-064120

jdejaegh commented 5 months ago

Thanks for your feedback on the integration!

I also noticed that the 'partly cloudy' condition shows the sun with clouds in most weather cards, even at night.

For the integration, I am following the Recommended values for state and condition from the developer documentation. As you may notice, most conditions are not tied to daytime or nighttime.

I am not really keen on adding new custom conditions, as they will not be supported by most Lovelace cards. Having a partly cloudy icon with the sun (even at night) is IMHO better than a broken icon because of a custom weather condition value.

Regarding the KMI data I pull, yes it includes if the forecast is for day or night. This is even returned by the standard is_daytime attribute in the service call. This can be used by Lovelace cards to adapt the icon they use.

Example of service call response ```yaml weather.bxl: forecast: - datetime: "2024-03-31T20:00:00" condition: cloudy precipitation_probability: 0 wind_bearing: SSE is_daytime: true temperature: 14 pressure: 992 wind_speed: 10 precipitation: 0 - datetime: "2024-03-31T21:00:00" condition: pouring precipitation_probability: 50 wind_bearing: S is_daytime: false temperature: 13 pressure: 993 wind_speed: 10 precipitation: 0.1 ```

The best is to have the card implementing their own logic as they have all the data they need (condition and daytime). Some other weather card have that kind of logic. For example

For compatibility reasons, I won't add a custom weather condition value. Rather, Lovelace cards should have some logic to handle the issue raised here. I hope you understand why and how it is done in other cards