diff --git a/homeassistant/components/update/__init__.py b/homeassistant/components/update/__init__.py index 75535849cc1..6f0b56b14e8 100644 --- a/homeassistant/components/update/__init__.py +++ b/homeassistant/components/update/__init__.py @@ -453,7 +453,7 @@ class UpdateEntity( # Otherwise, we use the internal progress value. if UpdateEntityFeature.PROGRESS in self.supported_features_compat: in_progress = self.in_progress - update_percentage = self.update_percentage + update_percentage = self.update_percentage if in_progress else None if type(in_progress) is not bool and isinstance(in_progress, int): update_percentage = in_progress in_progress = True diff --git a/tests/components/update/test_init.py b/tests/components/update/test_init.py index a354db44bd3..a35f7bb0f12 100644 --- a/tests/components/update/test_init.py +++ b/tests/components/update/test_init.py @@ -589,6 +589,16 @@ async def test_entity_already_in_progress( blocking=True, ) + # Check update percentage is suppressed when in_progress is False + entity = next( + entity for entity in mock_update_entities if entity.entity_id == entity_id + ) + entity._attr_in_progress = False + entity.async_write_ha_state() + state = hass.states.get(entity_id) + assert state.attributes[ATTR_IN_PROGRESS] is False + assert state.attributes[ATTR_UPDATE_PERCENTAGE] is None + async def test_entity_without_progress_support( hass: HomeAssistant,