mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Improve type hints in kulersky light (#77652)
This commit is contained in:
parent
016a59ac94
commit
6044e2b054
@ -139,7 +139,7 @@ class KulerskyLight(LightEntity):
|
|||||||
"""Instruct the light to turn off."""
|
"""Instruct the light to turn off."""
|
||||||
await self._light.set_color(0, 0, 0, 0)
|
await self._light.set_color(0, 0, 0, 0)
|
||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self) -> None:
|
||||||
"""Fetch new state data for this light."""
|
"""Fetch new state data for this light."""
|
||||||
try:
|
try:
|
||||||
if not self._available:
|
if not self._available:
|
||||||
@ -156,8 +156,8 @@ class KulerskyLight(LightEntity):
|
|||||||
self._available = True
|
self._available = True
|
||||||
brightness = max(rgbw)
|
brightness = max(rgbw)
|
||||||
if not brightness:
|
if not brightness:
|
||||||
rgbw_normalized = [0, 0, 0, 0]
|
self._attr_rgbw_color = (0, 0, 0, 0)
|
||||||
else:
|
else:
|
||||||
rgbw_normalized = [round(x * 255 / brightness) for x in rgbw]
|
rgbw_normalized = tuple(round(x * 255 / brightness) for x in rgbw)
|
||||||
|
self._attr_rgbw_color = rgbw_normalized # type:ignore[assignment]
|
||||||
self._attr_brightness = brightness
|
self._attr_brightness = brightness
|
||||||
self._attr_rgbw_color = tuple(rgbw_normalized)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user