From 640c692e1ff2246a0fa6401ec9e4698bccca8edf Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 9 Jun 2017 03:11:58 -0700 Subject: [PATCH] Fix platforms being able to block startup (#7970) --- homeassistant/helpers/entity_component.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/helpers/entity_component.py b/homeassistant/helpers/entity_component.py index 58c12bf043e..08acfe66851 100644 --- a/homeassistant/helpers/entity_component.py +++ b/homeassistant/helpers/entity_component.py @@ -151,8 +151,10 @@ class EntityComponent(object): entity_platform.async_schedule_add_entities, discovery_info ) else: - task = self.hass.async_add_job( - platform.setup_platform, self.hass, platform_config, + # This should not be replaced with hass.async_add_job because + # we don't want to track this task in case it blocks startup. + task = self.hass.loop.run_in_executor( + None, platform.setup_platform, self.hass, platform_config, entity_platform.schedule_add_entities, discovery_info ) yield from asyncio.wait_for(