Skip to content

Commit

Permalink
Merge pull request #91 from golles/87-the-knmi-integration-is-using-d…
Browse files Browse the repository at this point in the history
…eprecated-forecast-20239-beta

Remove deprecated `forecast` and implement `async_forecast_daily`
  • Loading branch information
golles authored Sep 7, 2023
2 parents 9c736c4 + f72bbd5 commit ad8d729
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
11 changes: 4 additions & 7 deletions custom_components/knmi/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
DOMAIN as SENSOR_DOMAIN,
Forecast,
WeatherEntity,
WeatherEntityFeature,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
Expand Down Expand Up @@ -88,6 +89,7 @@ class KnmiWeather(WeatherEntity):
_attr_native_temperature_unit = TEMP_CELSIUS
_attr_native_visibility_unit = LENGTH_KILOMETERS
_attr_native_wind_speed_unit = SPEED_KILOMETERS_PER_HOUR
_attr_supported_features = WeatherEntityFeature.FORECAST_DAILY

def __init__(
self,
Expand Down Expand Up @@ -171,9 +173,8 @@ def native_visibility(self) -> float | None:
"""Return the visibility in native units."""
return self.coordinator.get_value("zicht", float)

@property
def forecast(self) -> list[Forecast] | None:
"""Return the forecast in native units."""
async def async_forecast_daily(self) -> list[Forecast] | None:
"""Return the daily forecast in native units."""
forecast = []
timezone = pytz.timezone(API_TIMEZONE)
today = dt.as_utc(
Expand Down Expand Up @@ -207,7 +208,3 @@ def forecast(self) -> list[Forecast] | None:
forecast.append(next_day)

return forecast

async def async_forecast_daily(self) -> list[Forecast] | None:
"""Return the daily forecast in native units."""
return self.forecast
6 changes: 3 additions & 3 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "KNMI",
"homeassistant": "2023.8.0",
"render_readme": true
"name": "KNMI",
"homeassistant": "2023.9.0",
"render_readme": true
}

0 comments on commit ad8d729

Please sign in to comment.