From c53fc94e845884d13f22a50e985b3dbd4535bc43 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Mon, 8 Jan 2018 03:54:27 +0000 Subject: [PATCH] Address missed review comments for Dark Sky weather (#11520) See #11435 --- homeassistant/components/weather/darksky.py | 9 ++++----- tests/components/weather/test_darksky.py | 3 +++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/weather/darksky.py b/homeassistant/components/weather/darksky.py index 4c7512969f6..0566cc03662 100644 --- a/homeassistant/components/weather/darksky.py +++ b/homeassistant/components/weather/darksky.py @@ -2,7 +2,7 @@ Patform for retrieving meteorological data from Dark Sky. 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 import logging @@ -133,13 +133,12 @@ class DarkSkyWeather(WeatherEntity): return self._ds_daily.summary @property - def state_attributes(self): + def device_state_attributes(self): """Return the state attributes.""" - attrs = super().state_attributes - attrs.update({ + attrs = { ATTR_DAILY_FORECAST_SUMMARY: self.daily_forecast_summary, ATTR_HOURLY_FORECAST_SUMMARY: self.hourly_forecast_summary - }) + } return attrs def update(self): diff --git a/tests/components/weather/test_darksky.py b/tests/components/weather/test_darksky.py index 7faa033e0a8..787aca2ca17 100644 --- a/tests/components/weather/test_darksky.py +++ b/tests/components/weather/test_darksky.py @@ -49,3 +49,6 @@ class TestDarkSky(unittest.TestCase): state = self.hass.states.get('weather.test') 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.')