From eae306c3f1c254f444ff66b9ced80ea2aaf1f4bf Mon Sep 17 00:00:00 2001 From: Tyler Page Date: Tue, 21 May 2019 12:26:11 +0000 Subject: [PATCH] Fix iterating over NoneType exception (#23648) * Fix iterating over NoneType exception When self._dark_sky is None, don't try to return self._dark_sky.units * Fix wrong check --- homeassistant/components/darksky/weather.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/homeassistant/components/darksky/weather.py b/homeassistant/components/darksky/weather.py index dd945e7b01c..84de690504e 100644 --- a/homeassistant/components/darksky/weather.py +++ b/homeassistant/components/darksky/weather.py @@ -103,6 +103,8 @@ class DarkSkyWeather(WeatherEntity): @property def temperature_unit(self): """Return the unit of measurement.""" + if self._dark_sky.units is None: + return None return TEMP_FAHRENHEIT if 'us' in self._dark_sky.units \ else TEMP_CELSIUS