8.9kā
moltbot-ha ā OpenClaw Skill
moltbot-ha is an OpenClaw Skills integration for productivity workflows. Control Home Assistant smart home devices, lights, scenes, and automations via moltbot-ha CLI with configurable safety confirmations.
Skill Snapshot
| name | moltbot-ha |
| description | Control Home Assistant smart home devices, lights, scenes, and automations via moltbot-ha CLI with configurable safety confirmations. OpenClaw Skills integration. |
| owner | iamvaleriofantozzi |
| repository | iamvaleriofantozzi/moltbot-ha |
| language | Markdown |
| license | MIT |
| topics | |
| security | L1 |
| install | openclaw add @iamvaleriofantozzi/moltbot-ha |
| last updated | Feb 7, 2026 |
Maintainer

name: moltbot-ha description: Control Home Assistant smart home devices, lights, scenes, and automations via moltbot-ha CLI with configurable safety confirmations. homepage: https://github.com/iamvaleriofantozzi/moltbot-ha metadata: {"moltbot":{"emoji":"š ","requires":{"bins":["moltbot-ha"],"env":["HA_TOKEN"]},"primaryEnv":"HA_TOKEN","install":[{"id":"uv","kind":"uv","package":"moltbot-ha","bins":["moltbot-ha"],"label":"Install moltbot-ha (uv tool)"}]}}
Home Assistant Control
Control your smart home via Home Assistant API using the moltbot-ha CLI tool.
Setup
1. Install moltbot-ha
uv tool install moltbot-ha
2. Initialize Configuration
moltbot-ha config init
The setup will interactively ask for:
- Home Assistant URL (e.g.,
http://192.168.1.100:8123) - Token storage preference (environment variable recommended)
3. Set Environment Variable
Set your Home Assistant long-lived access token:
export HA_TOKEN="your_token_here"
To create a token:
- Open Home Assistant ā Profile (bottom left)
- Scroll to "Long-Lived Access Tokens"
- Click "Create Token"
- Copy the token and set as
HA_TOKENenvironment variable
4. Test Connection
moltbot-ha test
Discovery Commands
List All Entities
moltbot-ha list
List by Domain
moltbot-ha list light
moltbot-ha list switch
moltbot-ha list cover
Get Entity State
moltbot-ha state light.kitchen
moltbot-ha state sensor.temperature_living_room
Action Commands
Turn On/Off
# Turn on
moltbot-ha on light.living_room
moltbot-ha on switch.coffee_maker
# Turn off
moltbot-ha off light.bedroom
moltbot-ha off switch.fan
# Toggle
moltbot-ha toggle light.hallway
Set Attributes
# Set brightness (percentage)
moltbot-ha set light.bedroom brightness_pct=50
# Set color temperature
moltbot-ha set light.office color_temp=300
# Multiple attributes
moltbot-ha set light.kitchen brightness_pct=80 color_temp=350
Call Services
# Activate a scene
moltbot-ha call scene.turn_on entity_id=scene.movie_time
# Set thermostat temperature
moltbot-ha call climate.set_temperature entity_id=climate.living_room temperature=21
# Close cover (blinds, garage)
moltbot-ha call cover.close_cover entity_id=cover.garage
Generic Service Call
# With parameters
moltbot-ha call automation.trigger entity_id=automation.morning_routine
# With JSON data
moltbot-ha call script.turn_on --json '{"entity_id": "script.bedtime", "variables": {"brightness": 10}}'
Safety & Confirmations
moltbot-ha implements a 3-level safety system to prevent accidental actions:
Safety Level 3 (Default - Recommended)
Critical operations require explicit confirmation:
- lock.*: Door locks
- alarm_control_panel.*: Security alarms
- cover.*: Garage doors, blinds
How Confirmation Works
- Attempt critical action:
moltbot-ha on cover.garage
- Tool returns error:
ā ļø CRITICAL ACTION REQUIRES CONFIRMATION
Action: turn_on on cover.garage
This is a critical operation that requires explicit user approval.
Ask the user to confirm, then retry with --force flag.
Example: moltbot-ha on cover.garage --force
- Agent sees this error and asks you:
"Opening the garage door is a critical action. Do you want to proceed?"
- You confirm:
"Yes, open it"
- Agent retries with --force:
moltbot-ha on cover.garage --force
- Action executes successfully.
Important: Never Use --force Without User Consent
ā ļø CRITICAL RULE FOR AGENTS:
- NEVER add
--forceflag without explicit user confirmation - ALWAYS show the user which critical action is being attempted
- WAIT for explicit "yes" / "confirm" / "approve" before using
--force - BE SMART about what constitutes confirmation: "Yes", "OK", "Sure", "Do it", "Confirmed", or any affirmative response in the context of the request is sufficient. You do NOT need the user to type a specific phrase verbatim.
Blocked Entities
Some entities can be permanently blocked in configuration:
[safety]
blocked_entities = ["switch.main_breaker", "lock.front_door"]
These cannot be controlled even with --force.
Configuration
Edit ~/.config/moltbot-ha/config.toml:
[safety]
level = 3 # 0=disabled, 1=log-only, 2=confirm all writes, 3=confirm critical
critical_domains = ["lock", "alarm_control_panel", "cover"]
blocked_entities = [] # Add entities that should never be automated
allowed_entities = [] # If set, ONLY these entities are accessible (supports wildcards)
Common Workflows
Morning Routine
moltbot-ha on light.bedroom brightness_pct=30
moltbot-ha call cover.open_cover entity_id=cover.bedroom_blinds
moltbot-ha call climate.set_temperature entity_id=climate.bedroom temperature=21
Night Mode
moltbot-ha off light.* # Requires wildcard support in future
moltbot-ha call scene.turn_on entity_id=scene.goodnight
moltbot-ha call cover.close_cover entity_id=cover.all_blinds
Check Sensors
moltbot-ha state sensor.temperature_living_room
moltbot-ha state sensor.humidity_bathroom
moltbot-ha state binary_sensor.motion_hallway
Troubleshooting
Connection Failed
- Verify
HA_URLin config matches your Home Assistant URL - Ensure Home Assistant is reachable from the machine running moltbot-ha
- Check firewall settings
401 Unauthorized
- Verify
HA_TOKENis set correctly - Ensure token is a Long-Lived Access Token (not temporary)
- Check token hasn't been revoked in Home Assistant
Entity Not Found
- Use
moltbot-ha listto discover correct entity IDs - Entity IDs are case-sensitive
- Format is
domain.entity_name(e.g.,light.kitchen, notLight.Kitchen)
Docker Networking
If running in Docker and can't reach Home Assistant on homeassistant.local:
- Use IP address instead:
http://192.168.1.100:8123 - Or use Tailscale for reliable mesh networking
Configuration Reference
Full config file (~/.config/moltbot-ha/config.toml):
[server]
url = "http://homeassistant.local:8123"
# token = "optional_here_prefer_env_var"
[safety]
level = 3
critical_domains = ["lock", "alarm_control_panel", "cover"]
blocked_entities = []
allowed_entities = []
[logging]
enabled = true
path = "~/.config/moltbot-ha/actions.log"
level = "INFO"
Examples for Agents
Discovery Pattern
User: "What lights do I have?"
Agent: moltbot-ha list light
Agent: "You have these lights: light.living_room, light.kitchen, light.bedroom"
Safe Action Pattern
User: "Turn on the living room light"
Agent: moltbot-ha on light.living_room
Agent: "Living room light is now on"
Critical Action Pattern
User: "Open the garage"
Agent: moltbot-ha on cover.garage
<receives CriticalActionError>
Agent: "ā ļø Opening the garage door is a critical action. Do you want to proceed?"
User: "Yes, open it"
Agent: moltbot-ha on cover.garage --force
Agent: "Garage door is opening"
Notes
- All write actions are logged to
~/.config/moltbot-ha/actions.logby default - Safety settings are configurable per installation
- Wildcards (
*) are supported inallowed_entitiesandblocked_entities - JSON output available with
--jsonflag for programmatic parsing
moltbot-ha š
Home Assistant control CLI for Moltbot agents and humans.
Control your smart home via Home Assistant REST API with powerful safety features, configurable confirmations, and agent-friendly design.
⨠Features
- š® Full Control: Lights, switches, covers, scenes, climate, and all Home Assistant domains
- š”ļø Safety First: 3-level safety system with confirmations for critical actions (locks, alarms, garage doors)
- š¤ Agent-Friendly: Designed for AI agents with clear error messages and confirmation workflows
- āļø Configurable: Flexible allowlist/blocklist, custom critical domains, logging
- š Fast: Direct REST API calls with retry logic and connection pooling
- š Output Formats: Human-readable tables or JSON for programmatic use
š¦ Installation
Via uv (recommended)
uv tool install moltbot-ha
Via pip
pip install moltbot-ha
From source (development)
git clone https://github.com/iamvaleriofantozzi/moltbot-ha.git
cd moltbot-ha
uv tool install .
š Quick Start
1. Initialize Configuration
moltbot-ha config init
The interactive setup will ask you:
- Home Assistant URL: Your HA instance URL (e.g.,
http://192.168.1.100:8123) - Token storage: Environment variable (recommended) or config file
2. Set Token (if using environment variable)
export HA_TOKEN="your_long_lived_access_token"
How to create a token:
- Open Home Assistant ā Profile (bottom left icon)
- Scroll down to "Long-Lived Access Tokens"
- Click "Create Token", give it a name (e.g., "moltbot-ha")
- Copy the token immediately (you can't see it again!)
3. Test Connection
moltbot-ha test
You should see:
ā Connected to Home Assistant successfully
Non-Interactive Setup
If you prefer to set everything via environment variables:
export HA_URL="http://192.168.1.100:8123"
export HA_TOKEN="your_token_here"
moltbot-ha config init --no-interactive
moltbot-ha test
š Usage
Discovery
# List all entities
moltbot-ha list
# List by domain
moltbot-ha list light
moltbot-ha list switch
moltbot-ha list sensor
# Get entity state (JSON output)
moltbot-ha state light.kitchen
Basic Actions
# Turn on/off
moltbot-ha on light.living_room
moltbot-ha off switch.fan
# Toggle
moltbot-ha toggle light.hallway
Advanced Control
# Set attributes
moltbot-ha set light.bedroom brightness_pct=50
moltbot-ha set light.office brightness_pct=80 color_temp=300
# Call services
moltbot-ha call scene.turn_on entity_id=scene.movie_time
moltbot-ha call climate.set_temperature entity_id=climate.living_room temperature=21
# Generic service call with JSON
moltbot-ha call script.turn_on --json '{"entity_id": "script.bedtime", "variables": {"dim": true}}'
š”ļø Safety System
moltbot-ha implements a 3-level safety system to prevent accidental or dangerous actions.
Safety Levels
| Level | Behavior |
|---|---|
| 0 | No safety checks (ā ļø dangerous!) |
| 1 | Log actions only, no confirmations |
| 2 | Confirm all write operations |
| 3 | Confirm critical operations only (š recommended) |
Level 3 (Default): Critical Domains
By default, these domains require explicit --force confirmation:
- lock: Door locks
- alarm_control_panel: Security systems
- cover: Garage doors, blinds, shutters
Confirmation Workflow
- Attempt critical action without --force:
$ moltbot-ha on cover.garage
- Tool returns error:
ā ļø CRITICAL ACTION REQUIRES CONFIRMATION
Action: turn_on on cover.garage
This is a critical operation that requires explicit user approval.
Ask the user to confirm, then retry with --force flag.
Example: moltbot-ha on cover.garage --force
- After user confirms, retry with --force:
$ moltbot-ha on cover.garage --force
ā cover.garage turned on
Blocked Entities
Permanently block entities that should NEVER be automated:
# ~/.config/moltbot-ha/config.toml
[safety]
blocked_entities = [
"switch.main_breaker", # Never touch the main power!
"lock.front_door", # Keep front door manual-only
]
Blocked entities cannot be controlled even with --force.
Allowlist
Restrict access to specific entities only:
[safety]
allowed_entities = [
"light.*", # All lights
"switch.office_*", # Office switches only
"scene.*", # All scenes
]
āļø Configuration
Full configuration file (~/.config/moltbot-ha/config.toml):
[server]
# Home Assistant URL (required)
url = "http://192.168.1.100:8123"
# Token (optional, prefer HA_TOKEN env var)
# token = "eyJ..."
[safety]
# Safety level: 0=disabled, 1=log-only, 2=confirm all, 3=confirm critical
level = 3
# Domains that require confirmation (level 3)
critical_domains = ["lock", "alarm_control_panel", "cover"]
# Entities that are always blocked (even with --force)
blocked_entities = []
# Entities that are allowed (empty = all allowed except blocked)
# Supports wildcards: "light.*", "switch.office_*"
allowed_entities = []
[logging]
# Enable action logging
enabled = true
# Log file path
path = "~/.config/moltbot-ha/actions.log"
# Log level: DEBUG, INFO, WARNING, ERROR
level = "INFO"
Environment Variables
Environment variables override config file settings:
HA_URL: Home Assistant URLHA_TOKEN: Long-lived access token (ā recommended for security)HA_CTL_CONFIG: Custom config file path
š³ Docker / Moltbot Integration
If running inside Docker (e.g., Moltbot gateway):
Installation in Container
docker exec -it moltbot-gateway uv tool install moltbot-ha
Configuration
docker exec -it moltbot-gateway moltbot-ha config init
docker exec -it moltbot-gateway vi ~/.config/moltbot-ha/config.toml
Set Token via Environment
Add to docker-compose.yml:
environment:
- HA_TOKEN=${HA_TOKEN}
Then in host .env:
HA_TOKEN=your_token_here
Networking Tips
- IP address (recommended):
http://192.168.1.100:8123 - Tailscale:
http://homeassistant.ts.net:8123 - Avoid mDNS in Docker:
homeassistant.localoften doesn't work - Nabu Casa:
https://xxxxx.ui.nabu.casa(requires subscription)
š Troubleshooting
Connection Refused
Symptom:
Connection failed: Connection refused
Solutions:
- Verify Home Assistant is running
- Check URL in config matches your HA instance
- Ensure HA is reachable from the machine running moltbot-ha
- Check firewall settings (port 8123 must be open)
- If in Docker, use IP address instead of
homeassistant.local
401 Unauthorized
Symptom:
[401] Authentication failed
Solutions:
- Verify
HA_TOKENenvironment variable is set correctly - Ensure token is a Long-Lived Access Token (not session token)
- Check token hasn't been revoked in Home Assistant settings
- Regenerate token if necessary
Entity Not Found
Symptom:
Entity not found: light.kitche
Solutions:
- Use
moltbot-ha listto discover correct entity IDs - Entity IDs are case-sensitive
- Check for typos (e.g.,
kitchevskitchen)
Blocked Entity
Symptom:
ā Entity switch.main_breaker is BLOCKED in configuration
Solution:
- This is intentional! The entity is in your
blocked_entitieslist - Remove from config if you want to allow control
- This safety feature prevents accidental control of critical devices
š Examples
Morning Routine Script
#!/bin/bash
# morning.sh
moltbot-ha on light.bedroom brightness_pct=30
moltbot-ha call cover.open_cover entity_id=cover.bedroom_blinds
moltbot-ha call climate.set_temperature entity_id=climate.bedroom temperature=21
moltbot-ha call scene.turn_on entity_id=scene.good_morning
Check Temperature Sensors
#!/bin/bash
# check-temps.sh
echo "Living Room:"
moltbot-ha state sensor.temperature_living_room | jq -r '.state'
echo "Bedroom:"
moltbot-ha state sensor.temperature_bedroom | jq -r '.state'
echo "Outside:"
moltbot-ha state sensor.temperature_outside | jq -r '.state'
Night Mode
#!/bin/bash
# night-mode.sh
moltbot-ha call scene.turn_on entity_id=scene.goodnight
moltbot-ha call cover.close_cover entity_id=cover.all_blinds
moltbot-ha call climate.set_temperature entity_id=climate.bedroom temperature=18
š¤ Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
š License
MIT License - see LICENSE file for details.
š Acknowledgments
- Home Assistant for the amazing smart home platform
- Moltbot for agent infrastructure
- Typer for CLI framework
- Rich for beautiful terminal output
š Links
- Home Assistant REST API Docs
- Moltbot Documentation
- ClawdHub (skill registry)
Made with ā¤ļø for smart homes and AI agents
Permissions & Security
Security level L1: Low-risk skills with minimal permissions. Review inputs and outputs before running in production.
Requirements
- OpenClaw CLI installed and configured.
- Language: Markdown
- License: MIT
- Topics:
Configuration
```bash moltbot-ha config init ``` The setup will interactively ask for: - Home Assistant URL (e.g., `http://192.168.1.100:8123`) - Token storage preference (environment variable recommended)
FAQ
How do I install moltbot-ha?
Run openclaw add @iamvaleriofantozzi/moltbot-ha in your terminal. This installs moltbot-ha into your OpenClaw Skills catalog.
Does this skill run locally or in the cloud?
OpenClaw Skills execute locally by default. Review the SKILL.md and permissions before running any skill.
Where can I verify the source code?
The source repository is available at https://github.com/openclaw/skills/tree/main/skills/iamvaleriofantozzi/moltbot-ha. Review commits and README documentation before installing.
