From b292a4af3f28c8c8109336ff8e347164e78bb2c1 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 23 Oct 2017 17:39:50 +0200 Subject: [PATCH] EntityComponent: revert warning (#10078) * Add warning back * fix lint --- homeassistant/helpers/entity_component.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/homeassistant/helpers/entity_component.py b/homeassistant/helpers/entity_component.py index f6e9c1da7f8..e805f277483 100644 --- a/homeassistant/helpers/entity_component.py +++ b/homeassistant/helpers/entity_component.py @@ -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()