mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 19:57:03 -04:00
Use the action field enums in evil_genius_labs (#195644)
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user