mirror of
https://github.com/home-assistant/core.git
synced 2025-05-05 06:29:16 +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'
|
ATTRIBUTION = 'Data provided by OpenWeatherMap'
|
||||||
|
|
||||||
FORECAST_MODE = ['hourly', 'daily']
|
FORECAST_MODE = ['hourly', 'daily', 'freedaily']
|
||||||
|
|
||||||
DEFAULT_NAME = 'OpenWeatherMap'
|
DEFAULT_NAME = 'OpenWeatherMap'
|
||||||
|
|
||||||
@ -152,7 +152,12 @@ class OpenWeatherMapWeather(WeatherEntity):
|
|||||||
return None
|
return None
|
||||||
return round(rain_value + snow_value, 1)
|
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':
|
if self._mode == 'daily':
|
||||||
data.append({
|
data.append({
|
||||||
ATTR_FORECAST_TIME:
|
ATTR_FORECAST_TIME:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user