From ca98e83b89988a06240cb23f1195caeccee96f52 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 27 Nov 2026 07:51:18 +0100 Subject: [PATCH] Use the action field enums in blebox (#194876) --- homeassistant/components/blebox/cover.py | 7 +++---- homeassistant/components/blebox/light.py | 19 +++++++------------ 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/homeassistant/components/blebox/cover.py b/homeassistant/components/blebox/cover.py index 791b77e5d1ea..a0fe43da7b9a 100644 --- a/homeassistant/components/blebox/cover.py +++ b/homeassistant/components/blebox/cover.py @@ -6,11 +6,10 @@ import blebox_uniapi.cover from blebox_uniapi.cover import BleboxCoverState, UnifiedCoverType from homeassistant.components.cover import ( - ATTR_POSITION, - ATTR_TILT_POSITION, CoverDeviceClass, CoverEntity, CoverEntityFeature, + CoverServiceArgument, CoverState, ) from homeassistant.core import HomeAssistant @@ -192,7 +191,7 @@ class BleBoxCoverEntity(BleBoxEntity[blebox_uniapi.cover.Cover], CoverEntity): @override async def async_set_cover_position(self, **kwargs: Any) -> None: """Set the cover position.""" - position = kwargs[ATTR_POSITION] + position = kwargs[CoverServiceArgument.POSITION] await self._feature.async_set_position(100 - position) @blebox_command @@ -205,7 +204,7 @@ class BleBoxCoverEntity(BleBoxEntity[blebox_uniapi.cover.Cover], CoverEntity): @override async def async_set_cover_tilt_position(self, **kwargs: Any) -> None: """Set the tilt position.""" - position = kwargs[ATTR_TILT_POSITION] + position = kwargs[CoverServiceArgument.TILT_POSITION] await self._feature.async_set_tilt_position(100 - position) def _is_state(self, state_name) -> bool | None: diff --git a/homeassistant/components/blebox/light.py b/homeassistant/components/blebox/light.py index 02484c92b6b5..dc597c42367a 100644 --- a/homeassistant/components/blebox/light.py +++ b/homeassistant/components/blebox/light.py @@ -8,15 +8,10 @@ import blebox_uniapi.light from blebox_uniapi.light import BleboxColorMode from homeassistant.components.light import ( - ATTR_BRIGHTNESS, - ATTR_COLOR_TEMP_KELVIN, - ATTR_EFFECT, - ATTR_RGB_COLOR, - ATTR_RGBW_COLOR, - ATTR_RGBWW_COLOR, ColorMode, LightEntity, LightEntityFeature, + LightServiceArgument, ) from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError @@ -189,12 +184,12 @@ class BleBoxLightEntity(BleBoxEntity[blebox_uniapi.light.Light], LightEntity): async def async_turn_on(self, **kwargs: Any) -> None: """Turn the light on.""" - rgbw = kwargs.get(ATTR_RGBW_COLOR) - brightness = kwargs.get(ATTR_BRIGHTNESS) - effect = kwargs.get(ATTR_EFFECT) - color_temp_kelvin = kwargs.get(ATTR_COLOR_TEMP_KELVIN) - rgbww = kwargs.get(ATTR_RGBWW_COLOR) - rgb = kwargs.get(ATTR_RGB_COLOR) + rgbw = kwargs.get(LightServiceArgument.RGBW_COLOR) + brightness = kwargs.get(LightServiceArgument.BRIGHTNESS) + effect = kwargs.get(LightServiceArgument.EFFECT) + color_temp_kelvin = kwargs.get(LightServiceArgument.COLOR_TEMP_KELVIN) + rgbww = kwargs.get(LightServiceArgument.RGBWW_COLOR) + rgb = kwargs.get(LightServiceArgument.RGB_COLOR) feature = self._feature value = feature.sensible_on_value