You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Home Assistant base URL (e.g. http://homeassistant.local:8123)
token
string
Yes
-
Long-Lived Access Token from your HA profile
allowedDomains
string[]
No
[] (all)
Restrict tools to these HA domains only
readOnly
boolean
No
false
Block all write tools (service calls, events, notifications)
Safety Model
This plugin implements three layers of safety:
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.
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.
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.
Tool Reference
Status and Discovery
Tool
Description
ha_status
Get HA instance config (version, location, components)
ha_list_entities
List entities with optional domain, area, state filters
ha_get_state
Get state and attributes of a single entity
ha_search_entities
Search entities by pattern (matches entity_id and friendly_name)
ha_list_services
List all available services grouped by domain
Lights
Tool
Description
ha_light_on
Turn on with optional brightness (0-255), color_temp, rgb_color, transition
ha_light_off
Turn off a light
ha_light_toggle
Toggle a light on/off
ha_light_list
List all light entities with brightness and color info
Switches
Tool
Description
ha_switch_on
Turn on a switch
ha_switch_off
Turn off a switch
ha_switch_toggle
Toggle a switch on/off
Climate
Tool
Description
ha_climate_set_temp
Set target temperature
ha_climate_set_mode
Set HVAC mode (heat, cool, auto, off)
ha_climate_set_preset
Set preset mode (away, home, eco, boost)
ha_climate_list
List all climate entities
Media Player
Tool
Description
ha_media_play
Resume playback
ha_media_pause
Pause playback
ha_media_stop
Stop playback
ha_media_volume
Set volume (0.0-1.0)
ha_media_play_media
Play specific media (content_id + content_type)
Covers
Tool
Description
ha_cover_open
Open a cover (blinds, garage door)
ha_cover_close
Close a cover
ha_cover_position
Set position (0 = closed, 100 = open)
Scenes and Automations
Tool
Description
ha_scene_activate
Activate a scene
ha_script_run
Run a script with optional variables
ha_automation_trigger
Trigger an automation (optional skip_condition)
Sensors and History
Tool
Description
ha_sensor_list
List all sensor entities with current values
ha_history
Get state history (defaults to last 24 hours)
ha_logbook
Get logbook entries (defaults to last 24 hours)
Generic and Advanced
Tool
Description
ha_call_service
Call any HA service by domain + service + service_data
ha_fire_event
Fire a custom event on the HA event bus
ha_render_template
Render a Jinja2 template via the HA template engine
ha_notify
Send a notification via notify/{target}
Programmatic Usage
The plugin can also be used as a library:
import{HAClient,createTools}from"@elvatis_com/openclaw-homeassistant";constconfig={url: "http://homeassistant.local:8123",token: "YOUR_TOKEN",allowedDomains: [],readOnly: false};constclient=newHAClient(config);consttools=createTools({ client, config });// Get all entitiesconstentities=awaittools.ha_list_entities({});// Turn on a light at 50% brightnessawaittools.ha_light_on({entity_id: "light.living_room",brightness: 128});// Check a sensorconsttemp=awaittools.ha_get_state({entity_id: "sensor.outdoor_temperature"});
Development
# Install dependencies
npm install
# Type-check
npm run typecheck
# Run tests
npm test# Build
npm run build
# Watch mode
npm run dev
Architecture
src/
index.ts - Plugin entry point, registers 34 tools with OpenClaw API
client.ts - HAClient: REST client using built-in fetch, Bearer auth, 30s timeout
tools.ts - Tool implementations (one function per tool)
guards.ts - Safety layer: readOnly, allowedDomains, entity validation
types.ts - TypeScript interfaces (PluginConfig, HAEntityState, etc.)
__tests__/ - Jest tests with mocked HA API
Shared Template
For automation that creates GitHub issues, use src/templates/github-issue-helper.ts.
It provides isValidIssueRepoSlug(), resolveIssueRepo(), and buildGhIssueCreateCommand().