Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to exclude dependencies in config #2

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion homeassistant/setup.py
Expand Up @@ -151,7 +151,7 @@ async def _async_process_dependencies(
)

failed = [
domain for idx, domain in enumerate(dependencies_tasks) if not results[idx]
domain for idx, domain in enumerate(dependencies_tasks) if not results[idx] and not _is_excluded_by_config(domain, config)
]

if failed:
Expand All @@ -164,6 +164,12 @@ async def _async_process_dependencies(
return failed


def _is_excluded_by_config(name, config) -> bool:
for itg in config:
if "exclude" in config[itg]:
if name in config[itg]["exclude"]:
return True

async def _async_setup_component(
hass: core.HomeAssistant, domain: str, config: ConfigType
) -> bool:
Expand All @@ -190,6 +196,10 @@ def log_error(msg: str) -> None:
log_error("Integration not found.")
return False

if _is_excluded_by_config(integration.domain, config):
_LOGGER.warn(f"Dependency is excluded - {integration.domain}")
return False

if integration.disabled:
log_error(f"Dependency is disabled - {integration.disabled}")
return False
Expand Down