diff --git a/homeassistant/components/update/__init__.py b/homeassistant/components/update/__init__.py index a19ecc535a2..7fb92d8164c 100644 --- a/homeassistant/components/update/__init__.py +++ b/homeassistant/components/update/__init__.py @@ -186,7 +186,9 @@ class UpdateEntity(RestoreEntity): return self._attr_entity_category if hasattr(self, "entity_description"): return self.entity_description.entity_category - return EntityCategory.CONFIG + if self.supported_features & UpdateEntityFeature.INSTALL: + return EntityCategory.CONFIG + return EntityCategory.DIAGNOSTIC @property def in_progress(self) -> bool | int | None: diff --git a/tests/components/update/test_init.py b/tests/components/update/test_init.py index cc8315c5aec..35366217a3d 100644 --- a/tests/components/update/test_init.py +++ b/tests/components/update/test_init.py @@ -21,6 +21,7 @@ from homeassistant.components.update.const import ( ATTR_RELEASE_URL, ATTR_SKIPPED_VERSION, ATTR_TITLE, + UpdateEntityFeature, ) from homeassistant.const import ( ATTR_ENTITY_ID, @@ -53,7 +54,7 @@ async def test_update(hass: HomeAssistant) -> None: update._attr_release_url = "https://example.com" update._attr_title = "Title" - assert update.entity_category is EntityCategory.CONFIG + assert update.entity_category is EntityCategory.DIAGNOSTIC assert update.current_version == "1.0.0" assert update.latest_version == "1.0.1" assert update.release_summary == "Summary" @@ -86,7 +87,12 @@ async def test_update(hass: HomeAssistant) -> None: update._attr_latest_version = None assert update.state is None + # Test entity category becomes config when its possible to install + update._attr_supported_features = UpdateEntityFeature.INSTALL + assert update.entity_category is EntityCategory.CONFIG + # UpdateEntityDescription was set + update._attr_supported_features = 0 update.entity_description = UpdateEntityDescription(key="F5 - Its very refreshing") assert update.device_class is None assert update.entity_category is EntityCategory.CONFIG