Use the action field enums in evil_genius_labs (#195644)

This commit is contained in:
epenet
2026-11-30 20:50:58 +00:00
committed by GitHub
parent 338cf09585
commit af2b8ffce6
@@ -3,8 +3,12 @@
import asyncio
from typing import Any, cast, override
from homeassistant.components import light
from homeassistant.components.light import ColorMode, LightEntity, LightEntityFeature
from homeassistant.components.light import (
ColorMode,
LightEntity,
LightEntityFeature,
LightServiceArgument,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
@@ -89,16 +93,16 @@ class EvilGeniusLight(EvilGeniusEntity, LightEntity):
**kwargs: Any,
) -> None:
"""Turn light on."""
if (brightness := kwargs.get(light.ATTR_BRIGHTNESS)) is not None:
if (brightness := kwargs.get(LightServiceArgument.BRIGHTNESS)) is not None:
async with asyncio.timeout(5):
await self.coordinator.client.set_path_value("brightness", brightness)
# Setting a color will change the effect to "Solid Color" so skip setting effect
if (rgb_color := kwargs.get(light.ATTR_RGB_COLOR)) is not None:
if (rgb_color := kwargs.get(LightServiceArgument.RGB_COLOR)) is not None:
async with asyncio.timeout(5):
await self.coordinator.client.set_rgb_color(*rgb_color)
elif (effect := kwargs.get(light.ATTR_EFFECT)) is not None:
elif (effect := kwargs.get(LightServiceArgument.EFFECT)) is not None:
if effect == HA_NO_EFFECT:
effect = FIB_NO_EFFECT
async with asyncio.timeout(5):