Allow changing entity ID (#15637)

* Allow changing entity ID

* Add support to websocket command

* Address comments

* Error handling
This commit is contained in:
Paulus Schoutsen 2018-07-24 14:12:53 +02:00 committed by GitHub
parent fbeaa57604
commit d9cf8fcfe8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 206 additions and 22 deletions

View file

@ -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