Casa: HomeKit REST API & CLI for Mac Automation
Casa: Local HomeKit REST API & CLI for Mac automation, AI agents, and smart home scripting—privacy-first, no cloud required.
Originally published:
Purpose and Significance
Casa is a Mac Catalyst application that bridges HomeKit and automation by exposing your local HomeKit data through a REST API and command-line interface. Designed for developers, automation engineers, and power users, Casa creates a fast, reliable localhost-only gateway into HomeKit without requiring remote cloud access or complex integrations. It fills a critical gap for those building home automation workflows, AI agents, and scripts that need programmatic HomeKit control on macOS.
Key Features
- Local-only REST API — Binds exclusively to 127.0.0.1 (loopback), ensuring zero remote exposure and maximum privacy for home automation
- HomeKit module opt-in — Requires explicit user permission; stays disabled by default until activated in settings
- Embedded CLI — Swift-based command-line tool built directly into the app for scriptable automation and one-off queries
- Comprehensive HomeKit access — Browse and control accessories, rooms, services, characteristics, and cameras through a single interface
- Authentication support — Optional token-based auth via X-Casa-Token header for script-to-API communication
- Minimal setup overhead — Works with existing Home app data; onboarding guides users through permissions and CLI installation
- Automatic updates — Sparkle framework integration for seamless app versioning and distribution
Getting Started
For development: Clone the repository, open Casa.xcodeproj in Xcode, configure your Team ID, enable the HomeKit capability, and build. The app includes a comprehensive onboarding flow that walks you through permission grants and optional CLI installation.
For usage: The REST API defaults to http://127.0.0.1:14663. Query endpoints like GET /homekit/accessories, GET /homekit/rooms, or PUT /homekit/characteristics/:id to read and control HomeKit state. Use the CLI with commands like casa devices, casa rooms, or casa characteristics set for terminal-based automation.
API and CLI Overview
Casa exposes a RESTful interface covering the full HomeKit object model. Core endpoints include health checks, accessory queries, room and service browsing, characteristic read/write operations, and camera streaming. The embedded CLI mirrors these capabilities with human-friendly commands, supporting environment variable configuration for custom URLs and tokens—ideal for shell scripts, cron jobs, and automation frameworks.
Who It's For
- Home automation developers building custom workflows or integrations with HomeKit
- AI agents and LLMs needing structured, low-latency access to smart home state
- Power users and sysadmins creating shell scripts, cron jobs, or command-line automation
- Open-source contributors extending HomeKit tooling in the Swift ecosystem
- Security-conscious teams requiring local-only smart home APIs without cloud intermediaries
Technical Stack
Casa is written in Swift with a macOS/Mac Catalyst foundation, leveraging native HomeKit entitlements and frameworks. The project includes Xcode project configuration, automated build scripts, GitHub Actions workflows, and Sparkle-based distribution infrastructure. SwiftLint enforces code quality standards across the codebase.
Common Use Cases
Scripting and automation: Query room status, control lights, or trigger scenes from shell scripts. Agent integration: Feed HomeKit state to LLM-powered agents for voice control or intelligent automation. REST bridge: Expose HomeKit to Python, Node.js, or other languages via HTTP. Monitoring: Poll characteristic changes and log or alert on state transitions.
Development and Contribution
The repository is actively maintained with clear build instructions, troubleshooting guidance, and environment variable documentation. Contributors can extend Casa by adding new API endpoints, CLI commands, or HomeKit feature support. The project uses standard Git workflows with pull requests and issue tracking.
Resources
- GitHub Repository: Full source code, issue tracker, and security policy
- AGENTS.md: Documentation and examples for AI agent integration
- README: Quick start, API reference, CLI examples, and troubleshooting
- Build Scripts: Automated restart-mac.sh for streamlined development builds
Source: OpenClaw project repository on GitHub. Last updated February 2026.
Original Source
https://github.com/openclaw/casa
Last updated: