diff --git a/homeassistant/components/aemet/sensor.py b/homeassistant/components/aemet/sensor.py index 370d12a34c2..f22c6d321b1 100644 --- a/homeassistant/components/aemet/sensor.py +++ b/homeassistant/components/aemet/sensor.py @@ -7,8 +7,10 @@ from homeassistant.const import ATTR_ATTRIBUTION from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.update_coordinator import CoordinatorEntity +from homeassistant.util import dt as dt_util from .const import ( + ATTR_FORECAST_TIME, ATTRIBUTION, DOMAIN, ENTRY_NAME, @@ -137,4 +139,6 @@ class AemetForecastSensor(AbstractAemetSensor): ) if forecasts: forecast = forecasts[0].get(self.entity_description.key) + if self.entity_description.key == ATTR_FORECAST_TIME: + forecast = dt_util.parse_datetime(forecast) return forecast diff --git a/homeassistant/components/aemet/weather_update_coordinator.py b/homeassistant/components/aemet/weather_update_coordinator.py index d791158b9de..c86465ea8f1 100644 --- a/homeassistant/components/aemet/weather_update_coordinator.py +++ b/homeassistant/components/aemet/weather_update_coordinator.py @@ -286,7 +286,7 @@ class WeatherUpdateCoordinator(DataUpdateCoordinator): temperature_feeling = None town_id = None town_name = None - town_timestamp = dt_util.as_utc(elaborated).isoformat() + town_timestamp = dt_util.as_utc(elaborated) wind_bearing = None wind_max_speed = None wind_speed = None @@ -312,7 +312,7 @@ class WeatherUpdateCoordinator(DataUpdateCoordinator): # Overwrite weather values with closest station data (if present) if station_data: - station_timestamp = dt_util.as_utc(station_dt).isoformat() + station_timestamp = dt_util.as_utc(station_dt) if (now_utc - station_dt) <= STATION_MAX_DELTA: if AEMET_ATTR_STATION_HUMIDITY in station_data: humidity = format_float(station_data[AEMET_ATTR_STATION_HUMIDITY])