From 0d277bd9eb06a6f80364b4f65aa30cfc8b3542a4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:37:44 +0000 Subject: [PATCH 1/2] Initial plan From 56b0250c5a5306038025f53ca6e47427a1e675da Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:45:04 +0000 Subject: [PATCH 2/2] fix: use hass.services.async_services() deferred via async_at_start for downloader conflict detection (v1.2.3) Co-authored-by: Geek-MD <25725990+Geek-MD@users.noreply.github.com> --- CHANGELOG.md | 8 ++++ .../advanced_downloader/__init__.py | 48 ++++++++++++------- .../advanced_downloader/manifest.json | 2 +- 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 220db1b..abddea7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 --- +## [1.2.3] - 2026-03-11 + +### Fixed +- **False-positive core Downloader conflict notification:** the check that detects whether the built-in `downloader` integration is active was incorrectly using `hass.config.components`, which can contain `"downloader"` even when `downloader:` is not present in `configuration.yaml` (HA may register available built-in integrations at boot). The check now inspects `hass.services.async_services()` instead, which only lists domains with registered services — a reliable indicator that `async_setup()` was actually called for that integration. Additionally, the check is now deferred until after HA has fully started (via `hass.async_at_start()`) to guarantee all YAML-configured integrations have had a chance to register their services before the conflict detection runs. + +--- + ## [1.2.2] - 2026-03-10 ### Fixed @@ -215,6 +222,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Service `media_downloader.download_file` with optional subdirectories, custom filenames, overwrite control, and per-download timeout. - Events: `media_downloader_download_started`, `media_downloader_download_completed` (with `success` and `error` fields). +[1.2.3]: https://github.com/Geek-MD/Advanced_Downloader/compare/v1.2.2...v1.2.3 [1.2.2]: https://github.com/Geek-MD/Advanced_Downloader/compare/v1.2.1...v1.2.2 [1.2.1]: https://github.com/Geek-MD/Advanced_Downloader/compare/v1.2.0...v1.2.1 [1.2.0]: https://github.com/Geek-MD/Advanced_Downloader/compare/v1.1.6...v1.2.0 diff --git a/custom_components/advanced_downloader/__init__.py b/custom_components/advanced_downloader/__init__.py index 2c9c9e1..942ed86 100644 --- a/custom_components/advanced_downloader/__init__.py +++ b/custom_components/advanced_downloader/__init__.py @@ -74,24 +74,36 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: # Warn if the core "downloader" integration is loaded (configured via # configuration.yaml). Advanced Downloader is a full superset of its # functionality; having both active serves no purpose and may cause confusion. - if "downloader" in hass.config.components: - _LOGGER.warning( - "The built-in 'downloader' integration is active alongside Advanced " - "Downloader. Remove 'downloader:' from your configuration.yaml and " - "restart Home Assistant to avoid redundancy." - ) - _pn.async_create( - hass, - ( - "The built-in **Downloader** integration is loaded in your " - "configuration. **Advanced Downloader** provides a full superset of " - "its functionality.\n\n" - "To avoid redundancy, remove `downloader:` from your " - "`configuration.yaml` and restart Home Assistant." - ), - title="Advanced Downloader: Remove core Downloader integration", - notification_id="advanced_downloader_core_downloader_conflict", - ) + # + # The check is deferred until HA has fully started so that all YAML-configured + # integrations have had a chance to register their services. We test for a + # registered service rather than inspecting hass.config.components, because + # hass.config.components may contain "downloader" even when the integration is + # not explicitly configured (e.g. available built-in integrations are scanned + # at boot). A service is only registered after a successful async_setup(), so + # this is a reliable indicator that downloader: is present in configuration.yaml. + @callback + def _check_downloader_conflict(_: HomeAssistant) -> None: + if "downloader" in hass.services.async_services(): + _LOGGER.warning( + "The built-in 'downloader' integration is active alongside Advanced " + "Downloader. Remove 'downloader:' from your configuration.yaml and " + "restart Home Assistant to avoid redundancy." + ) + _pn.async_create( + hass, + ( + "The built-in **Downloader** integration is loaded in your " + "configuration. **Advanced Downloader** provides a full superset of " + "its functionality.\n\n" + "To avoid redundancy, remove `downloader:` from your " + "`configuration.yaml` and restart Home Assistant." + ), + title="Advanced Downloader: Remove core Downloader integration", + notification_id="advanced_downloader_core_downloader_conflict", + ) + + hass.async_at_start(_check_downloader_conflict) # Warn if Video Normalizer is also configured as a standalone integration. # Its code must remain installed (Advanced Downloader imports from it), but diff --git a/custom_components/advanced_downloader/manifest.json b/custom_components/advanced_downloader/manifest.json index 2b11233..ada4d78 100644 --- a/custom_components/advanced_downloader/manifest.json +++ b/custom_components/advanced_downloader/manifest.json @@ -9,5 +9,5 @@ "issue_tracker": "https://github.com/Geek-MD/Advanced_Downloader/issues", "quality_scale": "legacy", "requirements": [], - "version": "1.2.2" + "version": "1.2.3" }