mirror of
https://github.com/home-assistant/core.git
synced 2025-06-06 14:17:06 +00:00
Enforce AlarmControlPanelEntityFeature (#82313)
This commit is contained in:
parent
b3dd59f202
commit
cec81e137c
@ -133,7 +133,9 @@ class AlarmControlPanelEntity(Entity):
|
|||||||
_attr_changed_by: str | None = None
|
_attr_changed_by: str | None = None
|
||||||
_attr_code_arm_required: bool = True
|
_attr_code_arm_required: bool = True
|
||||||
_attr_code_format: CodeFormat | None = None
|
_attr_code_format: CodeFormat | None = None
|
||||||
_attr_supported_features: AlarmControlPanelEntityFeature | int = 0
|
_attr_supported_features: AlarmControlPanelEntityFeature = (
|
||||||
|
AlarmControlPanelEntityFeature(0)
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def code_format(self) -> CodeFormat | None:
|
def code_format(self) -> CodeFormat | None:
|
||||||
@ -207,7 +209,7 @@ class AlarmControlPanelEntity(Entity):
|
|||||||
await self.hass.async_add_executor_job(self.alarm_arm_custom_bypass, code)
|
await self.hass.async_add_executor_job(self.alarm_arm_custom_bypass, code)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self) -> AlarmControlPanelEntityFeature | int:
|
def supported_features(self) -> AlarmControlPanelEntityFeature:
|
||||||
"""Return the list of supported features."""
|
"""Return the list of supported features."""
|
||||||
return self._attr_supported_features
|
return self._attr_supported_features
|
||||||
|
|
||||||
|
@ -189,9 +189,9 @@ class AlarmControlPanelTemplate(TemplateEntity, AlarmControlPanelEntity):
|
|||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self) -> int:
|
def supported_features(self) -> AlarmControlPanelEntityFeature:
|
||||||
"""Return the list of supported features."""
|
"""Return the list of supported features."""
|
||||||
supported_features = 0
|
supported_features = AlarmControlPanelEntityFeature(0)
|
||||||
if self._arm_night_script is not None:
|
if self._arm_night_script is not None:
|
||||||
supported_features = (
|
supported_features = (
|
||||||
supported_features | AlarmControlPanelEntityFeature.ARM_NIGHT
|
supported_features | AlarmControlPanelEntityFeature.ARM_NIGHT
|
||||||
|
@ -661,7 +661,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
|||||||
),
|
),
|
||||||
TypeHintMatch(
|
TypeHintMatch(
|
||||||
function_name="supported_features",
|
function_name="supported_features",
|
||||||
return_type=["AlarmControlPanelEntityFeature", "int"],
|
return_type="AlarmControlPanelEntityFeature",
|
||||||
),
|
),
|
||||||
TypeHintMatch(
|
TypeHintMatch(
|
||||||
function_name="alarm_disarm",
|
function_name="alarm_disarm",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user