mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Use EntityFeature enums in overkiz (#69587)
This commit is contained in:
parent
04dab04ee7
commit
10ed9cfdf2
@ -7,8 +7,8 @@ from pyoverkiz.enums import OverkizCommand, OverkizCommandParam, OverkizState
|
|||||||
|
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
HVAC_MODE_OFF,
|
HVAC_MODE_OFF,
|
||||||
SUPPORT_PRESET_MODE,
|
|
||||||
ClimateEntity,
|
ClimateEntity,
|
||||||
|
ClimateEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.components.climate.const import (
|
from homeassistant.components.climate.const import (
|
||||||
HVAC_MODE_HEAT,
|
HVAC_MODE_HEAT,
|
||||||
@ -43,7 +43,7 @@ class AtlanticElectricalHeater(OverkizEntity, ClimateEntity):
|
|||||||
|
|
||||||
_attr_hvac_modes = [*HVAC_MODES_TO_OVERKIZ]
|
_attr_hvac_modes = [*HVAC_MODES_TO_OVERKIZ]
|
||||||
_attr_preset_modes = [*PRESET_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
|
_attr_temperature_unit = TEMP_CELSIUS
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -7,11 +7,8 @@ from pyoverkiz.enums import OverkizCommand, OverkizState
|
|||||||
|
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
ATTR_POSITION,
|
ATTR_POSITION,
|
||||||
SUPPORT_CLOSE,
|
|
||||||
SUPPORT_OPEN,
|
|
||||||
SUPPORT_SET_POSITION,
|
|
||||||
SUPPORT_STOP,
|
|
||||||
CoverDeviceClass,
|
CoverDeviceClass,
|
||||||
|
CoverEntityFeature,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .generic_cover import COMMANDS_STOP, OverkizGenericCover
|
from .generic_cover import COMMANDS_STOP, OverkizGenericCover
|
||||||
@ -28,16 +25,16 @@ class Awning(OverkizGenericCover):
|
|||||||
supported_features: int = super().supported_features
|
supported_features: int = super().supported_features
|
||||||
|
|
||||||
if self.executor.has_command(OverkizCommand.SET_DEPLOYMENT):
|
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):
|
if self.executor.has_command(OverkizCommand.DEPLOY):
|
||||||
supported_features |= SUPPORT_OPEN
|
supported_features |= CoverEntityFeature.OPEN
|
||||||
|
|
||||||
if self.executor.has_command(*COMMANDS_STOP):
|
if self.executor.has_command(*COMMANDS_STOP):
|
||||||
supported_features |= SUPPORT_STOP
|
supported_features |= CoverEntityFeature.STOP
|
||||||
|
|
||||||
if self.executor.has_command(OverkizCommand.UNDEPLOY):
|
if self.executor.has_command(OverkizCommand.UNDEPLOY):
|
||||||
supported_features |= SUPPORT_CLOSE
|
supported_features |= CoverEntityFeature.CLOSE
|
||||||
|
|
||||||
return supported_features
|
return supported_features
|
||||||
|
|
||||||
|
@ -8,11 +8,8 @@ from pyoverkiz.enums import OverkizCommand, OverkizCommandParam, OverkizState
|
|||||||
|
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
ATTR_TILT_POSITION,
|
ATTR_TILT_POSITION,
|
||||||
SUPPORT_CLOSE_TILT,
|
|
||||||
SUPPORT_OPEN_TILT,
|
|
||||||
SUPPORT_SET_TILT_POSITION,
|
|
||||||
SUPPORT_STOP_TILT,
|
|
||||||
CoverEntity,
|
CoverEntity,
|
||||||
|
CoverEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.components.overkiz.entity import OverkizEntity
|
from homeassistant.components.overkiz.entity import OverkizEntity
|
||||||
|
|
||||||
@ -178,15 +175,15 @@ class OverkizGenericCover(OverkizEntity, CoverEntity):
|
|||||||
supported_features = 0
|
supported_features = 0
|
||||||
|
|
||||||
if self.executor.has_command(*COMMANDS_OPEN_TILT):
|
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):
|
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):
|
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):
|
if self.executor.has_command(*COMMANDS_SET_TILT_POSITION):
|
||||||
supported_features |= SUPPORT_SET_TILT_POSITION
|
supported_features |= CoverEntityFeature.SET_TILT_POSITION
|
||||||
|
|
||||||
return supported_features
|
return supported_features
|
||||||
|
@ -13,11 +13,8 @@ from pyoverkiz.enums import (
|
|||||||
|
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
ATTR_POSITION,
|
ATTR_POSITION,
|
||||||
SUPPORT_CLOSE,
|
|
||||||
SUPPORT_OPEN,
|
|
||||||
SUPPORT_SET_POSITION,
|
|
||||||
SUPPORT_STOP,
|
|
||||||
CoverDeviceClass,
|
CoverDeviceClass,
|
||||||
|
CoverEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.components.overkiz.coordinator import OverkizDataUpdateCoordinator
|
from homeassistant.components.overkiz.coordinator import OverkizDataUpdateCoordinator
|
||||||
|
|
||||||
@ -49,16 +46,16 @@ class VerticalCover(OverkizGenericCover):
|
|||||||
supported_features: int = super().supported_features
|
supported_features: int = super().supported_features
|
||||||
|
|
||||||
if self.executor.has_command(OverkizCommand.SET_CLOSURE):
|
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):
|
if self.executor.has_command(*COMMANDS_OPEN):
|
||||||
supported_features |= SUPPORT_OPEN
|
supported_features |= CoverEntityFeature.OPEN
|
||||||
|
|
||||||
if self.executor.has_command(*COMMANDS_STOP):
|
if self.executor.has_command(*COMMANDS_STOP):
|
||||||
supported_features |= SUPPORT_STOP
|
supported_features |= CoverEntityFeature.STOP
|
||||||
|
|
||||||
if self.executor.has_command(*COMMANDS_CLOSE):
|
if self.executor.has_command(*COMMANDS_CLOSE):
|
||||||
supported_features |= SUPPORT_CLOSE
|
supported_features |= CoverEntityFeature.CLOSE
|
||||||
|
|
||||||
return supported_features
|
return supported_features
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user