mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Adjust type hints for SirenEntityFeature (#82266)
This commit is contained in:
parent
9b9bdc725f
commit
295cd0143c
@ -171,7 +171,6 @@ class MqttSiren(MqttEntity, SirenEntity):
|
|||||||
|
|
||||||
_entity_id_format = ENTITY_ID_FORMAT
|
_entity_id_format = ENTITY_ID_FORMAT
|
||||||
_attributes_extra_blocked = MQTT_SIREN_ATTRIBUTES_BLOCKED
|
_attributes_extra_blocked = MQTT_SIREN_ATTRIBUTES_BLOCKED
|
||||||
_attr_supported_features: int
|
|
||||||
|
|
||||||
_command_templates: dict[
|
_command_templates: dict[
|
||||||
str, Callable[[PublishPayloadType, TemplateVarsType], PublishPayloadType] | None
|
str, Callable[[PublishPayloadType, TemplateVarsType], PublishPayloadType] | None
|
||||||
@ -207,7 +206,7 @@ class MqttSiren(MqttEntity, SirenEntity):
|
|||||||
|
|
||||||
self._attr_extra_state_attributes = {}
|
self._attr_extra_state_attributes = {}
|
||||||
|
|
||||||
_supported_features: int = SUPPORTED_BASE
|
_supported_features = SUPPORTED_BASE
|
||||||
if config[CONF_SUPPORT_DURATION]:
|
if config[CONF_SUPPORT_DURATION]:
|
||||||
_supported_features |= SirenEntityFeature.DURATION
|
_supported_features |= SirenEntityFeature.DURATION
|
||||||
self._attr_extra_state_attributes[ATTR_DURATION] = None
|
self._attr_extra_state_attributes[ATTR_DURATION] = None
|
||||||
|
@ -163,6 +163,7 @@ class SirenEntity(ToggleEntity):
|
|||||||
|
|
||||||
entity_description: SirenEntityDescription
|
entity_description: SirenEntityDescription
|
||||||
_attr_available_tones: list[int | str] | dict[int, str] | None
|
_attr_available_tones: list[int | str] | dict[int, str] | None
|
||||||
|
_attr_supported_features: SirenEntityFeature | int = 0
|
||||||
|
|
||||||
@final
|
@final
|
||||||
@property
|
@property
|
||||||
@ -190,3 +191,8 @@ class SirenEntity(ToggleEntity):
|
|||||||
if hasattr(self, "entity_description"):
|
if hasattr(self, "entity_description"):
|
||||||
return self.entity_description.available_tones
|
return self.entity_description.available_tones
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def supported_features(self) -> SirenEntityFeature | int:
|
||||||
|
"""Return the list of supported features."""
|
||||||
|
return self._attr_supported_features
|
||||||
|
@ -2212,6 +2212,10 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
|||||||
function_name="available_tones",
|
function_name="available_tones",
|
||||||
return_type=["dict[int, str]", "list[int | str]", None],
|
return_type=["dict[int, str]", "list[int | str]", None],
|
||||||
),
|
),
|
||||||
|
TypeHintMatch(
|
||||||
|
function_name="supported_features",
|
||||||
|
return_type=["SirenEntityFeature", "int"],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user