Fix Play/Stop Sound: accept and forward the cache kwarg (TypeError on every press) - #215
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)#215Conversation
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.
|
Thanks for tracking this down, and for including the exact log lines. I verified the report The bug is real on
|
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.