From 8180797d2f1ae21b55c703ac825dfb991629f946 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 27 Apr 2019 13:27:17 -0700 Subject: [PATCH] Fix Hue sensors returning None value (#23478) --- homeassistant/components/hue/sensor.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/homeassistant/components/hue/sensor.py b/homeassistant/components/hue/sensor.py index 30a439f92e9..7664bd38d97 100644 --- a/homeassistant/components/hue/sensor.py +++ b/homeassistant/components/hue/sensor.py @@ -32,6 +32,9 @@ class HueLightLevel(GenericHueGaugeSensorEntity): @property def state(self): """Return the state of the device.""" + if self.sensor.lightlevel is None: + return None + # https://developers.meethue.com/develop/hue-api/supported-devices/#clip_zll_lightlevel # Light level in 10000 log10 (lux) +1 measured by sensor. Logarithm # scale used because the human eye adjusts to light levels and small @@ -59,4 +62,7 @@ class HueTemperature(GenericHueGaugeSensorEntity): @property def state(self): """Return the state of the device.""" + if self.sensor.temperature is None: + return None + return self.sensor.temperature / 100