From 661903a290d653962bd6d119af1688ea670961ad Mon Sep 17 00:00:00 2001 From: Michael Shaffer Date: Thu, 1 Oct 2026 14:28:24 -0400 Subject: [PATCH 1/2] refactor: update Android Management API client to prefer live discovery document - Removed outdated pip dependency from dependabot configuration. - Enhanced the Android Management API client to fall back to a bundled discovery document if the live document cannot be fetched. - Updated `google-api-python-client` version in the manifest to 2.71.0 for compatibility improvements. --- .github/dependabot.yml | 5 ---- .../android_management_api/api.py | 30 +++++++++++++++---- .../android_management_api/manifest.json | 2 +- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9ea3f1a..8f45221 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,11 +2,6 @@ version: 2 updates: - - package-ecosystem: "pip" - directory: "/custom_components/hyperhdr" - schedule: - interval: "weekly" - - package-ecosystem: "github-actions" directory: "/" schedule: diff --git a/custom_components/android_management_api/api.py b/custom_components/android_management_api/api.py index 12e8b78..2ba9688 100644 --- a/custom_components/android_management_api/api.py +++ b/custom_components/android_management_api/api.py @@ -44,12 +44,30 @@ def _build_service(self): else: raise ValueError("No credentials provided") - return build( - "androidmanagement", - "v1", - credentials=creds, - cache_discovery=False, - ) + # The library version is pinned to match Home Assistant core, so its bundled + # discovery document can lag the live API (e.g. missing enum values like + # WIPE_ESIMS). Prefer the live document; fall back to the bundled one. + try: + return build( + "androidmanagement", + "v1", + credentials=creds, + cache_discovery=False, + static_discovery=False, + ) + except Exception as err: # noqa: BLE001 + _LOGGER.warning( + "Could not fetch live Android Management API discovery document, " + "using bundled copy: %s", + err, + ) + return build( + "androidmanagement", + "v1", + credentials=creds, + cache_discovery=False, + static_discovery=True, + ) def _execute_request(self, request, max_retries: int = 3): """Execute a Google API request with retries for transient SSL/network errors.""" diff --git a/custom_components/android_management_api/manifest.json b/custom_components/android_management_api/manifest.json index 349c6ea..8b7fe56 100644 --- a/custom_components/android_management_api/manifest.json +++ b/custom_components/android_management_api/manifest.json @@ -12,7 +12,7 @@ "android_management_api" ], "requirements": [ - "google-api-python-client==2.198.0", + "google-api-python-client==2.71.0", "google-auth==2.56.0", "qrcode==8.0" ], From bb0a16fd9869d42cb2828e274b0d12e0a6e19de6 Mon Sep 17 00:00:00 2001 From: Michael Shaffer Date: Thu, 1 Oct 2026 14:30:04 -0400 Subject: [PATCH 2/2] chore: update google-api-python-client dependency to allow newer versions - Changed the dependency specification for `google-api-python-client` from a fixed version to a minimum version requirement, allowing for updates beyond 2.71.0. --- custom_components/android_management_api/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/android_management_api/manifest.json b/custom_components/android_management_api/manifest.json index a022cd5..4397516 100644 --- a/custom_components/android_management_api/manifest.json +++ b/custom_components/android_management_api/manifest.json @@ -12,7 +12,7 @@ "android_management_api" ], "requirements": [ - "google-api-python-client==2.71.0", + "google-api-python-client>=2.71.0", "google-auth==2.56.0", "qrcode==8.0" ],