mirror of
https://github.com/home-assistant/core.git
synced 2025-08-07 06:35:10 +02:00
Enforce UpdateEntityFeature (#82465)
This commit is contained in:
@@ -253,9 +253,9 @@ class MqttUpdate(MqttEntity, UpdateEntity, RestoreEntity):
|
|||||||
get_mqtt_data(self.hass).state_write_requests.write_state_request(self)
|
get_mqtt_data(self.hass).state_write_requests.write_state_request(self)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self) -> UpdateEntityFeature | int:
|
def supported_features(self) -> UpdateEntityFeature:
|
||||||
"""Return the list of supported features."""
|
"""Return the list of supported features."""
|
||||||
support = 0
|
support = UpdateEntityFeature(0)
|
||||||
|
|
||||||
if self._config.get(CONF_COMMAND_TOPIC) is not None:
|
if self._config.get(CONF_COMMAND_TOPIC) is not None:
|
||||||
support |= UpdateEntityFeature.INSTALL
|
support |= UpdateEntityFeature.INSTALL
|
||||||
|
@@ -190,7 +190,7 @@ class UpdateEntity(RestoreEntity):
|
|||||||
_attr_release_summary: str | None = None
|
_attr_release_summary: str | None = None
|
||||||
_attr_release_url: str | None = None
|
_attr_release_url: str | None = None
|
||||||
_attr_state: None = None
|
_attr_state: None = None
|
||||||
_attr_supported_features: UpdateEntityFeature | int = 0
|
_attr_supported_features: UpdateEntityFeature = UpdateEntityFeature(0)
|
||||||
_attr_title: str | None = None
|
_attr_title: str | None = None
|
||||||
__skipped_version: str | None = None
|
__skipped_version: str | None = None
|
||||||
__in_progress: bool = False
|
__in_progress: bool = False
|
||||||
@@ -270,7 +270,7 @@ class UpdateEntity(RestoreEntity):
|
|||||||
return self._attr_release_url
|
return self._attr_release_url
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self) -> UpdateEntityFeature | int:
|
def supported_features(self) -> UpdateEntityFeature:
|
||||||
"""Flag supported features."""
|
"""Flag supported features."""
|
||||||
return self._attr_supported_features
|
return self._attr_supported_features
|
||||||
|
|
||||||
|
@@ -2345,7 +2345,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
|||||||
),
|
),
|
||||||
TypeHintMatch(
|
TypeHintMatch(
|
||||||
function_name="supported_features",
|
function_name="supported_features",
|
||||||
return_type=["UpdateEntityFeature", "int"],
|
return_type="UpdateEntityFeature",
|
||||||
),
|
),
|
||||||
TypeHintMatch(
|
TypeHintMatch(
|
||||||
function_name="title",
|
function_name="title",
|
||||||
|
Reference in New Issue
Block a user