diff --git a/homeassistant/helpers/entity.py b/homeassistant/helpers/entity.py index 66bbc744b70..c0b301b6fb6 100644 --- a/homeassistant/helpers/entity.py +++ b/homeassistant/helpers/entity.py @@ -1092,7 +1092,7 @@ class Entity( @callback def _async_write_ha_state(self) -> None: """Write the state to the state machine.""" - if self._platform_state == EntityPlatformState.REMOVED: + if self._platform_state is EntityPlatformState.REMOVED: # Polling returned after the entity has already been removed return @@ -1305,7 +1305,7 @@ class Entity( parallel_updates: asyncio.Semaphore | None, ) -> None: """Start adding an entity to a platform.""" - if self._platform_state != EntityPlatformState.NOT_ADDED: + if self._platform_state is not EntityPlatformState.NOT_ADDED: raise HomeAssistantError( f"Entity '{self.entity_id}' cannot be added a second time to an entity" " platform" @@ -1572,7 +1572,7 @@ class Entity( If the entity is not added to a platform it's not safe to call _stringify_state. """ - if self._platform_state != EntityPlatformState.ADDED: + if self._platform_state is not EntityPlatformState.ADDED: return f"" return f""