Add sunrise and sunset to Darksky weather sensor (#19492)

* Add sunrise and sunset to Darksky weather sensor

* Fix lint issue
This commit is contained in:
Fabian Affolter 2018-12-22 14:52:36 +01:00 committed by Charles Garwood
parent f0e187e306
commit 6880be5aeb

View File

@ -23,11 +23,12 @@ REQUIREMENTS = ['python-forecastio==1.4.0']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
CONF_ATTRIBUTION = "Powered by Dark Sky" ATTRIBUTION = "Powered by Dark Sky"
CONF_UNITS = 'units'
CONF_UPDATE_INTERVAL = 'update_interval'
CONF_FORECAST = 'forecast' CONF_FORECAST = 'forecast'
CONF_LANGUAGE = 'language' CONF_LANGUAGE = 'language'
CONF_UNITS = 'units'
CONF_UPDATE_INTERVAL = 'update_interval'
DEFAULT_LANGUAGE = 'en' DEFAULT_LANGUAGE = 'en'
@ -130,6 +131,10 @@ SENSOR_TYPES = {
['currently', 'hourly', 'daily']], ['currently', 'hourly', 'daily']],
'moon_phase': ['Moon Phase', None, None, None, None, None, 'moon_phase': ['Moon Phase', None, None, None, None, None,
'mdi:weather-night', ['daily']], 'mdi:weather-night', ['daily']],
'sunrise_time': ['Sunrise', None, None, None, None, None,
'mdi:white-balance-sunny', ['daily']],
'sunset_time': ['Sunset', None, None, None, None, None,
'mdi:weather-night', ['daily']],
} }
CONDITION_PICTURES = { CONDITION_PICTURES = {
@ -296,7 +301,7 @@ class DarkSkySensor(Entity):
def device_state_attributes(self): def device_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return { return {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION, ATTR_ATTRIBUTION: ATTRIBUTION,
} }
def update(self): def update(self):