Address missed review comments for Dark Sky weather (#11520)

See #11435
This commit is contained in:
Dan Nixon 2018-01-08 03:54:27 +00:00 committed by Paulus Schoutsen
parent bccd880395
commit c53fc94e84
2 changed files with 7 additions and 5 deletions

View File

@ -2,7 +2,7 @@
Patform for retrieving meteorological data from Dark Sky. Patform for retrieving meteorological data from Dark Sky.
For more details about this platform, please refer to the documentation For more details about this platform, please refer to the documentation
https://home-assistant.io/components/ https://home-assistant.io/components/weather.darksky/
""" """
from datetime import datetime, timedelta from datetime import datetime, timedelta
import logging import logging
@ -133,13 +133,12 @@ class DarkSkyWeather(WeatherEntity):
return self._ds_daily.summary return self._ds_daily.summary
@property @property
def state_attributes(self): def device_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
attrs = super().state_attributes attrs = {
attrs.update({
ATTR_DAILY_FORECAST_SUMMARY: self.daily_forecast_summary, ATTR_DAILY_FORECAST_SUMMARY: self.daily_forecast_summary,
ATTR_HOURLY_FORECAST_SUMMARY: self.hourly_forecast_summary ATTR_HOURLY_FORECAST_SUMMARY: self.hourly_forecast_summary
}) }
return attrs return attrs
def update(self): def update(self):

View File

@ -49,3 +49,6 @@ class TestDarkSky(unittest.TestCase):
state = self.hass.states.get('weather.test') state = self.hass.states.get('weather.test')
self.assertEqual(state.state, 'Clear') self.assertEqual(state.state, 'Clear')
self.assertEqual(state.attributes['daily_forecast_summary'],
'No precipitation throughout the week, with '
'temperatures falling to 66°F on Thursday.')