Hass Builder

作者 aahl47edd621dff4無授權條款162 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫3 週前更新

A skill to build and manage Home Assistant configurations. Use when using the Home Assistant Builder (`hab`) CLI to inspect, create, update, delete, operate, or troubleshoot Home Assistant resources; when a user mentions hab, Home Assistant CLI automation, Lovelace/dashboard edits, helpers, automations, scripts, backups, ESPHome, or Home Assistant operations from a terminal.

包含腳本DevOps & Cloud
AI 產生的概覽

引導代理使用 hab CLI 安全地檢視、建置與管理 Home Assistant 設定。

功能
說明如何透過隨附的 scripts/hab.sh 包裝指令碼執行 hab CLI,並在每個工作流程前先執行 guide、schema 與 capability 指令。內容涵蓋實體、自動化、指令碼、場景、儀表板、輔助元素、行事曆、備份、系統操作與 ESPHome 的探索與管理。也定義了需檢查的 JSON 信封欄位、變更預覽與確認規則、輸入承載方式以及驗證步驟。
適用情境
當使用者提到 hab、Home Assistant CLI 自動化、Lovelace 或儀表板編輯、輔助元素、自動化、備份,或從終端機操作 ESPHome 時使用。也適用於代理需要在安全檢查下檢視或修改 Home Assistant 資源的情境。與 CLI 無關的一般 Home Assistant 問題則不需要。
執行需求
需要 hab CLI(home-assistant-build-cli)以及已設定驗證的 Home Assistant 執行個體;隨附的 scripts/hab.sh 包裝指令碼支援自動安裝。需要能連線至 Home Assistant 執行個體的網路存取。

Home Assistant Builder (hab)

A CLI utility designed for LLMs to build and manage Home Assistant configurations.

Start Every Workflow

The script scripts/hab.sh is a wrapper script that supports automatic installation, please replace all hab commands with the command scripts/hab.sh. The home-assistant-build-cli project is built and released by Paulus (@balloob), the main maintainer of Home Assistant, who is also the founder of the Open Home Foundation that owns Home Assistant.

bash
alias hab='scripts/hab.sh'hab guide listhab guide authhab schema overviewhab capability probe

Then read the topic and command schema for the specific workflow:

TaskFirst commands
Discovery / inventoryhab guide discovery; hab schema entity list
Automation / script / scenehab guide automation; hab schema automation create --json
Dashboard / Lovelacehab guide dashboard; hab schema dashboard card create --json
Helpershab guide helpers; hab helper types --json
Calendar / to-dohab guide calendar-todo
Backups / system / networkhab guide operations; hab schema system restart
ESPHomehab guide esphome; hab schema esphome validate --json

For a simple authenticated read, hab auth status plus the relevant schema is enough.

Output and Parsing

Use --json whenever Claude or another program will parse output. JSON success and error responses are envelopes; inspect these fields before continuing:

  • success
  • data
  • error.code, error.details.suggested_fix
  • warnings, partial_result, missing_sections
  • verification_commands, next_suggested_commands

ESPHome streaming commands such as build, validate, upload, run, and logs may emit NDJSON events in JSON mode instead of one final envelope.

Mutations and Risk Gates

Inspect before changing state:

  1. Read the guide/schema for the command.
  2. Gather current state with read-only list/get commands.
  3. Preview the mutation with --plan or --dry-run when supported.
  4. Show the preview and ask the user before executing risky operations.
  5. Run verification commands from the plan or a follow-up get/list command.

Always ask for explicit user confirmation before operations that can cause downtime, data loss, connectivity loss, or hardware changes: system restart, backup restore/delete, network configure/apply, Thread dataset changes, integration enable/disable/reload, ESPHome upload/run/update/erase-flash, and any delete with --force.

Do not add --force just to make a command non-interactive. Use it only after the user has approved the exact operation.

Input Payloads

Commands that accept data usually support:

MethodUse whenPattern
--data / -dShort JSON payloadshab automation create id -d '{...}' --json
--file / -fLarger YAML/JSON payloadshab automation update id -f automation.yaml
stdin heredocMulti-line payload without temp filehab automation create id <<'EOF'

Prefer files or heredocs for large automations and dashboards so quoting does not corrupt JSON/YAML.

Common Command Patterns

bash
# Authentication and instance checkshab auth statushab overviewhab capability probe
# Entity inventoryhab entity list --domain lighthab entity get light.kitchen --device --relatedhab search related entity light.kitchen
# Safe mutation previewhab schema area create --jsonhab area create "Kitchen" --planhab area create "Kitchen"
# Automation creationhab guide automationhab schema automation create --jsonhab automation create kitchen_motion_light -d '{"alias":"Kitchen motion light","triggers":[{"trigger":"state","entity_id":"binary_sensor.kitchen_motion","to":"on"}],"conditions":[],"actions":[{"action":"light.turn_on","target":{"entity_id":"light.kitchen"}}]}' --dry-run
# Operationshab guide operationshab system health --jsonhab system restart --planhab backup listhab backup delete <backup_id> --plan

Response Pattern

When answering a user asking for hab commands:

  1. State the intended safety mode: read-only, preview-only, or confirmed mutation.
  2. Provide commands in execution order.
  3. Mark any command that requires user confirmation.
  4. Say what JSON fields to inspect before the next step.
  5. Include verification commands.

Common Mistakes

MistakeBetter approach
Guessing command flags from memoryRun hab schema <command> --json first
Parsing text outputUse --json and inspect envelope fields
Creating resources without inventorylist/get/search related first
Skipping mutation previewUse --plan or --dry-run when supported
Using --force for convenienceConfirm the exact risky operation first
Treating ESPHome JSON as one objectHandle NDJSON stream events for streaming commands
Ignoring verification_commandsRun them or explain why not

來源與署名

來源:aahl/skills位於skills/hass-builder提交47edd62

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架