55from datetime import datetime
66from typing import Any , cast
77
8- from datapoint .Forecast import Forecast as ForecastData
8+ from datapoint .Forecast import Forecast
99
1010from homeassistant .components .weather import (
1111 ATTR_FORECAST_CONDITION ,
2222 ATTR_FORECAST_WIND_BEARING ,
2323 DOMAIN as WEATHER_DOMAIN ,
2424 CoordinatorWeatherEntity ,
25- Forecast ,
25+ Forecast as WeatherForecast ,
2626 WeatherEntityFeature ,
2727)
2828from homeassistant .config_entries import ConfigEntry
@@ -85,20 +85,20 @@ async def async_setup_entry(
8585 )
8686
8787
88- def _build_hourly_forecast_data (timestep : dict [str , Any ]) -> Forecast :
89- data = Forecast (datetime = timestep ["time" ].isoformat ())
88+ def _build_hourly_forecast_data (timestep : dict [str , Any ]) -> WeatherForecast :
89+ data = WeatherForecast (datetime = timestep ["time" ].isoformat ())
9090 _populate_forecast_data (data , timestep , HOURLY_FORECAST_ATTRIBUTE_MAP )
9191 return data
9292
9393
94- def _build_daily_forecast_data (timestep : dict [str , Any ]) -> Forecast :
95- data = Forecast (datetime = timestep ["time" ].isoformat ())
94+ def _build_daily_forecast_data (timestep : dict [str , Any ]) -> WeatherForecast :
95+ data = WeatherForecast (datetime = timestep ["time" ].isoformat ())
9696 _populate_forecast_data (data , timestep , DAILY_FORECAST_ATTRIBUTE_MAP )
9797 return data
9898
9999
100- def _build_twice_daily_forecast_data (timestep : dict [str , Any ]) -> Forecast :
101- data = Forecast (datetime = timestep ["time" ].isoformat ())
100+ def _build_twice_daily_forecast_data (timestep : dict [str , Any ]) -> WeatherForecast :
101+ data = WeatherForecast (datetime = timestep ["time" ].isoformat ())
102102
103103 # day and night forecasts have slightly different format
104104 if "daySignificantWeatherCode" in timestep :
@@ -111,7 +111,7 @@ def _build_twice_daily_forecast_data(timestep: dict[str, Any]) -> Forecast:
111111
112112
113113def _populate_forecast_data (
114- forecast : Forecast , timestep : dict [str , Any ], mapping : dict [str , str ]
114+ forecast : WeatherForecast , timestep : dict [str , Any ], mapping : dict [str , str ]
115115) -> None :
116116 def get_mapped_attribute (attr : str ) -> Any :
117117 if attr not in mapping :
@@ -153,9 +153,9 @@ def get_mapped_attribute(attr: str) -> Any:
153153
154154class MetOfficeWeather (
155155 CoordinatorWeatherEntity [
156- TimestampDataUpdateCoordinator [ForecastData ],
157- TimestampDataUpdateCoordinator [ForecastData ],
158- TimestampDataUpdateCoordinator [ForecastData ],
156+ TimestampDataUpdateCoordinator [Forecast ],
157+ TimestampDataUpdateCoordinator [Forecast ],
158+ TimestampDataUpdateCoordinator [Forecast ],
159159 ]
160160):
161161 """Implementation of a Met Office weather condition."""
@@ -177,9 +177,9 @@ class MetOfficeWeather(
177177
178178 def __init__ (
179179 self ,
180- coordinator_daily : TimestampDataUpdateCoordinator [ForecastData ],
181- coordinator_hourly : TimestampDataUpdateCoordinator [ForecastData ],
182- coordinator_twice_daily : TimestampDataUpdateCoordinator [ForecastData ],
180+ coordinator_daily : TimestampDataUpdateCoordinator [Forecast ],
181+ coordinator_hourly : TimestampDataUpdateCoordinator [Forecast ],
182+ coordinator_twice_daily : TimestampDataUpdateCoordinator [Forecast ],
183183 hass_data : dict [str , Any ],
184184 ) -> None :
185185 """Initialise the platform with a data instance."""
@@ -263,10 +263,10 @@ def wind_bearing(self) -> float | None:
263263 return float (value ) if value is not None else None
264264
265265 @callback
266- def _async_forecast_daily (self ) -> list [Forecast ] | None :
266+ def _async_forecast_daily (self ) -> list [WeatherForecast ] | None :
267267 """Return the daily forecast in native units."""
268268 coordinator = cast (
269- TimestampDataUpdateCoordinator [ForecastData ],
269+ TimestampDataUpdateCoordinator [Forecast ],
270270 self .forecast_coordinators ["daily" ],
271271 )
272272 timesteps = coordinator .data .timesteps
@@ -277,10 +277,10 @@ def _async_forecast_daily(self) -> list[Forecast] | None:
277277 ]
278278
279279 @callback
280- def _async_forecast_hourly (self ) -> list [Forecast ] | None :
280+ def _async_forecast_hourly (self ) -> list [WeatherForecast ] | None :
281281 """Return the hourly forecast in native units."""
282282 coordinator = cast (
283- TimestampDataUpdateCoordinator [ForecastData ],
283+ TimestampDataUpdateCoordinator [Forecast ],
284284 self .forecast_coordinators ["hourly" ],
285285 )
286286
@@ -292,10 +292,10 @@ def _async_forecast_hourly(self) -> list[Forecast] | None:
292292 ]
293293
294294 @callback
295- def _async_forecast_twice_daily (self ) -> list [Forecast ] | None :
295+ def _async_forecast_twice_daily (self ) -> list [WeatherForecast ] | None :
296296 """Return the twice daily forecast in native units."""
297297 coordinator = cast (
298- TimestampDataUpdateCoordinator [ForecastData ],
298+ TimestampDataUpdateCoordinator [Forecast ],
299299 self .forecast_coordinators ["twice_daily" ],
300300 )
301301 timesteps = coordinator .data .timesteps
0 commit comments