From b697bf13d28164ba6b3df48d32a0c2cb70324977 Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 11 Jun 2025 21:07:43 +0200 Subject: [PATCH] Reorder --- homeassistant/helpers/entity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/helpers/entity.py b/homeassistant/helpers/entity.py index 3fad826303d..b0528dd68d8 100644 --- a/homeassistant/helpers/entity.py +++ b/homeassistant/helpers/entity.py @@ -1423,11 +1423,11 @@ class Entity( # Set the entity's state will to unavailable + ATTR_RESTORED: True self.registry_entry.write_unavailable_state(self.hass) else: - self.hass.states.async_remove(self.entity_id, context=self._context) # The check for self.platform guards against integrations not using an # EntityComponent and can be removed in HA Core 2024.1 if self.platform: del entity_sources(self.hass)[self.entity_id] + self.hass.states.async_remove(self.entity_id, context=self._context) async def async_added_to_hass(self) -> None: """Run when entity about to be added to hass.