Skip to content

Commit 8807c53

Browse files
authored
Fix palette handling for LIFX Ceiling SKY effect (home-assistant#146582)
Signed-off-by: Avi Miller <[email protected]>
1 parent 28bd90a commit 8807c53

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

homeassistant/components/lifx/manager.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import asyncio
66
from collections.abc import Callable
77
from datetime import timedelta
8-
from typing import Any
8+
from typing import TYPE_CHECKING, Any
99

1010
import aiolifx_effects
1111
from aiolifx_themes.painter import ThemePainter
@@ -31,9 +31,12 @@
3131
from homeassistant.helpers.service import async_extract_referenced_entity_ids
3232

3333
from .const import _ATTR_COLOR_TEMP, ATTR_THEME, DATA_LIFX_MANAGER, DOMAIN
34-
from .coordinator import LIFXUpdateCoordinator, Light
34+
from .coordinator import LIFXUpdateCoordinator
3535
from .util import convert_8_to_16, find_hsbk
3636

37+
if TYPE_CHECKING:
38+
from aiolifx.aiolifx import Light
39+
3740
SCAN_INTERVAL = timedelta(seconds=10)
3841

3942
SERVICE_EFFECT_COLORLOOP = "effect_colorloop"
@@ -426,8 +429,8 @@ async def _start_effect_sky(
426429
) -> None:
427430
"""Start the firmware-based Sky effect."""
428431
palette = kwargs.get(ATTR_PALETTE)
432+
theme = Theme()
429433
if palette is not None:
430-
theme = Theme()
431434
for hsbk in palette:
432435
theme.add_hsbk(hsbk[0], hsbk[1], hsbk[2], hsbk[3])
433436

tests/components/lifx/test_light.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ async def test_sky_effect(hass: HomeAssistant) -> None:
843843
SERVICE_EFFECT_SKY,
844844
{
845845
ATTR_ENTITY_ID: entity_id,
846-
ATTR_PALETTE: [],
846+
ATTR_PALETTE: None,
847847
ATTR_SKY_TYPE: "Clouds",
848848
ATTR_CLOUD_SATURATION_MAX: 180,
849849
ATTR_CLOUD_SATURATION_MIN: 50,
@@ -854,7 +854,7 @@ async def test_sky_effect(hass: HomeAssistant) -> None:
854854
bulb.power_level = 65535
855855
bulb.effect = {
856856
"effect": "SKY",
857-
"palette": [],
857+
"palette": None,
858858
"sky_type": 2,
859859
"cloud_saturation_min": 50,
860860
"cloud_saturation_max": 180,

0 commit comments

Comments
 (0)