{"id":46125672,"url":"https://github.com/elvatis/openclaw-homeassistant","last_synced_at":"2026-03-02T02:01:01.821Z","repository":{"id":340362369,"uuid":"1164100192","full_name":"elvatis/openclaw-homeassistant","owner":"elvatis","description":"OpenClaw plugin: Control Home Assistant entities, scenes, and scripts via natural language.","archived":false,"fork":false,"pushed_at":"2026-02-27T19:50:40.000Z","size":371,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-27T20:31:08.526Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elvatis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-22T16:34:20.000Z","updated_at":"2026-02-27T19:50:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/elvatis/openclaw-homeassistant","commit_stats":null,"previous_names":["homeofe/openclaw-homeassistant","elvatis/openclaw-homeassistant"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/elvatis/openclaw-homeassistant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvatis%2Fopenclaw-homeassistant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvatis%2Fopenclaw-homeassistant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvatis%2Fopenclaw-homeassistant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvatis%2Fopenclaw-homeassistant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elvatis","download_url":"https://codeload.github.com/elvatis/openclaw-homeassistant/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvatis%2Fopenclaw-homeassistant/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29987827,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T22:42:38.399Z","status":"ssl_error","status_checked_at":"2026-03-01T22:41:51.863Z","response_time":124,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-03-02T02:00:40.676Z","updated_at":"2026-03-02T02:01:01.804Z","avatar_url":"https://github.com/elvatis.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @elvatis_com/openclaw-homeassistant\n\nOpenClaw plugin for Home Assistant - control devices, read sensors, trigger automations via AI.\n\n**34 tools** | **zero runtime dependencies** | **safety-first design**\n\n## Prerequisites\n\n- Node.js \u003e= 18.0.0\n- A running [Home Assistant](https://www.home-assistant.io/) instance (2023.1+)\n- A Home Assistant Long-Lived Access Token\n\n## Installation\n\n```bash\nnpm install @elvatis_com/openclaw-homeassistant\n```\n\n## Quick Start\n\n### 1. Create a Long-Lived Access Token\n\n1. Open your Home Assistant UI\n2. Navigate to your profile (click your name in the sidebar)\n3. Scroll down to **Long-Lived Access Tokens**\n4. Click **Create Token**, give it a name (e.g. \"OpenClaw\"), and copy the token\n\n### 2. Configure the Plugin\n\nAdd the plugin to your OpenClaw configuration:\n\n```json\n{\n  \"plugins\": {\n    \"openclaw-homeassistant\": {\n      \"url\": \"http://homeassistant.local:8123\",\n      \"token\": \"YOUR_LONG_LIVED_ACCESS_TOKEN\"\n    }\n  }\n}\n```\n\n### 3. (Optional) Add Safety Guards\n\nRestrict which domains the AI can access and/or enable read-only mode:\n\n```json\n{\n  \"plugins\": {\n    \"openclaw-homeassistant\": {\n      \"url\": \"http://homeassistant.local:8123\",\n      \"token\": \"YOUR_LONG_LIVED_ACCESS_TOKEN\",\n      \"allowedDomains\": [\"light\", \"switch\", \"sensor\", \"climate\"],\n      \"readOnly\": true\n    }\n  }\n}\n```\n\n## Configuration Reference\n\n| Option | Type | Required | Default | Description |\n|--------|------|----------|---------|-------------|\n| `url` | `string` | Yes | - | Home Assistant base URL (e.g. `http://homeassistant.local:8123`) |\n| `token` | `string` | Yes | - | Long-Lived Access Token from your HA profile |\n| `allowedDomains` | `string[]` | No | `[]` (all) | Restrict tools to these HA domains only |\n| `readOnly` | `boolean` | No | `false` | Block all write tools (service calls, events, notifications) |\n\n## Safety Model\n\nThis plugin implements three layers of safety:\n\n- **readOnly mode** - When enabled, all 22 write tools are blocked. Only read tools (status, list, get, search, history) remain available. Ideal for monitoring dashboards or untrusted agents.\n- **allowedDomains** - Restrict which HA domains the AI can interact with. For example, `[\"light\", \"sensor\"]` blocks access to switches, climate, media, covers, automations, and everything else.\n- **Entity ID validation** - Every entity ID is validated against the pattern `{domain}.{object_id}` (lowercase alphanumeric + underscores only). Malformed IDs are rejected before reaching Home Assistant.\n\n## Tool Reference\n\n### Status and Discovery\n\n| Tool | Description |\n|------|-------------|\n| `ha_status` | Get HA instance config (version, location, components) |\n| `ha_list_entities` | List entities with optional `domain`, `area`, `state` filters |\n| `ha_get_state` | Get state and attributes of a single entity |\n| `ha_search_entities` | Search entities by pattern (matches entity_id and friendly_name) |\n| `ha_list_services` | List all available services grouped by domain |\n\n### Lights\n\n| Tool | Description |\n|------|-------------|\n| `ha_light_on` | Turn on with optional `brightness` (0-255), `color_temp`, `rgb_color`, `transition` |\n| `ha_light_off` | Turn off a light |\n| `ha_light_toggle` | Toggle a light on/off |\n| `ha_light_list` | List all light entities with brightness and color info |\n\n### Switches\n\n| Tool | Description |\n|------|-------------|\n| `ha_switch_on` | Turn on a switch |\n| `ha_switch_off` | Turn off a switch |\n| `ha_switch_toggle` | Toggle a switch on/off |\n\n### Climate\n\n| Tool | Description |\n|------|-------------|\n| `ha_climate_set_temp` | Set target temperature |\n| `ha_climate_set_mode` | Set HVAC mode (heat, cool, auto, off) |\n| `ha_climate_set_preset` | Set preset mode (away, home, eco, boost) |\n| `ha_climate_list` | List all climate entities |\n\n### Media Player\n\n| Tool | Description |\n|------|-------------|\n| `ha_media_play` | Resume playback |\n| `ha_media_pause` | Pause playback |\n| `ha_media_stop` | Stop playback |\n| `ha_media_volume` | Set volume (0.0-1.0) |\n| `ha_media_play_media` | Play specific media (`content_id` + `content_type`) |\n\n### Covers\n\n| Tool | Description |\n|------|-------------|\n| `ha_cover_open` | Open a cover (blinds, garage door) |\n| `ha_cover_close` | Close a cover |\n| `ha_cover_position` | Set position (0 = closed, 100 = open) |\n\n### Scenes and Automations\n\n| Tool | Description |\n|------|-------------|\n| `ha_scene_activate` | Activate a scene |\n| `ha_script_run` | Run a script with optional `variables` |\n| `ha_automation_trigger` | Trigger an automation (optional `skip_condition`) |\n\n### Sensors and History\n\n| Tool | Description |\n|------|-------------|\n| `ha_sensor_list` | List all sensor entities with current values |\n| `ha_history` | Get state history (defaults to last 24 hours) |\n| `ha_logbook` | Get logbook entries (defaults to last 24 hours) |\n\n### Generic and Advanced\n\n| Tool | Description |\n|------|-------------|\n| `ha_call_service` | Call any HA service by `domain` + `service` + `service_data` |\n| `ha_fire_event` | Fire a custom event on the HA event bus |\n| `ha_render_template` | Render a Jinja2 template via the HA template engine |\n| `ha_notify` | Send a notification via `notify/{target}` |\n\n## Programmatic Usage\n\nThe plugin can also be used as a library:\n\n```typescript\nimport { HAClient, createTools } from \"@elvatis_com/openclaw-homeassistant\";\n\nconst config = {\n  url: \"http://homeassistant.local:8123\",\n  token: \"YOUR_TOKEN\",\n  allowedDomains: [],\n  readOnly: false\n};\n\nconst client = new HAClient(config);\nconst tools = createTools({ client, config });\n\n// Get all entities\nconst entities = await tools.ha_list_entities({});\n\n// Turn on a light at 50% brightness\nawait tools.ha_light_on({\n  entity_id: \"light.living_room\",\n  brightness: 128\n});\n\n// Check a sensor\nconst temp = await tools.ha_get_state({\n  entity_id: \"sensor.outdoor_temperature\"\n});\n```\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Type-check\nnpm run typecheck\n\n# Run tests\nnpm test\n\n# Build\nnpm run build\n\n# Watch mode\nnpm run dev\n```\n\n## Architecture\n\n```\nsrc/\n  index.ts    - Plugin entry point, registers 34 tools with OpenClaw API\n  client.ts   - HAClient: REST client using built-in fetch, Bearer auth, 30s timeout\n  tools.ts    - Tool implementations (one function per tool)\n  guards.ts   - Safety layer: readOnly, allowedDomains, entity validation\n  types.ts    - TypeScript interfaces (PluginConfig, HAEntityState, etc.)\n  __tests__/  - Jest tests with mocked HA API\n```\n\n## Shared Template\n\nFor automation that creates GitHub issues, use `src/templates/github-issue-helper.ts`.\nIt provides `isValidIssueRepoSlug()`, `resolveIssueRepo()`, and `buildGhIssueCreateCommand()`.\n\n## License\n\nMIT - see [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felvatis%2Fopenclaw-homeassistant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felvatis%2Fopenclaw-homeassistant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felvatis%2Fopenclaw-homeassistant/lists"}