From 8aed0025d183a51cd3481a9e50b6aa25c8832f80 Mon Sep 17 00:00:00 2001 From: Glen Takahashi Date: Sun, 16 Dec 2018 00:16:44 -0500 Subject: [PATCH] Fix not being able to update entities 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. --- homeassistant/components/config/entity_registry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/config/entity_registry.py b/homeassistant/components/config/entity_registry.py index 71833a2e42de42..fdac1ad95dadee 100644 --- a/homeassistant/components/config/entity_registry.py +++ b/homeassistant/components/config/entity_registry.py @@ -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(