Skip to content

Commit

Permalink
Fix Hue sensors returning None value (#23478)
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob committed Apr 27, 2019
1 parent f1b2622 commit 26bf1b2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions homeassistant/components/hue/sensor.py
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 26bf1b2

Please sign in to comment.