From a6a35556848ab6d36e0086b67d8eba4b4407ab33 Mon Sep 17 00:00:00 2001 From: Save me Date: Tue, 11 Jun 2019 19:41:20 +0200 Subject: [PATCH] Add attributs and fix lightlevel inconsistency for LightLevel sensor (#24439) * Add attributs and fix state level * Update sensor.py * Update sensor.py --- homeassistant/components/hue/sensor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/hue/sensor.py b/homeassistant/components/hue/sensor.py index 7664bd38d97..cdc86d2d280 100644 --- a/homeassistant/components/hue/sensor.py +++ b/homeassistant/components/hue/sensor.py @@ -40,13 +40,16 @@ class HueLightLevel(GenericHueGaugeSensorEntity): # scale used because the human eye adjusts to light levels and small # changes at low lux levels are more noticeable than at high lux # levels. - return 10 ** ((self.sensor.lightlevel - 1) / 10000) + return round(float(10 ** ((self.sensor.lightlevel - 1) / 10000)), 2) @property def device_state_attributes(self): """Return the device state attributes.""" attributes = super().device_state_attributes attributes.update({ + "lightlevel": self.sensor.lightlevel, + "daylight": self.sensor.daylight, + "dark": self.sensor.dark, "threshold_dark": self.sensor.tholddark, "threshold_offset": self.sensor.tholdoffset, })