Add attributs and fix lightlevel inconsistency for LightLevel sensor (#24439)
* Add attributs and fix state level * Update sensor.py * Update sensor.pypull/24485/head
parent
7559e70027
commit
a6a3555684
|
@ -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,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue