diff --git a/aiohasupervisor/root.py b/aiohasupervisor/root.py index 6f01456..af316a4 100644 --- a/aiohasupervisor/root.py +++ b/aiohasupervisor/root.py @@ -109,8 +109,19 @@ async def info(self) -> RootInfo: result = await self._client.get("info") return RootInfo.from_dict(result.data) + async def reload_updates(self) -> None: + """Reload updates. + + Reload main components update information (OS, Supervisor, Core and plug-ins). + """ + await self._client.post("reload_updates", timeout=ClientTimeout(total=300)) + async def refresh_updates(self) -> None: - """Refresh updates.""" + """Refresh updates. + + Discouraged as this endpoint does two things at once. Use the `reload_updates()` + and `store.reload()` instead. + """ await self._client.post("refresh_updates", timeout=ClientTimeout(total=300)) async def available_updates(self) -> list[AvailableUpdate]: diff --git a/tests/test_root.py b/tests/test_root.py index eb2cd69..1b31d66 100644 --- a/tests/test_root.py +++ b/tests/test_root.py @@ -88,6 +88,17 @@ async def test_available_updates( assert updates[1].update_type == UpdateType.OS +async def test_reload_updates( + responses: aioresponses, supervisor_client: SupervisorClient +) -> None: + """Test reload updates API.""" + responses.post(f"{SUPERVISOR_URL}/reload_updates", status=200) + assert await supervisor_client.reload_updates() is None + assert responses.requests.keys() == { + ("POST", URL(f"{SUPERVISOR_URL}/reload_updates")) + } + + async def test_refresh_updates( responses: aioresponses, supervisor_client: SupervisorClient ) -> None: