mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 17:57:55 +00:00
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:
parent
02745be44d
commit
2f7b4ed7f0
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user