mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Bugfix empty entity lists (#15035)
* Bugfix empty entity lists * Add tests * Update test_entity_platform.py * Update entity_platform.py
This commit is contained in:
parent
f9a21dbfda
commit
62f970e486
@ -216,6 +216,10 @@ class EntityPlatform(object):
|
||||
component_entities, registry)
|
||||
for entity in new_entities]
|
||||
|
||||
# No entities for processing
|
||||
if not tasks:
|
||||
return
|
||||
|
||||
await asyncio.wait(tasks, loop=self.hass.loop)
|
||||
self.async_entities_added_callback()
|
||||
|
||||
|
@ -592,3 +592,13 @@ async def test_reset_cancels_retry_setup(hass):
|
||||
|
||||
assert len(mock_call_later.return_value.mock_calls) == 1
|
||||
assert ent_platform._async_cancel_retry_setup is None
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_not_fails_with_adding_empty_entities_(hass):
|
||||
"""Test for not fails on empty entities list."""
|
||||
component = EntityComponent(_LOGGER, DOMAIN, hass)
|
||||
|
||||
yield from component.async_add_entities([])
|
||||
|
||||
assert len(hass.states.async_entity_ids()) == 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user