From 10ed9cfdf2e243f73cf538c4943c4ec40297eafe Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 7 Apr 2022 18:00:24 +0200 Subject: [PATCH] Use EntityFeature enums in overkiz (#69587) --- .../climate_entities/atlantic_electrical_heater.py | 4 ++-- .../components/overkiz/cover_entities/awning.py | 13 +++++-------- .../overkiz/cover_entities/generic_cover.py | 13 +++++-------- .../overkiz/cover_entities/vertical_cover.py | 13 +++++-------- 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/homeassistant/components/overkiz/climate_entities/atlantic_electrical_heater.py b/homeassistant/components/overkiz/climate_entities/atlantic_electrical_heater.py index 8756b768e52..2558c7e8e8e 100644 --- a/homeassistant/components/overkiz/climate_entities/atlantic_electrical_heater.py +++ b/homeassistant/components/overkiz/climate_entities/atlantic_electrical_heater.py @@ -7,8 +7,8 @@ from pyoverkiz.enums import OverkizCommand, OverkizCommandParam, OverkizState from homeassistant.components.climate import ( HVAC_MODE_OFF, - SUPPORT_PRESET_MODE, ClimateEntity, + ClimateEntityFeature, ) from homeassistant.components.climate.const import ( HVAC_MODE_HEAT, @@ -43,7 +43,7 @@ class AtlanticElectricalHeater(OverkizEntity, ClimateEntity): _attr_hvac_modes = [*HVAC_MODES_TO_OVERKIZ] _attr_preset_modes = [*PRESET_MODES_TO_OVERKIZ] - _attr_supported_features = SUPPORT_PRESET_MODE + _attr_supported_features = ClimateEntityFeature.PRESET_MODE _attr_temperature_unit = TEMP_CELSIUS @property diff --git a/homeassistant/components/overkiz/cover_entities/awning.py b/homeassistant/components/overkiz/cover_entities/awning.py index ebbff8710f3..fe6bfeb73d6 100644 --- a/homeassistant/components/overkiz/cover_entities/awning.py +++ b/homeassistant/components/overkiz/cover_entities/awning.py @@ -7,11 +7,8 @@ from pyoverkiz.enums import OverkizCommand, OverkizState from homeassistant.components.cover import ( ATTR_POSITION, - SUPPORT_CLOSE, - SUPPORT_OPEN, - SUPPORT_SET_POSITION, - SUPPORT_STOP, CoverDeviceClass, + CoverEntityFeature, ) from .generic_cover import COMMANDS_STOP, OverkizGenericCover @@ -28,16 +25,16 @@ class Awning(OverkizGenericCover): supported_features: int = super().supported_features if self.executor.has_command(OverkizCommand.SET_DEPLOYMENT): - supported_features |= SUPPORT_SET_POSITION + supported_features |= CoverEntityFeature.SET_POSITION if self.executor.has_command(OverkizCommand.DEPLOY): - supported_features |= SUPPORT_OPEN + supported_features |= CoverEntityFeature.OPEN if self.executor.has_command(*COMMANDS_STOP): - supported_features |= SUPPORT_STOP + supported_features |= CoverEntityFeature.STOP if self.executor.has_command(OverkizCommand.UNDEPLOY): - supported_features |= SUPPORT_CLOSE + supported_features |= CoverEntityFeature.CLOSE return supported_features diff --git a/homeassistant/components/overkiz/cover_entities/generic_cover.py b/homeassistant/components/overkiz/cover_entities/generic_cover.py index c25cd1ab806..4a0cbe3b0cb 100644 --- a/homeassistant/components/overkiz/cover_entities/generic_cover.py +++ b/homeassistant/components/overkiz/cover_entities/generic_cover.py @@ -8,11 +8,8 @@ from pyoverkiz.enums import OverkizCommand, OverkizCommandParam, OverkizState from homeassistant.components.cover import ( ATTR_TILT_POSITION, - SUPPORT_CLOSE_TILT, - SUPPORT_OPEN_TILT, - SUPPORT_SET_TILT_POSITION, - SUPPORT_STOP_TILT, CoverEntity, + CoverEntityFeature, ) from homeassistant.components.overkiz.entity import OverkizEntity @@ -178,15 +175,15 @@ class OverkizGenericCover(OverkizEntity, CoverEntity): supported_features = 0 if self.executor.has_command(*COMMANDS_OPEN_TILT): - supported_features |= SUPPORT_OPEN_TILT + supported_features |= CoverEntityFeature.OPEN_TILT if self.executor.has_command(*COMMANDS_STOP_TILT): - supported_features |= SUPPORT_STOP_TILT + supported_features |= CoverEntityFeature.STOP_TILT if self.executor.has_command(*COMMANDS_CLOSE_TILT): - supported_features |= SUPPORT_CLOSE_TILT + supported_features |= CoverEntityFeature.CLOSE_TILT if self.executor.has_command(*COMMANDS_SET_TILT_POSITION): - supported_features |= SUPPORT_SET_TILT_POSITION + supported_features |= CoverEntityFeature.SET_TILT_POSITION return supported_features diff --git a/homeassistant/components/overkiz/cover_entities/vertical_cover.py b/homeassistant/components/overkiz/cover_entities/vertical_cover.py index ec502a403ad..df3ba813ecb 100644 --- a/homeassistant/components/overkiz/cover_entities/vertical_cover.py +++ b/homeassistant/components/overkiz/cover_entities/vertical_cover.py @@ -13,11 +13,8 @@ from pyoverkiz.enums import ( from homeassistant.components.cover import ( ATTR_POSITION, - SUPPORT_CLOSE, - SUPPORT_OPEN, - SUPPORT_SET_POSITION, - SUPPORT_STOP, CoverDeviceClass, + CoverEntityFeature, ) from homeassistant.components.overkiz.coordinator import OverkizDataUpdateCoordinator @@ -49,16 +46,16 @@ class VerticalCover(OverkizGenericCover): supported_features: int = super().supported_features if self.executor.has_command(OverkizCommand.SET_CLOSURE): - supported_features |= SUPPORT_SET_POSITION + supported_features |= CoverEntityFeature.SET_POSITION if self.executor.has_command(*COMMANDS_OPEN): - supported_features |= SUPPORT_OPEN + supported_features |= CoverEntityFeature.OPEN if self.executor.has_command(*COMMANDS_STOP): - supported_features |= SUPPORT_STOP + supported_features |= CoverEntityFeature.STOP if self.executor.has_command(*COMMANDS_CLOSE): - supported_features |= SUPPORT_CLOSE + supported_features |= CoverEntityFeature.CLOSE return supported_features