fix: housekeeper API paths and entity hallucination prevention
Build and Push / build (release) Successful in 56s

- Update all client endpoints to use /housekeeping/ prefix
- Add critical rule requiring list_devices() before control actions
- Add housekeeping API spec documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-17 20:43:46 +01:00
co-authored by Claude Opus 4.5
parent 583c407edd
commit e5d50dda77
5 changed files with 366 additions and 24 deletions
+14 -14
View File
@@ -182,7 +182,7 @@ class CoreAPIClient:
logger.debug("core_api_list_devices", domain=domain, area=area)
response = await client.get("/devices", params=params or None)
response = await client.get("/housekeeping/devices", params=params or None)
response.raise_for_status()
data = response.json()
@@ -199,7 +199,7 @@ class CoreAPIClient:
logger.debug("core_api_list_areas")
response = await client.get("/areas")
response = await client.get("/housekeeping/areas")
response.raise_for_status()
data = response.json()
@@ -219,7 +219,7 @@ class CoreAPIClient:
logger.debug("core_api_get_state", entity_id=entity_id)
response = await client.get(f"/entities/{entity_id}")
response = await client.get(f"/housekeeping/devices/{entity_id}")
response.raise_for_status()
return DeviceState(**response.json())
@@ -260,7 +260,7 @@ class CoreAPIClient:
logger.info("core_api_turn_on", entity_id=entity_id, payload=payload)
response = await client.post(
f"/devices/{entity_id}/control",
f"/housekeeping/devices/{entity_id}/control",
json=payload,
)
response.raise_for_status()
@@ -288,7 +288,7 @@ class CoreAPIClient:
logger.info("core_api_turn_off", entity_id=entity_id)
response = await client.post(
f"/devices/{entity_id}/control",
f"/housekeeping/devices/{entity_id}/control",
json={"action": "turn_off"},
)
response.raise_for_status()
@@ -316,7 +316,7 @@ class CoreAPIClient:
logger.info("core_api_toggle", entity_id=entity_id)
response = await client.post(
f"/devices/{entity_id}/control",
f"/housekeeping/devices/{entity_id}/control",
json={"action": "toggle"},
)
response.raise_for_status()
@@ -344,7 +344,7 @@ class CoreAPIClient:
logger.debug("core_api_list_scenes")
response = await client.get("/scenes")
response = await client.get("/housekeeping/scenes")
response.raise_for_status()
data = response.json()
@@ -364,7 +364,7 @@ class CoreAPIClient:
logger.info("core_api_activate_scene", scene_id=scene_id)
response = await client.post(f"/scenes/{scene_id}/activate")
response = await client.post(f"/housekeeping/scenes/{scene_id}/activate")
response.raise_for_status()
data = response.json()
@@ -390,7 +390,7 @@ class CoreAPIClient:
logger.debug("core_api_list_scripts")
response = await client.get("/scripts")
response = await client.get("/housekeeping/scripts")
response.raise_for_status()
data = response.json()
@@ -420,7 +420,7 @@ class CoreAPIClient:
logger.info("core_api_run_script", script_id=script_id)
response = await client.post(
f"/scripts/{script_id}/run",
f"/housekeeping/scripts/{script_id}/run",
json=payload or None,
)
response.raise_for_status()
@@ -448,7 +448,7 @@ class CoreAPIClient:
logger.debug("core_api_list_automations")
response = await client.get("/automations")
response = await client.get("/housekeeping/automations")
response.raise_for_status()
data = response.json()
@@ -478,7 +478,7 @@ class CoreAPIClient:
)
response = await client.post(
f"/automations/{automation_id}/toggle",
f"/housekeeping/automations/{automation_id}/toggle",
json={"enable": enable},
)
response.raise_for_status()
@@ -515,7 +515,7 @@ class CoreAPIClient:
logger.debug("core_api_get_history", entity_id=entity_id, hours=hours)
response = await client.get(
"/history",
"/housekeeping/history",
params={"entity_id": entity_id, "hours": hours},
)
response.raise_for_status()
@@ -536,7 +536,7 @@ class CoreAPIClient:
"""
try:
client = self._ensure_client()
response = await client.get("/health")
response = await client.get("/housekeeping/health")
return response.status_code == 200
except Exception as e:
logger.warning("core_api_health_check_failed", error=str(e))