Allow changing entity ID (#15637)
* Allow changing entity ID * Add support to websocket command * Address comments * Error handling
This commit is contained in:
parent
fbeaa57604
commit
d9cf8fcfe8
7 changed files with 206 additions and 22 deletions
|
@ -400,3 +400,15 @@ def test_async_remove_no_platform(hass):
|
|||
assert len(hass.states.async_entity_ids()) == 1
|
||||
yield from ent.async_remove()
|
||||
assert len(hass.states.async_entity_ids()) == 0
|
||||
|
||||
|
||||
async def test_async_remove_runs_callbacks(hass):
|
||||
"""Test async_remove method when no platform set."""
|
||||
result = []
|
||||
|
||||
ent = entity.Entity()
|
||||
ent.hass = hass
|
||||
ent.entity_id = 'test.test'
|
||||
ent.async_on_remove(lambda: result.append(1))
|
||||
await ent.async_remove()
|
||||
assert len(result) == 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue