Fix unnecessary db entries for metro_france (#25957)
* fix #25911 avoid db unecessary entries * use UTC timestamp for forecast * simplify forecast timestamppull/26022/head
parent
c55241960c
commit
ca74a23cf1
|
@ -121,7 +121,7 @@ def setup(hass, config):
|
|||
weather_alert_client.update_data()
|
||||
except VigilanceMeteoError as exp:
|
||||
_LOGGER.error(
|
||||
"Unexpected error when creating the" "vigilance_meteoFrance proxy: %s ",
|
||||
"Unexpected error when creating the vigilance_meteoFrance proxy: %s ",
|
||||
exp,
|
||||
)
|
||||
else:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Support for Meteo-France weather service."""
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from homeassistant.components.weather import (
|
||||
|
@ -9,6 +9,7 @@ from homeassistant.components.weather import (
|
|||
ATTR_FORECAST_TIME,
|
||||
WeatherEntity,
|
||||
)
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
|
||||
from . import ATTRIBUTION, CONDITION_CLASSES, CONF_CITY, DATA_METEO_FRANCE
|
||||
|
@ -83,8 +84,9 @@ class MeteoFranceWeather(WeatherEntity):
|
|||
@property
|
||||
def forecast(self):
|
||||
"""Return the forecast."""
|
||||
reftime = datetime.now().replace(hour=12, minute=00)
|
||||
reftime = dt_util.utcnow().replace(hour=12, minute=0, second=0, microsecond=0)
|
||||
reftime += timedelta(hours=24)
|
||||
_LOGGER.debug("reftime used for %s forecast: %s", self._data["name"], reftime)
|
||||
forecast_data = []
|
||||
for key in self._data["forecast"]:
|
||||
value = self._data["forecast"][key]
|
||||
|
|
Loading…
Reference in New Issue