Fix Play/Stop Sound: accept and forward the cache kwarg (TypeError on every press) - #215
Open
totol123 wants to merge 1 commit into
Open
Fix Play/Stop Sound: accept and forward the cache kwarg (TypeError on every press)#215totol123 wants to merge 1 commit into
cache kwarg (TypeError on every press)#215totol123 wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Pressing any Play Sound (or Stop Sound) button does nothing. The log shows, on every press:
GoogleFindMyAPI.async_play_sound/async_stop_soundcall the submitters withcache=self._cache:async_submit_start_sound_request(device_id, token, session=self._session, cache=self._cache)async_submit_stop_sound_request(device_id, token, request_uuid=..., session=self._session, cache=self._cache)but
async_submit_start_sound_request/async_submit_stop_sound_requestdo not accept acacheparameter →TypeErroron every press. The resulting failure also enters a 90s push cooldown, which makes the buttons intermittently appear unavailable too.Fix
Add
cache: Optional[any] = Noneto both submitters and forward it toasync_nova_request(...), which already acceptscache. This mirrors the existing device-list path (async_request_device_list(..., cache=...)).Forwarding the entry-scoped cache also ensures the correct account's tokens are used in multi-account setups (reproduced with two Google accounts configured — without this, the sound action can resolve against the wrong cache).
Testing
With two config entries (two Google accounts), Play Sound now reliably rings the target Android phone. Verified via the device's
Émettre un sonbutton entity and via dashboardbutton.pressactions; theunexpected keyword argument 'cache'error and the spurious 90s push cooldown are both gone.Affected version: 1.6.2.3.