Return ISO formated datetime in forecast (#14975)

* Return ISO formated datetime in forecast

* Lint
pull/14986/head
c727 2018-06-15 23:09:01 +02:00 committed by Paulus Schoutsen
parent 9efa31ef9f
commit d0cbbe6141
1 changed files with 4 additions and 1 deletions

View File

@ -4,6 +4,7 @@ Support for displaying weather info from Ecobee API.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/weather.ecobee/
"""
from datetime import datetime
from homeassistant.components import ecobee
from homeassistant.components.weather import (
WeatherEntity, ATTR_FORECAST_CONDITION, ATTR_FORECAST_TEMP,
@ -134,8 +135,10 @@ class EcobeeWeather(WeatherEntity):
try:
forecasts = []
for day in self.weather['forecasts']:
date_time = datetime.strptime(day['dateTime'],
'%Y-%m-%d %H:%M:%S').isoformat()
forecast = {
ATTR_FORECAST_TIME: day['dateTime'],
ATTR_FORECAST_TIME: date_time,
ATTR_FORECAST_CONDITION: day['condition'],
ATTR_FORECAST_TEMP: float(day['tempHigh']) / 10,
}