From 2b3e6a4ca833dd48e672c0e25f4b15f3b1d6415c Mon Sep 17 00:00:00 2001 From: G Johansson Date: Thu, 9 Feb 2023 15:59:30 +0100 Subject: [PATCH] Change name to entity_id for lock validation error message (#87574) --- homeassistant/components/lock/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/lock/__init__.py b/homeassistant/components/lock/__init__.py index 202fe8cff73..86a63538a68 100644 --- a/homeassistant/components/lock/__init__.py +++ b/homeassistant/components/lock/__init__.py @@ -90,7 +90,7 @@ async def _async_lock(entity: LockEntity, service_call: ServiceCall) -> None: code: str = service_call.data.get(ATTR_CODE, "") if entity.code_format_cmp and not entity.code_format_cmp.match(code): raise ValueError( - f"Code '{code}' for locking {entity.name} doesn't match pattern {entity.code_format}" + f"Code '{code}' for locking {entity.entity_id} doesn't match pattern {entity.code_format}" ) await entity.async_lock(**service_call.data) @@ -100,7 +100,7 @@ async def _async_unlock(entity: LockEntity, service_call: ServiceCall) -> None: code: str = service_call.data.get(ATTR_CODE, "") if entity.code_format_cmp and not entity.code_format_cmp.match(code): raise ValueError( - f"Code '{code}' for unlocking {entity.name} doesn't match pattern {entity.code_format}" + f"Code '{code}' for unlocking {entity.entity_id} doesn't match pattern {entity.code_format}" ) await entity.async_unlock(**service_call.data) @@ -110,7 +110,7 @@ async def _async_open(entity: LockEntity, service_call: ServiceCall) -> None: code: str = service_call.data.get(ATTR_CODE, "") if entity.code_format_cmp and not entity.code_format_cmp.match(code): raise ValueError( - f"Code '{code}' for opening {entity.name} doesn't match pattern {entity.code_format}" + f"Code '{code}' for opening {entity.entity_id} doesn't match pattern {entity.code_format}" ) await entity.async_open(**service_call.data)