Slightly improve error message in case of duplicate entity IDs (#45424)
This commit is contained in:
parent
2bc59c1d8e
commit
89fc92f68a
2 changed files with 4 additions and 2 deletions
|
@ -102,7 +102,9 @@ async def websocket_update_entity(hass, connection, msg):
|
||||||
if hass.states.get(msg["new_entity_id"]) is not None:
|
if hass.states.get(msg["new_entity_id"]) is not None:
|
||||||
connection.send_message(
|
connection.send_message(
|
||||||
websocket_api.error_message(
|
websocket_api.error_message(
|
||||||
msg["id"], "invalid_info", "Entity is already registered"
|
msg["id"],
|
||||||
|
"invalid_info",
|
||||||
|
"Entity with this ID is already registered",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
|
@ -388,7 +388,7 @@ class EntityRegistry:
|
||||||
|
|
||||||
if new_entity_id is not UNDEFINED and new_entity_id != old.entity_id:
|
if new_entity_id is not UNDEFINED and new_entity_id != old.entity_id:
|
||||||
if self.async_is_registered(new_entity_id):
|
if self.async_is_registered(new_entity_id):
|
||||||
raise ValueError("Entity is already registered")
|
raise ValueError("Entity with this ID is already registered")
|
||||||
|
|
||||||
if not valid_entity_id(new_entity_id):
|
if not valid_entity_id(new_entity_id):
|
||||||
raise ValueError("Invalid entity ID")
|
raise ValueError("Invalid entity ID")
|
||||||
|
|
Loading…
Add table
Reference in a new issue