Quote entity ids in entity excpetions (#103286)

This commit is contained in:
Erik Montnemery 2023-11-03 06:04:07 +01:00 committed by GitHub
parent 12e1acfcfc
commit a63c420890
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -989,7 +989,7 @@ class Entity(ABC):
"""Start adding an entity to a platform.""" """Start adding an entity to a platform."""
if self._platform_state == EntityPlatformState.ADDED: if self._platform_state == EntityPlatformState.ADDED:
raise HomeAssistantError( raise HomeAssistantError(
f"Entity {self.entity_id} cannot be added a second time to an entity" f"Entity '{self.entity_id}' cannot be added a second time to an entity"
" platform" " platform"
) )
@ -1036,7 +1036,7 @@ class Entity(ABC):
# EntityComponent and can be removed in HA Core 2024.1 # EntityComponent and can be removed in HA Core 2024.1
if self.platform and self._platform_state != EntityPlatformState.ADDED: if self.platform and self._platform_state != EntityPlatformState.ADDED:
raise HomeAssistantError( raise HomeAssistantError(
f"Entity {self.entity_id} async_remove called twice" f"Entity '{self.entity_id}' async_remove called twice"
) )
self._platform_state = EntityPlatformState.REMOVED self._platform_state = EntityPlatformState.REMOVED
@ -1099,7 +1099,7 @@ class Entity(ABC):
# This is an assert as it should never happen, but helps in tests # This is an assert as it should never happen, but helps in tests
assert ( assert (
not self.registry_entry.disabled_by not self.registry_entry.disabled_by
), f"Entity {self.entity_id} is being added while it's disabled" ), f"Entity '{self.entity_id}' is being added while it's disabled"
self.async_on_remove( self.async_on_remove(
async_track_entity_registry_updated_event( async_track_entity_registry_updated_event(