diff --git a/esphome/components/mqtt/__init__.py b/esphome/components/mqtt/__init__.py index 98096f0689..5ec1ddb6e3 100644 --- a/esphome/components/mqtt/__init__.py +++ b/esphome/components/mqtt/__init__.py @@ -49,11 +49,12 @@ from esphome.const import ( ) from esphome.core import CORE, coroutine_with_priority -DEPENDENCIES = ["network"] -# required for WifiSecureClient to have current time to validate the certificate -if CORE.is_esp8266: - DEPENDENCIES.append("time") +def DEPENDENCIES(): + if CORE.is_esp8266: + # required for WifiSecureClient to have current time to validate the certificate + return ["network", "time"] + return ["network"] def AUTO_LOAD(): diff --git a/esphome/loader.py b/esphome/loader.py index d808805119..c3d5ea983c 100644 --- a/esphome/loader.py +++ b/esphome/loader.py @@ -70,7 +70,10 @@ class ComponentManifest: @property def dependencies(self) -> list[str]: - return getattr(self.module, "DEPENDENCIES", []) + dep = getattr(self.module, "DEPENDENCIES", []) + if callable(dep): + return dep() + return dep @property def conflicts_with(self) -> list[str]: