FL550 / dwd_weather

Deutscher Wetterdienst integration for Home-Assistant
MIT License
157 stars 11 forks source link

Wrong nightly icon for clear sky #91

Closed ghost closed 6 months ago

ghost commented 9 months ago

Is your feature request related to a problem? Please describe. A clear sky condition at night is shown as "sunny" (at least in the hourly forcast). dwd

Describe the solution you'd like Showing the icon "clear-night" during night hours, like this weather integration: alternative

FL550 commented 9 months ago

Is implemented in 2.0.9

ghost commented 9 months ago

It is still showing sunny at night with 2.0.9. weather

ghost commented 9 months ago

Was able to see a bit more. Later than midnight the clear-night symbol is shown. But everything up to midnight still shows sunny. The time period for clear-night might need some further adjustments.

microraptor commented 8 months ago

The right way to time it would be via the sunset/sunrise times for the selected station. If DWD doesn't provide that, perhaps it is best to pull it from a different API. Otherwise you could also use a monthly table for Germany in general to approximate the times.

ghost commented 8 months ago

Or at least a more plausible fixed time period. For example 8pm to 7am or something like that.

FL550 commented 8 months ago

Thanks for the suggested solutions. As the weather data is provided for stations all over the world (I guess it's mainly used in Germany, but there are some stations used outside Germany), I have to find a solution which fits all.

sevorl commented 8 months ago

The "sun.sun" entity is available in home assistant out of the box. If "below horizon", show clear-night. If sun.sun is above horizon (or unavailable/unknown) show sunny.

sevorl commented 8 months ago

Workaround idea: Using Trigger based handling of service response data it should be relatively easy to create a custom weather entity based on the dwd weather and use a template to change sunny to clear-night with sun below horizon.

Like this: (to do: add forecast_daily_template. This is challenging since the forcast is no longer an attribute to get the data from.

weather

FL550 commented 8 months ago

The "sun.sun" entity is available in home assistant out of the box. If "below horizon", show clear-night. If sun.sun is above horizon (or unavailable/unknown) show sunny.

But this will only work, if you select a station which is near your home.

FL550 commented 8 months ago

I'll found a library which does this. I'll include this in the next release.

variada commented 8 months ago

with 2.0.11 I get 'sunny' instead of 'clear-night' for 4 o'clock in the morning when it's definitely still pitch-black dark over here (earlier it's cloudy here, so can't really say for evening behaviour). see screenshot.

image

ghost commented 8 months ago

Same here. At 3am it is sunny.

ghost commented 8 months ago

dwd

FL550 commented 8 months ago

Found the error. The arguments of lat and lon for the library were in an unexpected order, which led to false sunrise/sunset times. Should be fixed in 2.0.12

sevorl commented 5 months ago

Just wanted to say thanks again for this fix. Every time I see the clear-night icon now, I enjoy this!