EntityComponent: revert warning (#10078)

* Add warning back

* fix lint
This commit is contained in:
Pascal Vizeli 2017-10-23 17:39:50 +02:00 committed by GitHub
parent 0b850b555f
commit b292a4af3f
1 changed files with 6 additions and 0 deletions

View File

@ -370,6 +370,12 @@ class EntityPlatform(object):
def add_entities(self, new_entities, update_before_add=False):
"""Add entities for a single platform."""
# That avoid deadlocks
if update_before_add:
self.component.logger.warning(
"Call 'add_entities' with update_before_add=True "
"only inside tests or you can run into a deadlock!")
run_coroutine_threadsafe(
self.async_add_entities(list(new_entities), update_before_add),
self.component.hass.loop).result()