mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 11:33:11 -04:00
Use the action field enums in opple (#196056)
This commit is contained in:
@@ -7,11 +7,10 @@ import probatio
|
||||
from pyoppleio.OppleLightDevice import OppleLightDevice
|
||||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
ATTR_COLOR_TEMP_KELVIN,
|
||||
PLATFORM_SCHEMA as LIGHT_PLATFORM_SCHEMA,
|
||||
ColorMode,
|
||||
LightEntity,
|
||||
LightServiceArgument,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -81,14 +80,19 @@ class OppleLight(LightEntity):
|
||||
if not self.is_on:
|
||||
self._device.power_on = True
|
||||
|
||||
if ATTR_BRIGHTNESS in kwargs and self.brightness != kwargs[ATTR_BRIGHTNESS]:
|
||||
self._device.brightness = kwargs[ATTR_BRIGHTNESS]
|
||||
if (
|
||||
LightServiceArgument.BRIGHTNESS in kwargs
|
||||
and self.brightness != kwargs[LightServiceArgument.BRIGHTNESS]
|
||||
):
|
||||
self._device.brightness = kwargs[LightServiceArgument.BRIGHTNESS]
|
||||
|
||||
if (
|
||||
ATTR_COLOR_TEMP_KELVIN in kwargs
|
||||
and self.color_temp_kelvin != kwargs[ATTR_COLOR_TEMP_KELVIN]
|
||||
LightServiceArgument.COLOR_TEMP_KELVIN in kwargs
|
||||
and self.color_temp_kelvin != kwargs[LightServiceArgument.COLOR_TEMP_KELVIN]
|
||||
):
|
||||
self._device.color_temperature = kwargs[ATTR_COLOR_TEMP_KELVIN]
|
||||
self._device.color_temperature = kwargs[
|
||||
LightServiceArgument.COLOR_TEMP_KELVIN
|
||||
]
|
||||
|
||||
@override
|
||||
def turn_off(self, **kwargs: Any) -> None:
|
||||
|
||||
Reference in New Issue
Block a user