From 6f282dcb12ab774f7193f8e0709f455a6f62ff15 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 2 Dec 2026 14:17:25 +0100 Subject: [PATCH] Use the action field enums in modern_forms (#196014) --- homeassistant/components/modern_forms/light.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/modern_forms/light.py b/homeassistant/components/modern_forms/light.py index 1049829519da..425600fde445 100644 --- a/homeassistant/components/modern_forms/light.py +++ b/homeassistant/components/modern_forms/light.py @@ -5,12 +5,7 @@ from typing import Any, override from aiomodernforms.const import LIGHT_POWER_OFF, LIGHT_POWER_ON from aiomodernforms.models import Light -from homeassistant.components.light import ( - ATTR_BRIGHTNESS, - ATTR_COLOR_TEMP_KELVIN, - ColorMode, - LightEntity, -) +from homeassistant.components.light import ColorMode, LightEntity, LightServiceArgument from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback @@ -143,12 +138,12 @@ class ModernFormsLightEntity(ModernFormsDeviceEntity, LightEntity): """Turn on the light.""" data: dict[str, Any] = {OPT_ON: LIGHT_POWER_ON} - if ATTR_BRIGHTNESS in kwargs: + if LightServiceArgument.BRIGHTNESS in kwargs: data[OPT_BRIGHTNESS] = ranged_value_to_percentage( - BRIGHTNESS_RANGE, kwargs[ATTR_BRIGHTNESS] + BRIGHTNESS_RANGE, kwargs[LightServiceArgument.BRIGHTNESS] ) - if ATTR_COLOR_TEMP_KELVIN in kwargs: - data[OPT_COLOR_TEMP_KELVIN] = kwargs[ATTR_COLOR_TEMP_KELVIN] + if LightServiceArgument.COLOR_TEMP_KELVIN in kwargs: + data[OPT_COLOR_TEMP_KELVIN] = kwargs[LightServiceArgument.COLOR_TEMP_KELVIN] await self._async_control_light(**data)