mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 11:33:11 -04:00
Use the action field enums in osram_infrared (#196057)
This commit is contained in:
@@ -11,12 +11,11 @@ from homeassistant.components.infrared import (
|
||||
InfraredReceiverConsumerEntity,
|
||||
)
|
||||
from homeassistant.components.light import (
|
||||
ATTR_EFFECT,
|
||||
ATTR_RGB_COLOR,
|
||||
EFFECT_OFF,
|
||||
ColorMode,
|
||||
LightEntity,
|
||||
LightEntityFeature,
|
||||
LightServiceArgument,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
@@ -167,7 +166,7 @@ class OsramIrLight(OsramIrEmitterEntity, LightEntity):
|
||||
@override
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn on the light and apply optional effect and color."""
|
||||
effect = kwargs.get(ATTR_EFFECT)
|
||||
effect = kwargs.get(LightServiceArgument.EFFECT)
|
||||
|
||||
if effect is not None and effect not in EFFECT_LIST:
|
||||
raise ServiceValidationError(f"Unsupported OSRAM infrared effect: {effect}")
|
||||
@@ -179,7 +178,7 @@ class OsramIrLight(OsramIrEmitterEntity, LightEntity):
|
||||
|
||||
if effect is not None:
|
||||
await self._async_set_effect(effect)
|
||||
elif (rgb_color := kwargs.get(ATTR_RGB_COLOR)) is not None:
|
||||
elif (rgb_color := kwargs.get(LightServiceArgument.RGB_COLOR)) is not None:
|
||||
await self._async_set_rgb_color(rgb_color)
|
||||
|
||||
self._attr_is_on = True
|
||||
|
||||
Reference in New Issue
Block a user