Fix yeelight brightness in music mode (#45358)
This commit is contained in:
parent
e97448a201
commit
daa9449f18
1 changed files with 8 additions and 5 deletions
|
@ -426,7 +426,6 @@ class YeelightGenericLight(YeelightEntity, LightEntity):
|
||||||
|
|
||||||
self.config = device.config
|
self.config = device.config
|
||||||
|
|
||||||
self._brightness = None
|
|
||||||
self._color_temp = None
|
self._color_temp = None
|
||||||
self._hs = None
|
self._hs = None
|
||||||
self._effect = None
|
self._effect = None
|
||||||
|
@ -487,10 +486,14 @@ class YeelightGenericLight(YeelightEntity, LightEntity):
|
||||||
@property
|
@property
|
||||||
def brightness(self) -> int:
|
def brightness(self) -> int:
|
||||||
"""Return the brightness of this light between 1..255."""
|
"""Return the brightness of this light between 1..255."""
|
||||||
temp = self._get_property(self._brightness_property)
|
# Always use "bright" as property name in music mode
|
||||||
if temp:
|
# Since music mode states are only caches in upstream library
|
||||||
self._brightness = temp
|
# and the cache key is always "bright" for brightness
|
||||||
return round(255 * (int(self._brightness) / 100))
|
brightness_property = (
|
||||||
|
"bright" if self._bulb.music_mode else self._brightness_property
|
||||||
|
)
|
||||||
|
brightness = self._get_property(brightness_property)
|
||||||
|
return round(255 * (int(brightness) / 100))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def min_mireds(self):
|
def min_mireds(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue