mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add attributs and fix lightlevel inconsistency for LightLevel sensor (#24439)
* Add attributs and fix state level * Update sensor.py * Update sensor.py
This commit is contained in:
parent
7559e70027
commit
a6a3555684
@ -40,13 +40,16 @@ class HueLightLevel(GenericHueGaugeSensorEntity):
|
|||||||
# scale used because the human eye adjusts to light levels and small
|
# scale used because the human eye adjusts to light levels and small
|
||||||
# changes at low lux levels are more noticeable than at high lux
|
# changes at low lux levels are more noticeable than at high lux
|
||||||
# levels.
|
# levels.
|
||||||
return 10 ** ((self.sensor.lightlevel - 1) / 10000)
|
return round(float(10 ** ((self.sensor.lightlevel - 1) / 10000)), 2)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def device_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
attributes = super().device_state_attributes
|
attributes = super().device_state_attributes
|
||||||
attributes.update({
|
attributes.update({
|
||||||
|
"lightlevel": self.sensor.lightlevel,
|
||||||
|
"daylight": self.sensor.daylight,
|
||||||
|
"dark": self.sensor.dark,
|
||||||
"threshold_dark": self.sensor.tholddark,
|
"threshold_dark": self.sensor.tholddark,
|
||||||
"threshold_offset": self.sensor.tholdoffset,
|
"threshold_offset": self.sensor.tholdoffset,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user