mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Fail if new entity_id is in hass.states
This commit is contained in:
parent
3e7b908a61
commit
1f8156e26c
@ -88,7 +88,7 @@ async def websocket_get_entity(hass, connection, msg):
|
|||||||
|
|
||||||
@async_response
|
@async_response
|
||||||
async def websocket_update_entity(hass, connection, msg):
|
async def websocket_update_entity(hass, connection, msg):
|
||||||
"""Handle get camera thumbnail websocket command.
|
"""Handle update entity websocket command.
|
||||||
|
|
||||||
Async friendly.
|
Async friendly.
|
||||||
"""
|
"""
|
||||||
|
@ -171,7 +171,9 @@ class EntityRegistry:
|
|||||||
changes['device_id'] = device_id
|
changes['device_id'] = device_id
|
||||||
|
|
||||||
if new_entity_id is not _UNDEF and new_entity_id != old.entity_id:
|
if new_entity_id is not _UNDEF and new_entity_id != old.entity_id:
|
||||||
if self.async_is_registered(new_entity_id):
|
if (self.async_is_registered(new_entity_id) or new_entity_id in
|
||||||
|
self.hass.states.async_entity_ids(
|
||||||
|
split_entity_id(entity_id)[0])):
|
||||||
raise ValueError('Entity is already registered')
|
raise ValueError('Entity is already registered')
|
||||||
|
|
||||||
if not valid_entity_id(new_entity_id):
|
if not valid_entity_id(new_entity_id):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user