From 5cc9f61ff87547f11fe13adb9df94a227d87f1e0 Mon Sep 17 00:00:00 2001 From: Sander Date: Sun, 3 Sep 2023 12:07:25 +0000 Subject: [PATCH 1/2] Remove deprecated `forecast` and implement `async_forecast_daily` --- custom_components/knmi/weather.py | 9 ++------- hacs.json | 6 +++--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/custom_components/knmi/weather.py b/custom_components/knmi/weather.py index 44c3e56..e7a0683 100644 --- a/custom_components/knmi/weather.py +++ b/custom_components/knmi/weather.py @@ -171,9 +171,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( @@ -207,7 +206,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 diff --git a/hacs.json b/hacs.json index 295430e..04257c7 100644 --- a/hacs.json +++ b/hacs.json @@ -1,5 +1,5 @@ { - "name": "KNMI", - "homeassistant": "2023.8.0", - "render_readme": true + "name": "KNMI", + "homeassistant": "2023.9.0", + "render_readme": true } From 4c8e406706304f5404c0835f1f171d5076936a7e Mon Sep 17 00:00:00 2001 From: Sander Date: Sun, 3 Sep 2023 18:08:41 +0000 Subject: [PATCH 2/2] Define supported features --- custom_components/knmi/weather.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/custom_components/knmi/weather.py b/custom_components/knmi/weather.py index e7a0683..40a0604 100644 --- a/custom_components/knmi/weather.py +++ b/custom_components/knmi/weather.py @@ -23,6 +23,7 @@ DOMAIN as SENSOR_DOMAIN, Forecast, WeatherEntity, + WeatherEntityFeature, ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( @@ -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,