Add Home Automation capability#217
Conversation
|
Also tested this manually against a local Home Assistant instance using Gemma via llama.cpp. Prompt: “turn off the computer room light” The agent flow was:
The physical light turned off and the backend returned a verified post-call state. |
| import asyncio | ||
| from typing import Any | ||
|
|
||
| import httpx |
There was a problem hiding this comment.
🚩 httpx is used but not declared as a direct dependency
The _backend.py module imports httpx directly at line 4, and the HomeAssistantBackend.__init__ constructs httpx.AsyncClient instances. However, httpx is not listed in pyproject.toml dependencies — it's only available transitively through pydantic-ai-slim. If pydantic-ai-slim ever makes httpx optional, this module would break at import time. Consider adding a home-automation optional dependency extra (similar to the code-mode extra for pydantic-monty) that includes httpx.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Adds a Home Automation capability backed by a Home Assistant REST API adapter.
This includes:
HomeAutomationcapability andHomeAutomationToolsetexposing service discovery, entity/state inspection, and service calls to agents./api/servicesand/api/statesresponses with Pydantic models, caches the service catalog, handlesreturn_responseservice calls, and verifies service-call outcomes with changed states or follow-up state polling.Linked Issue
Fixes #125
Checklist
make lint && make typecheck && make testpasses locally (don't stress about CI -- we'll help)pyproject.tomloruv.lock(dependency changes require a separate issue)Local validation run:
make lintmake typecheckmake testcov(123 passed,100%coverage)