home-automation
Integrate smart homes with Home Assistant, HomeKit, Google Home, Matter.
What this skill does
# home-automation
## Purpose
This skill integrates smart home systems using Home Assistant, HomeKit, Google Home, and Matter protocols, allowing the AI to control IoT devices programmatically for automation tasks.
## When to Use
Use this skill for automating home environments, such as controlling lights, thermostats, or security systems via IoT platforms. Apply it in scenarios like smart home apps, voice assistant integrations, or custom scripts for daily routines (e.g., turning off lights at bedtime).
## Key Capabilities
- Connect to Home Assistant via REST API for device state management.
- Integrate with HomeKit using the HAP protocol for Apple ecosystem devices.
- Use Google Home APIs for controlling compatible smart devices.
- Handle Matter devices through bridge APIs for cross-platform compatibility.
- Specifics: Home Assistant API endpoint for states is `GET /api/states`; HomeKit requires Bonjour discovery; Google Home uses OAuth 2.0 with scopes like `https://www.googleapis.com/auth/homeautomation`; Matter involves IP-based commissioning.
## Usage Patterns
To use this skill, first initialize it with authentication. Import via `skill.use('home-automation')`, then call methods like `skill.connect(service, key)`. For sequential tasks, chain calls: connect, query state, execute action. Always handle async operations with promises or callbacks. Config format: JSON objects, e.g., `{"service": "home-assistant", "api_url": "http://localhost:8123"}`.
## Common Commands/API
- CLI: Run `openclaw home-automation connect --service home-assistant --api-url http://localhost:8123 --key $HOME_ASSISTANT_API_KEY` to establish a connection.
- API: Use `POST /api/services` for Home Assistant actions; example endpoint for Google Home: `GET https://homegraph.googleapis.com/v1/devices`.
- Code snippets:
```skill
skill.use('home-automation')
skill.connect('home-assistant', { apiUrl: 'http://localhost:8123', key: process.env.HOME_ASSISTANT_API_KEY })
```
```skill
const state = await skill.call('getState', { entity: 'light.living_room' })
console.log(state)
```
```skill
skill.execute('turnOn', { device: 'light.kitchen', service: 'homekit' })
```
Use env vars for keys: `$HOME_ASSISTANT_API_KEY` for Home Assistant, `$GOOGLE_HOME_TOKEN` for Google Home.
## Integration Notes
Authenticate using env vars (e.g., `$HOME_ASSISTANT_API_KEY`) before operations. For HomeKit, ensure devices are paired via the Home app; use HAP-NodeJS library for custom integrations. Google Home requires OAuth flow—redirect to `https://accounts.google.com/o/oauth2/v2/auth`. Matter integration needs a compatible bridge; config format: YAML like `matter: { bridge_ip: '192.168.1.100', port: 5540 }`. Avoid mixing protocols in one call; use wrappers for error-free transitions between services.
## Error Handling
Check for HTTP errors (e.g., 401 Unauthorized) by wrapping calls in try-catch blocks. For authentication failures, retry with refreshed tokens. Common errors: API rate limits (e.g., Home Assistant returns 429); handle with exponential backoff. Code snippet:
```skill
try {
await skill.call('getState', { entity: 'light.living_room' })
} catch (error) {
if (error.code === 401) console.error('Reauthenticate with $HOME_ASSISTANT_API_KEY')
else throw error
}
```
Log detailed responses and use skill-specific error codes for debugging.
## Concrete Usage Examples
1. Automate lights based on time: Use `skill.connect('home-assistant', { key: process.env.HOME_ASSISTANT_API_KEY })`, then `skill.execute('turnOff', { entity: 'light.all' })` in a scheduled script to turn off all lights at 11 PM.
2. Integrate with Google Home for temperature control: Call `skill.use('home-automation').connect('google-home', { token: process.env.GOOGLE_HOME_TOKEN })`, followed by `skill.call('setThermostat', { deviceId: 'thermostat.living_room', temperature: 72 })` to adjust the thermostat.
## Graph Relationships
- Cluster: Connected to 'iot' cluster for broader IoT integrations.
- Tags: Links to skills with 'iot' and 'home' tags, such as device-control or smart-security skills.
- Relationships: This skill depends on authentication services; it integrates with external APIs like Home Assistant's REST endpoints and Google Home's OAuth flows.
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.