implementing freedaily mode (#21314)

adressing #15105 and add a freedaily mode for a 5 day forecast with free API key
This commit is contained in:
tmechen 2019-02-23 15:52:08 +01:00 committed by Fabian Affolter
parent 02745be44d
commit 2f7b4ed7f0

View File

@ -20,7 +20,7 @@ _LOGGER = logging.getLogger(__name__)
ATTRIBUTION = 'Data provided by OpenWeatherMap'
FORECAST_MODE = ['hourly', 'daily']
FORECAST_MODE = ['hourly', 'daily', 'freedaily']
DEFAULT_NAME = 'OpenWeatherMap'
@ -152,7 +152,12 @@ class OpenWeatherMapWeather(WeatherEntity):
return None
return round(rain_value + snow_value, 1)
for entry in self.forecast_data.get_weathers():
if self._mode == 'freedaily':
weather = self.forecast_data.get_weathers()[::8]
else:
weather = self.forecast_data.get_weathers()
for entry in weather:
if self._mode == 'daily':
data.append({
ATTR_FORECAST_TIME: