jpskill.com
🛠️ 開発・MCP コミュニティ 🔴 エンジニア向け 👤 エンジニア・AI開発者

🛠️ Home Assistant

home-assistant

自宅の照明やエアコンなどのスマートホーム機器を「

⏱ 障害ポストモーテム 1日 → 1時間

📺 まず動画で見る(YouTube)

▶ 【衝撃】最強のAIエージェント「Claude Code」の最新機能・使い方・プログラミングをAIで効率化する超実践術を解説! ↗

※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。

📜 元の英語説明(参考)

Control Home Assistant smart home devices, run automations, and receive webhook events. Use when controlling lights, switches, climate, scenes, scripts, or any HA entity. Supports bidirectional communication via REST API (outbound) and webhooks (inbound triggers from HA automations).

🇯🇵 日本人クリエイター向け解説

一言でいうと

自宅の照明やエアコンなどのスマートホーム機器を「

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o home-assistant.zip https://jpskill.com/download/4897.zip && unzip -o home-assistant.zip && rm home-assistant.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/4897.zip -OutFile "$d\home-assistant.zip"; Expand-Archive "$d\home-assistant.zip" -DestinationPath $d -Force; ri "$d\home-assistant.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して home-assistant.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → home-assistant フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-18
同梱ファイル
3

💬 こう話しかけるだけ — サンプルプロンプト

  • Home Assistant を使って、最小構成のサンプルコードを示して
  • Home Assistant の主な使い方と注意点を教えて
  • Home Assistant を既存プロジェクトに組み込む方法を教えて

これをClaude Code に貼るだけで、このSkillが自動発動します。

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Home Assistant

Home Assistant の REST API と Webhook を介してスマートホームを制御します。

セットアップ

オプション 1: 設定ファイル (推奨)

~/.config/home-assistant/config.json を作成します。

{
  "url": "https://your-ha-instance.duckdns.org",
  "token": "your-long-lived-access-token"
}

オプション 2: 環境変数

export HA_URL="http://homeassistant.local:8123"
export HA_TOKEN="your-long-lived-access-token"

長期アクセストークンの取得

  1. Home Assistant を開き、プロフィール (左下) をクリックします。
  2. 「Long-Lived Access Tokens」までスクロールします。
  3. 「Create Token」をクリックし、名前を付けます (例: "Clawdbot")。
  4. トークンをすぐにコピーします (一度しか表示されません)。

クイックリファレンス

エンティティのリスト表示

curl -s -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/states" | jq '.[].entity_id'

エンティティの状態取得

curl -s -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/states/light.living_room"

デバイスの制御

# オンにする
curl -X POST -H "Authorization: Bearer $HA_TOKEN" -H "Content-Type: application/json" \
  "$HA_URL/api/services/light/turn_on" -d '{"entity_id": "light.living_room"}'

# オフにする
curl -X POST -H "Authorization: Bearer $HA_TOKEN" -H "Content-Type: application/json" \
  "$HA_URL/api/services/light/turn_off" -d '{"entity_id": "light.living_room"}'

# 明るさの設定 (0-255)
curl -X POST -H "Authorization: Bearer $HA_TOKEN" -H "Content-Type: application/json" \
  "$HA_URL/api/services/light/turn_on" -d '{"entity_id": "light.living_room", "brightness": 128}'

スクリプトとオートメーションの実行

# スクリプトのトリガー
curl -X POST -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/services/script/turn_on" \
  -H "Content-Type: application/json" -d '{"entity_id": "script.goodnight"}'

# オートメーションのトリガー
curl -X POST -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/services/automation/trigger" \
  -H "Content-Type: application/json" -d '{"entity_id": "automation.motion_lights"}'

シーンのアクティブ化

curl -X POST -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/services/scene/turn_on" \
  -H "Content-Type: application/json" -d '{"entity_id": "scene.movie_night"}'

一般的なサービス

ドメイン サービス 例の entity_id
light turn_on, turn_off, toggle light.kitchen
switch turn_on, turn_off, toggle switch.fan
climate set_temperature, set_hvac_mode climate.thermostat
cover open_cover, close_cover, stop_cover cover.garage
media_player play_media, media_pause, volume_set media_player.tv
scene turn_on scene.relax
script turn_on script.welcome_home
automation trigger, turn_on, turn_off automation.sunrise

インバウンド Webhook (HA → Clawdbot)

Home Assistant のオートメーションからイベントを受信するには:

1. Webhook アクションを含む HA オートメーションを作成する

# HA オートメーション内
action:
  - service: rest_command.notify_clawdbot
    data:
      event: motion_detected
      area: living_room

2. HA で REST コマンドを定義する

# configuration.yaml
rest_command:
  notify_clawdbot:
    url: "https://your-clawdbot-url/webhook/home-assistant"
    method: POST
    headers:
      Authorization: "Bearer {{ webhook_secret }}"
      Content-Type: "application/json"
    payload: '{"event": "{{ event }}", "area": "{{ area }}"}'

3. Clawdbot で処理する

Clawdbot は Webhook を受信し、イベントに基づいて通知したり、アクションを実行したりできます。

CLI ラッパー

scripts/ha.sh CLI は、すべての HA 機能に簡単にアクセスできます。

# 接続テスト
ha.sh info

# エンティティのリスト表示
ha.sh list all          # すべてのエンティティ
ha.sh list lights       # ライトのみ
ha.sh list switch       # スイッチのみ

