diff --git a/homeassistant/setup.py b/homeassistant/setup.py index e3a520fff0ed9..285a575514513 100644 --- a/homeassistant/setup.py +++ b/homeassistant/setup.py @@ -3,6 +3,7 @@ import logging import logging.handlers import os +from timeit import default_timer as timer from types import ModuleType from typing import Optional, Dict @@ -175,6 +176,7 @@ def log_error(msg, link=True): async_comp = hasattr(component, 'async_setup') + start = timer() _LOGGER.info("Setting up %s", domain) warn_task = hass.loop.call_later( SLOW_SETUP_WARNING, _LOGGER.warning, @@ -191,7 +193,9 @@ def log_error(msg, link=True): async_notify_setup_error(hass, domain, True) return False finally: + end = timer() warn_task.cancel() + _LOGGER.info("Setup of domain %s took %.1f seconds.", domain, end - start) if result is False: log_error("Component failed to initialize.")