This commit is contained in:
Mateusz Gruszczyński
2026-09-04 11:00:15 +02:00
parent 8152e63d63
commit 236540e0f0
27 changed files with 557 additions and 102 deletions
@@ -60,6 +60,19 @@ class GreeControllerClient:
"""Return the public controller health payload."""
return await self._request("GET", "/api/health")
async def snapshot(self) -> dict[str, Any]:
"""Return devices, groups and the control plan in one restricted request."""
data = await self._request("GET", "/api/integrations/home-assistant/snapshot")
if not isinstance(data, dict):
raise GreeControllerApiError("Controller returned an invalid snapshot payload")
if not isinstance(data.get("devices"), list):
raise GreeControllerApiError("Controller returned invalid snapshot devices")
if not isinstance(data.get("control_plan"), dict):
raise GreeControllerApiError("Controller returned an invalid snapshot control plan")
if not isinstance(data.get("groups"), list):
raise GreeControllerApiError("Controller returned invalid snapshot groups")
return data
async def devices(self) -> list[dict[str, Any]]:
"""Return all controller devices."""
data = await self._request("GET", "/api/integrations/home-assistant/devices")