Drop aemet isoformat() from timestamps (#62793)
* aemet: drop isoformat() from timestamps
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* aemet: fix forecast timestamp sensors
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* aemet: move forecast timestamp sensor to lambda
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* Revert "aemet: move forecast timestamp sensor to lambda"
This reverts commit 1f012c9adc
.
pull/64190/head
parent
02cc75997c
commit
e019d0890f
|
@ -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
|
||||
|
|
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue