mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 11:33:11 -04:00
Use the action field enums in mystrom (#196023)
This commit is contained in:
@@ -6,12 +6,10 @@ from typing import Any, override
|
||||
from pymystrom.exceptions import MyStromConnectionError
|
||||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
ATTR_EFFECT,
|
||||
ATTR_HS_COLOR,
|
||||
ColorMode,
|
||||
LightEntity,
|
||||
LightEntityFeature,
|
||||
LightServiceArgument,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
@@ -67,12 +65,12 @@ class MyStromLight(LightEntity):
|
||||
@override
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn on the light."""
|
||||
brightness = kwargs.get(ATTR_BRIGHTNESS, 255)
|
||||
effect = kwargs.get(ATTR_EFFECT)
|
||||
brightness = kwargs.get(LightServiceArgument.BRIGHTNESS, 255)
|
||||
effect = kwargs.get(LightServiceArgument.EFFECT)
|
||||
|
||||
if ATTR_HS_COLOR in kwargs:
|
||||
color_h, color_s = kwargs[ATTR_HS_COLOR]
|
||||
elif ATTR_BRIGHTNESS in kwargs:
|
||||
if LightServiceArgument.HS_COLOR in kwargs:
|
||||
color_h, color_s = kwargs[LightServiceArgument.HS_COLOR]
|
||||
elif LightServiceArgument.BRIGHTNESS in kwargs:
|
||||
# Brightness update, keep color
|
||||
if self.hs_color is not None:
|
||||
color_h, color_s = self.hs_color
|
||||
|
||||
Reference in New Issue
Block a user