From 6a7e7ff986bbe479e40bbca11bf555ba3d24d1f6 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 27 Nov 2026 07:50:57 +0100 Subject: [PATCH] Use the action field enums in wmspro (#194871) --- homeassistant/components/wmspro/cover.py | 9 ++++----- homeassistant/components/wmspro/light.py | 8 +++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/wmspro/cover.py b/homeassistant/components/wmspro/cover.py index 753a3e6e0426..8e6133179d37 100644 --- a/homeassistant/components/wmspro/cover.py +++ b/homeassistant/components/wmspro/cover.py @@ -10,10 +10,9 @@ from wmspro.const import ( ) from homeassistant.components.cover import ( - ATTR_POSITION, - ATTR_TILT_POSITION, CoverDeviceClass, CoverEntity, + CoverServiceArgument, ) from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback @@ -78,7 +77,7 @@ class WebControlProCover(WebControlProGenericEntity, CoverEntity): async def async_set_cover_position(self, **kwargs: Any) -> None: """Move the cover to a specific position.""" action = self._dest.action(self._drive_action_desc) - await action(percentage=100 - kwargs[ATTR_POSITION]) + await action(percentage=100 - kwargs[CoverServiceArgument.POSITION]) @property @override @@ -163,7 +162,7 @@ class WebControlProSlatRotate(WebControlProSlat): @override async def async_set_cover_position(self, **kwargs: Any) -> None: """Move the cover to a specific position and tilt for open/close.""" - target_position = kwargs[ATTR_POSITION] + target_position = kwargs[CoverServiceArgument.POSITION] if target_position == 0: await self.async_close_cover() elif target_position == 100: @@ -189,7 +188,7 @@ class WebControlProSlatRotate(WebControlProSlat): action = self._dest.action(self._tilt_action_desc) rotation = percentage_to_ranged_value( (action.minValue, action.maxValue), - 100 - kwargs[ATTR_TILT_POSITION], + 100 - kwargs[CoverServiceArgument.TILT_POSITION], ) await action(rotation=rotation) diff --git a/homeassistant/components/wmspro/light.py b/homeassistant/components/wmspro/light.py index 698d9aa19b60..2d6c39305b52 100644 --- a/homeassistant/components/wmspro/light.py +++ b/homeassistant/components/wmspro/light.py @@ -8,7 +8,7 @@ from wmspro.const import ( WMS_WebControl_pro_API_responseType, ) -from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity +from homeassistant.components.light import ColorMode, LightEntity, LightServiceArgument from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from homeassistant.util.color import brightness_to_value, value_to_brightness @@ -86,12 +86,14 @@ class WebControlProDimmer(WebControlProLight): @override async def async_turn_on(self, **kwargs: Any) -> None: """Turn the dimmer on.""" - if ATTR_BRIGHTNESS not in kwargs: + if LightServiceArgument.BRIGHTNESS not in kwargs: await super().async_turn_on(**kwargs) return action = self._dest.action(ACTION_DESC.LightDimming) await action( - percentage=brightness_to_value(BRIGHTNESS_SCALE, kwargs[ATTR_BRIGHTNESS]), + percentage=brightness_to_value( + BRIGHTNESS_SCALE, kwargs[LightServiceArgument.BRIGHTNESS] + ), responseType=WMS_WebControl_pro_API_responseType.Detailed, )