iamvaleriofantozzi

Moltbot Home Assistant

生活服務v0.1.1
作者:iamvaleriofantozzi更新於 2026-05-11moltbot-ha@clawhub_iamvaleriofantozzi/moltbot-ha
家庭助手#Smart Home

據 AlphaMoat 統計,截至 2026-09,Moltbot Home Assistant 累計下載 3,126 次、獲 3 個星標,在全部 5,078 個 AI 技能中排名第 3,643 位,在「生活服務」分類(246 個)中排名第 188 位。

累計安裝
102
累計下載
3126
星標
3
全站排名
#3,643
全站前 72% · 「生活服務」前 77%
平台累計安裝累計下載星標評論
ClawHub ↗10230853-
SkillHub ↗10131263—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

它可查詢實體狀態、開關裝置、調整屬性、啟用場景或呼叫自動化服務。配置需要 Home Assistant 長期訪問令牌;門鎖、警報和車庫門等關鍵操作需要明確確認,不能在未獲使用者同意時使用 --force。

資料釋出於 2026-10-29

可以用來做什麼

  • 列出實體並查詢其當前狀態。
  • 控制燈、開關、窗簾等裝置或調整支援的屬性。
  • 檢視場景、自動化及關鍵操作的確認流程。

什麼時候用

  • 需要透過 Home Assistant CLI 檢視或管理智慧家居裝置時。
  • 需要配置裝置屬性或呼叫場景與自動化服務時。
  • 控制門鎖、警報、車庫門等關鍵裝置或處理訪問令牌前,需要確認目標裝置、操作和許可權時。

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

只查詢指定 Home Assistant 實體的狀態,不執行任何控制命令。
準備控制車庫門或門鎖前,展示目標實體和擬執行動作並等待明確確認;不要自行新增 --force。

月度資料趨勢

累計下載3126
2011261032092026-03 · 累計下載 20942026-05 · 累計下載 25412026-06 · 累計下載 26792026-07 · 累計下載 28872026-08 · 累計下載 29922026-09 · 累計下載 312626-0326-09
星標3
2342026-03 · 星標 32026-05 · 星標 32026-06 · 星標 32026-07 · 星標 32026-08 · 星標 32026-09 · 星標 326-0326-09

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-093126—3
2026-082992+3.6%3
2026-072887+7.8%3
2026-062679+5.4%3
2026-052541—3
2026-032094—3

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

7.2 KB · ClawHub v0.1.1
---
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.
展開全部(共 290 行)

## Setup

### 1. Install moltbot-ha
```bash
uv tool install moltbot-ha
```

### 2. Initialize 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)

### 3. Set Environment Variable
Set your Home Assistant long-lived access token:
```bash
export HA_TOKEN="your_token_here"
```

To create a token:
1. Open Home Assistant → Profile (bottom left)
2. Scroll to "Long-Lived Access Tokens"
3. Click "Create Token"
4. Copy the token and set as `HA_TOKEN` environment variable

### 4. Test Connection
```bash
moltbot-ha test
```

## Discovery Commands

### List All Entities
```bash
moltbot-ha list
```

### List by Domain
```bash
moltbot-ha list light
moltbot-ha list switch
moltbot-ha list cover
```

### Get Entity State
```bash
moltbot-ha state light.kitchen
moltbot-ha state sensor.temperature_living_room
```

## Action Commands

### Turn On/Off
```bash
# 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
```bash
# 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
```bash
# 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
```bash
# 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

1. **Attempt critical action:**
```bash
moltbot-ha on cover.garage
```

2. **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
```

3. **Agent sees this error and asks you:**
> "Opening the garage door is a critical action. Do you want to proceed?"

4. **You confirm:**
> "Yes, open it"

5. **Agent retries with --force:**
```bash
moltbot-ha on cover.garage --force
```

6. **Action executes successfully.**

### Important: Never Use --force Without User Consent

**⚠️ CRITICAL RULE FOR AGENTS:**

- **NEVER** add `--force` flag 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:
```toml
[safety]
blocked_entities = ["switch.main_breaker", "lock.front_door"]
```

These **cannot** be controlled even with `--force`.

### Configuration

Edit `~/.config/moltbot-ha/config.toml`:

```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
```bash
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
```bash
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
```bash
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_URL` in config matches your Home Assistant URL
- Ensure Home Assistant is reachable from the machine running moltbot-ha
- Check firewall settings

### 401 Unauthorized
- Verify `HA_TOKEN` is 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 list` to discover correct entity IDs
- Entity IDs are case-sensitive
- Format is `domain.entity_name` (e.g., `light.kitchen`, not `Light.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`):

```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.log` by default
- Safety settings are configurable per installation
- Wildcards (`*`) are supported in `allowed_entities` and `blocked_entities`
- JSON output available with `--json` flag for programmatic parsing

「生活服務」分類下的熱門技能

資料月份:2026-09 · 下載/星標/安裝數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。