From 2237d39b37f2bf5aa4cb3023ca3daf19af03078b Mon Sep 17 00:00:00 2001 From: Anatole ACQUEBERGE Date: Sun, 23 Aug 2026 21:45:40 +0200 Subject: [PATCH] Fix: accept and forward cache kwarg in play/stop sound submitters GoogleFindMyAPI.async_play_sound / async_stop_sound call async_submit_start_sound_request(... cache=self._cache) and async_submit_stop_sound_request(... cache=self._cache), but these functions did not accept a cache parameter, raising TypeError: ... got an unexpected keyword argument 'cache' on every Play Sound button press and triggering a 90s push cooldown. Add cache: Optional[any] = None to both submitters and forward it to async_nova_request(...) (which already accepts it), matching the existing device-list path. Forwarding the entry-scoped cache also ensures the correct account tokens are used in multi-account setups. --- .../NovaApi/ExecuteAction/PlaySound/start_sound_request.py | 3 ++- .../NovaApi/ExecuteAction/PlaySound/stop_sound_request.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/custom_components/googlefindmy/NovaApi/ExecuteAction/PlaySound/start_sound_request.py b/custom_components/googlefindmy/NovaApi/ExecuteAction/PlaySound/start_sound_request.py index 84bfdc9ed..a830f3071 100644 --- a/custom_components/googlefindmy/NovaApi/ExecuteAction/PlaySound/start_sound_request.py +++ b/custom_components/googlefindmy/NovaApi/ExecuteAction/PlaySound/start_sound_request.py @@ -50,6 +50,7 @@ async def async_submit_start_sound_request( gcm_registration_id: str, *, session: Optional[ClientSession] = None, + cache: Optional[any] = None, ) -> Optional[tuple[str, str]]: """Submit a 'Play Sound' action using the shared async Nova client. @@ -70,7 +71,7 @@ async def async_submit_start_sound_request( hex_payload, request_uuid = start_sound_request(canonic_device_id, gcm_registration_id) try: # The async Nova client manages session reuse internally; do not pass session through. - response_hex = await async_nova_request(NOVA_ACTION_API_SCOPE, hex_payload) + response_hex = await async_nova_request(NOVA_ACTION_API_SCOPE, hex_payload, cache=cache) return (response_hex, request_uuid) if response_hex is not None else None except asyncio.CancelledError: raise diff --git a/custom_components/googlefindmy/NovaApi/ExecuteAction/PlaySound/stop_sound_request.py b/custom_components/googlefindmy/NovaApi/ExecuteAction/PlaySound/stop_sound_request.py index 37b668862..aec6cacc0 100644 --- a/custom_components/googlefindmy/NovaApi/ExecuteAction/PlaySound/stop_sound_request.py +++ b/custom_components/googlefindmy/NovaApi/ExecuteAction/PlaySound/stop_sound_request.py @@ -49,6 +49,7 @@ async def async_submit_stop_sound_request( *, request_uuid: Optional[str] = None, session: Optional[ClientSession] = None, + cache: Optional[any] = None, ) -> Optional[str]: """Submit a 'Stop Sound' action using the shared async Nova client. @@ -71,7 +72,7 @@ async def async_submit_stop_sound_request( hex_payload = stop_sound_request(canonic_device_id, gcm_registration_id, request_uuid) try: # The async Nova client manages session reuse internally; do not pass session through. - return await async_nova_request(NOVA_ACTION_API_SCOPE, hex_payload) + return await async_nova_request(NOVA_ACTION_API_SCOPE, hex_payload, cache=cache) except asyncio.CancelledError: raise except NovaRateLimitError: