Fix palette handling for LIFX Ceiling SKY effect (#146582)

Signed-off-by: Avi Miller <me@dje.li>
This commit is contained in:
Avi Miller 2025-06-12 22:32:04 +10:00 committed by Franck Nijhof
parent 54d8d71de5
commit c3e3a36b4c
No known key found for this signature in database
GPG Key ID: AB33ADACE7101952
2 changed files with 8 additions and 5 deletions

View File

@ -5,7 +5,7 @@ from __future__ import annotations
import asyncio
from collections.abc import Callable
from datetime import timedelta
from typing import Any
from typing import TYPE_CHECKING, Any
import aiolifx_effects
from aiolifx_themes.painter import ThemePainter
@ -31,9 +31,12 @@ from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.service import async_extract_referenced_entity_ids
from .const import _ATTR_COLOR_TEMP, ATTR_THEME, DATA_LIFX_MANAGER, DOMAIN
from .coordinator import LIFXUpdateCoordinator, Light
from .coordinator import LIFXUpdateCoordinator
from .util import convert_8_to_16, find_hsbk
if TYPE_CHECKING:
from aiolifx.aiolifx import Light
SCAN_INTERVAL = timedelta(seconds=10)
SERVICE_EFFECT_COLORLOOP = "effect_colorloop"
@ -426,8 +429,8 @@ class LIFXManager:
) -> None:
"""Start the firmware-based Sky effect."""
palette = kwargs.get(ATTR_PALETTE)
theme = Theme()
if palette is not None:
theme = Theme()
for hsbk in palette:
theme.add_hsbk(hsbk[0], hsbk[1], hsbk[2], hsbk[3])

View File

@ -843,7 +843,7 @@ async def test_sky_effect(hass: HomeAssistant) -> None:
SERVICE_EFFECT_SKY,
{
ATTR_ENTITY_ID: entity_id,
ATTR_PALETTE: [],
ATTR_PALETTE: None,
ATTR_SKY_TYPE: "Clouds",
ATTR_CLOUD_SATURATION_MAX: 180,
ATTR_CLOUD_SATURATION_MIN: 50,
@ -854,7 +854,7 @@ async def test_sky_effect(hass: HomeAssistant) -> None:
bulb.power_level = 65535
bulb.effect = {
"effect": "SKY",
"palette": [],
"palette": None,
"sky_type": 2,
"cloud_saturation_min": 50,
"cloud_saturation_max": 180,