Use the action field enums in blebox (#194876)

This commit is contained in:
epenet
2026-11-27 06:51:18 +00:00
committed by GitHub
parent 6a7e7ff986
commit ca98e83b89
2 changed files with 10 additions and 16 deletions
+3 -4
View File
@@ -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:
+7 -12
View File
@@ -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