diff --git a/custom_components/irm_kmi/__init__.py b/custom_components/irm_kmi/__init__.py index 6266a30..2c04bb3 100644 --- a/custom_components/irm_kmi/__init__.py +++ b/custom_components/irm_kmi/__init__.py @@ -1 +1,7 @@ """Integration for IRM KMI weather""" + +from homeassistant.components.weather import Forecast +class IrmKmiForecast(Forecast): + """Forecast class with additional attributes for IRM KMI""" + text_fr: str | None + text_nl: str | None diff --git a/custom_components/irm_kmi/coordinator.py b/custom_components/irm_kmi/coordinator.py index 798b545..d813d50 100644 --- a/custom_components/irm_kmi/coordinator.py +++ b/custom_components/irm_kmi/coordinator.py @@ -13,6 +13,7 @@ UpdateFailed, ) +from . import IrmKmiForecast from .const import IRM_KMI_TO_HA_CONDITION_MAP as CDT_MAP from .api import IrmKmiApiClient, IrmKmiApiError @@ -33,7 +34,7 @@ def daily_dict_to_forecast(data: List[dict] | None) -> List[Forecast] | None: is_daytime = f.get('dayNight', None) == 'd' - forecast = Forecast( + forecast = IrmKmiForecast( datetime=(datetime.now() + timedelta(days=n_days)).strftime('%Y-%m-%d') if is_daytime else datetime.now().strftime('%Y-%m-%d'), condition=CDT_MAP.get((f.get('ww1'), f.get('dayNight')), None), @@ -45,6 +46,8 @@ def daily_dict_to_forecast(data: List[dict] | None) -> List[Forecast] | None: precipitation_probability=f.get('precipChance', None), wind_bearing=f.get('wind', {}).get('dirText', {}).get('en'), is_daytime=is_daytime, + text_fr=f.get('text', {}).get('fr'), + text_nl=f.get('text', {}).get('nl') ) forecasts.append(forecast) if is_daytime: