mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Fix round typing [shelly] (#82436)
This commit is contained in:
parent
574f6f3fd1
commit
e897c8c47c
@ -184,16 +184,17 @@ class BlockShellyLight(ShellyBlockEntity, LightEntity):
|
|||||||
@property
|
@property
|
||||||
def brightness(self) -> int:
|
def brightness(self) -> int:
|
||||||
"""Return the brightness of this light between 0..255."""
|
"""Return the brightness of this light between 0..255."""
|
||||||
|
brightness_pct: int
|
||||||
if self.mode == "color":
|
if self.mode == "color":
|
||||||
if self.control_result:
|
if self.control_result:
|
||||||
brightness_pct = self.control_result["gain"]
|
brightness_pct = self.control_result["gain"]
|
||||||
else:
|
else:
|
||||||
brightness_pct = self.block.gain
|
brightness_pct = cast(int, self.block.gain)
|
||||||
else:
|
else:
|
||||||
if self.control_result:
|
if self.control_result:
|
||||||
brightness_pct = self.control_result["brightness"]
|
brightness_pct = self.control_result["brightness"]
|
||||||
else:
|
else:
|
||||||
brightness_pct = self.block.brightness
|
brightness_pct = cast(int, self.block.brightness)
|
||||||
|
|
||||||
return round(255 * brightness_pct / 100)
|
return round(255 * brightness_pct / 100)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user