mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
Return ISO formated datetime in forecast (#14975)
* Return ISO formated datetime in forecast * Lint
This commit is contained in:
parent
9efa31ef9f
commit
d0cbbe6141
@ -4,6 +4,7 @@ Support for displaying weather info from Ecobee API.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/weather.ecobee/
|
https://home-assistant.io/components/weather.ecobee/
|
||||||
"""
|
"""
|
||||||
|
from datetime import datetime
|
||||||
from homeassistant.components import ecobee
|
from homeassistant.components import ecobee
|
||||||
from homeassistant.components.weather import (
|
from homeassistant.components.weather import (
|
||||||
WeatherEntity, ATTR_FORECAST_CONDITION, ATTR_FORECAST_TEMP,
|
WeatherEntity, ATTR_FORECAST_CONDITION, ATTR_FORECAST_TEMP,
|
||||||
@ -134,8 +135,10 @@ class EcobeeWeather(WeatherEntity):
|
|||||||
try:
|
try:
|
||||||
forecasts = []
|
forecasts = []
|
||||||
for day in self.weather['forecasts']:
|
for day in self.weather['forecasts']:
|
||||||
|
date_time = datetime.strptime(day['dateTime'],
|
||||||
|
'%Y-%m-%d %H:%M:%S').isoformat()
|
||||||
forecast = {
|
forecast = {
|
||||||
ATTR_FORECAST_TIME: day['dateTime'],
|
ATTR_FORECAST_TIME: date_time,
|
||||||
ATTR_FORECAST_CONDITION: day['condition'],
|
ATTR_FORECAST_CONDITION: day['condition'],
|
||||||
ATTR_FORECAST_TEMP: float(day['tempHigh']) / 10,
|
ATTR_FORECAST_TEMP: float(day['tempHigh']) / 10,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user