Enforce UpdateEntityFeature (#82465)

This commit is contained in:
epenet 2022-11-22 07:16:53 +01:00 committed by GitHub
parent ff5f1aee53
commit ab26ea06b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -253,9 +253,9 @@ class MqttUpdate(MqttEntity, UpdateEntity, RestoreEntity):
get_mqtt_data(self.hass).state_write_requests.write_state_request(self)
@property
def supported_features(self) -> UpdateEntityFeature | int:
def supported_features(self) -> UpdateEntityFeature:
"""Return the list of supported features."""
support = 0
support = UpdateEntityFeature(0)
if self._config.get(CONF_COMMAND_TOPIC) is not None:
support |= UpdateEntityFeature.INSTALL

View File

@ -190,7 +190,7 @@ class UpdateEntity(RestoreEntity):
_attr_release_summary: str | None = None
_attr_release_url: str | None = None
_attr_state: None = None
_attr_supported_features: UpdateEntityFeature | int = 0
_attr_supported_features: UpdateEntityFeature = UpdateEntityFeature(0)
_attr_title: str | None = None
__skipped_version: str | None = None
__in_progress: bool = False
@ -270,7 +270,7 @@ class UpdateEntity(RestoreEntity):
return self._attr_release_url
@property
def supported_features(self) -> UpdateEntityFeature | int:
def supported_features(self) -> UpdateEntityFeature:
"""Flag supported features."""
return self._attr_supported_features

View File

@ -2345,7 +2345,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
),
TypeHintMatch(
function_name="supported_features",
return_type=["UpdateEntityFeature", "int"],
return_type="UpdateEntityFeature",
),
TypeHintMatch(
function_name="title",