# エンティティの検索
ha.sh search kitchen    # 名前でエンティティを検索

# 状態の取得/設定
ha.sh state light.living_room
ha.sh states light.living_room   # 属性を含む詳細情報
ha.sh on light.living_room
ha.sh on light.living_room 200   # 明るさ付き (0-255)
ha.sh off light.living_room
ha.sh toggle switch.fan

# シーンとスクリプト
ha.sh scene movie_night
ha.sh script goodnight

# 気候
ha.sh climate climate.thermostat 22

# 任意のサービスを呼び出す
ha.sh call light turn_on '{"entity_id":"light.room","brightness":200}'

トラブルシューティング

  • 401 Unauthorized: トークンの期限切れまたは無効です。新しいトークンを生成してください。
  • Connection refused: HA_URL を確認し、HA が実行中でアクセス可能であることを確認してください。
  • Entity not found: エンティティをリスト表示して、正しい entity_id を見つけてください。

API リファレンス

高度な使用法については、references/api.md を参照してください。

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Home Assistant

Control your smart home via Home Assistant's REST API and webhooks.

Setup

Option 1: Config File (Recommended)

Create ~/.config/home-assistant/config.json:

{
  "url": "https://your-ha-instance.duckdns.org",
  "token": "your-long-lived-access-token"
}

Option 2: Environment Variables

export HA_URL="http://homeassistant.local:8123"
export HA_TOKEN="your-long-lived-access-token"

Getting a Long-Lived Access Token

  1. Open Home Assistant → Profile (bottom left)
  2. Scroll to "Long-Lived Access Tokens"
  3. Click "Create Token", name it (e.g., "Clawdbot")
  4. Copy the token immediately (shown only once)

Quick Reference

List Entities

curl -s -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/states" | jq '.[].entity_id'

Get Entity State

curl -s -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/states/light.living_room"

Control Devices

# Turn on
curl -X POST -H "Authorization: Bearer $HA_TOKEN" -H "Content-Type: application/json" \
  "$HA_URL/api/services/light/turn_on" -d '{"entity_id": "light.living_room"}'

# Turn off
curl -X POST -H "Authorization: Bearer $HA_TOKEN" -H "Content-Type: application/json" \
  "$HA_URL/api/services/light/turn_off" -d '{"entity_id": "light.living_room"}'

# Set brightness (0-255)
curl -X POST -H "Authorization: Bearer $HA_TOKEN" -H "Content-Type: application/json" \
  "$HA_URL/api/services/light/turn_on" -d '{"entity_id": "light.living_room", "brightness": 128}'

Run Scripts & Automations

# Trigger script
curl -X POST -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/services/script/turn_on" \
  -H "Content-Type: application/json" -d '{"entity_id": "script.goodnight"}'

# Trigger automation
curl -X POST -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/services/automation/trigger" \
  -H "Content-Type: application/json" -d '{"entity_id": "automation.motion_lights"}'

Activate Scenes

curl -X POST -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/services/scene/turn_on" \
  -H "Content-Type: application/json" -d '{"entity_id": "scene.movie_night"}'

Common Services

Domain Service Example entity_id
light turn_on, turn_off, toggle light.kitchen
switch turn_on, turn_off, toggle switch.fan
climate set_temperature, set_hvac_mode climate.thermostat
cover open_cover, close_cover, stop_cover cover.garage
media_player play_media, media_pause, volume_set media_player.tv
scene turn_on scene.relax
script turn_on script.welcome_home
automation trigger, turn_on, turn_off automation.sunrise

Inbound Webhooks (HA → Clawdbot)

To receive events from Home Assistant automations:

1. Create HA Automation with Webhook Action

# In HA automation
action:
  - service: rest_command.notify_clawdbot
    data:
      event: motion_detected
      area: living_room

2. Define REST Command in HA

# configuration.yaml
rest_command:
  notify_clawdbot:
    url: "https://your-clawdbot-url/webhook/home-assistant"
    method: POST
    headers:
      Authorization: "Bearer {{ webhook_secret }}"
      Content-Type: "application/json"
    payload: '{"event": "{{ event }}", "area": "{{ area }}"}'

3. Handle in Clawdbot

Clawdbot receives the webhook and can notify you or take action based on the event.

CLI Wrapper

The scripts/ha.sh CLI provides easy access to all HA functions:

# Test connection
ha.sh info

# List entities
ha.sh list all          # all entities
ha.sh list lights       # just lights
ha.sh list switch       # just switches

# Search entities
ha.sh search kitchen    # find entities by name

# Get/set state
ha.sh state light.living_room
ha.sh states light.living_room   # full details with attributes
ha.sh on light.living_room
ha.sh on light.living_room 200   # with brightness (0-255)
ha.sh off light.living_room
ha.sh toggle switch.fan

# Scenes & scripts
ha.sh scene movie_night
ha.sh script goodnight

# Climate
ha.sh climate climate.thermostat 22

# Call any service
ha.sh call light turn_on '{"entity_id":"light.room","brightness":200}'

Troubleshooting

  • 401 Unauthorized: Token expired or invalid. Generate a new one.
  • Connection refused: Check HA_URL, ensure HA is running and accessible.
  • Entity not found: List entities to find the correct entity_id.

API Reference

For advanced usage, see references/api.md.

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。