Stop forcing the Blink refresh on every poll (#182639)

Co-authored-by: Dex <Dextheking1@users.noreply.github.com>
This commit is contained in:
Dex
2026-09-19 09:19:58 +02:00
committed by GitHub
co-authored by Dex
parent 6bc9bf89f7
commit fc2e36525f
2 changed files with 29 additions and 1 deletions
@@ -62,6 +62,11 @@ class BlinkUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
async def _async_update_data(self) -> dict[str, Any]:
"""Async update wrapper."""
try:
return await self.api.refresh(force=True)
# Do not force the refresh. BlinkPy turns a forced refresh into
# force_cache=True, which makes every sync module re-download media
# it already has, so cached clips are fetched again on every poll.
# The scan interval is far longer than BlinkPy's refresh rate, so a
# normal refresh still happens on schedule.
return await self.api.refresh()
except UnauthorizedError as ex:
raise ConfigEntryAuthFailed("Blink API authorization failed") from ex
+23
View File
@@ -76,6 +76,29 @@ async def test_unload_entry(
assert hass.services.has_service(DOMAIN, SERVICE_SAVE_VIDEO)
async def test_scheduled_refresh_is_not_forced(
hass: HomeAssistant,
mock_blink_api: MagicMock,
mock_blink_auth_api: MagicMock,
mock_config_entry: MockConfigEntry,
) -> None:
"""Test a scheduled poll does not force a cache refresh.
BlinkPy propagates a forced refresh as ``force_cache=True`` to the sync
modules, which re-downloads media that is already cached. See #182552.
"""
mock_config_entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()
mock_blink_api.refresh.reset_mock()
coordinator = mock_config_entry.runtime_data
await coordinator.async_refresh()
await hass.async_block_till_done()
mock_blink_api.refresh.assert_awaited_once_with()
async def test_migrate_V0(
hass: HomeAssistant,
mock_blink_api: MagicMock,