mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Fix not being able to update entities (#19344)
When editing an entity in the frontend dialog, pressing save causes a "save failed: Entity is already registered" error. This is because the frontend always sets `name` and `new_entity_id` in the websocket command even if they haven't been changed. This adds a check that the `new_entity_id` is actually different from `entity_id` before erroring that the `new_entity_id` is already registered.
This commit is contained in:
parent
5a295ad42b
commit
b031ded671
@ -104,7 +104,7 @@ async def websocket_update_entity(hass, connection, msg):
|
||||
if 'name' in msg:
|
||||
changes['name'] = msg['name']
|
||||
|
||||
if 'new_entity_id' in msg:
|
||||
if 'new_entity_id' in msg and msg['new_entity_id'] != msg['entity_id']:
|
||||
changes['new_entity_id'] = msg['new_entity_id']
|
||||
if hass.states.get(msg['new_entity_id']) is not None:
|
||||
connection.send_message(websocket_api.error_message(
|
||||
|
Loading…
x
Reference in New Issue
Block a user