Fix location fetch: use numeric LocationRefreshMode enum (Google API change)#132
Conversation
Google's kidsmanagement location endpoint no longer accepts the string
values "REFRESH" / "DO_NOT_REFRESH" for locationRefreshMode and now
returns HTTP 400 ("Invalid value at 'location_refresh_mode'"). This
breaks all location fetches, leaving device_tracker stuck on the last
value that succeeded before the API change.
Switch to the numeric enum values Google now expects (2 = REFRESH,
1 = DO_NOT_REFRESH), verified returning HTTP 200 against the live API.
Version must not be hand-edited — it is bumped automatically by the release workflow on GitHub Release publish. The PR branch carried a manual bump; keep only the api.py location fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141zVauypPjLPy5N2rUCw2J
|
Thanks a lot for this @miditt - excellent diagnosis and a very clean fix. 🙏 Confirmed on my side: Google's kidsmanagement location endpoint now rejects the string LocationRefreshMode values and only accepts the numeric enum. The failure mode was exactly as you described - async_get_location returns None on the 400, so the device_tracker silently froze on the last known position with nothing surfaced to the user. Nasty one to catch. Merged into main. I only dropped the manual manifest.json version bump (1.2.11) from the branch, since the version is bumped automatically by the release workflow when I cut a GitHub Release - the API fix itself went in untouched. This will ship in the next release. Thanks again for testing it against the live API and reporting the before/after so clearly! 🚀 |
Google's kidsmanagement location endpoint now rejects the string values "REFRESH"/"DO_NOT_REFRESH" with HTTP 400 and requires the numeric enum values (2=REFRESH, 1=DO_NOT_REFRESH). Without this the device_tracker silently froze on the last known position. Thanks to @miditt for the fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Version must not be hand-edited — it is bumped automatically by the release workflow on GitHub Release publish. The PR branch carried a manual bump; keep only the api.py location fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Problem
Google's
kidsmanagementlocation endpoint no longer accepts the string values"REFRESH"/"DO_NOT_REFRESH"forlocationRefreshMode. Requests now fail with:Because
async_get_locationreturnsNoneon a non-200 response, thedevice_trackersilently freezes on the last position that succeeded before Google's change — no error surfaced to the user, just a stale location.Fix
Google now requires the numeric enum values. Switched to
2(REFRESH) /1(DO_NOT_REFRESH), both verified returning HTTP 200 against the live API. Added named class constants with an explanatory comment.Testing
Reproduced the 400 with the string value and confirmed 200 + a fresh GPS fix with the numeric value, against a live supervised account. Deployed to a running HA instance;
device_trackerlocation resumed updating immediately.