mcpField
H
ha-automations

ha-automations

github.com/laurigatesその他5986 回インストール1 日前に更新
リポジトリ

ha-automations について

ha-automations は、Home Assistant のオートメーション、スクリプト、シーン作成を支援するスキルです。トリガーや条件、アクション、ブループリント、実行モードを扱います。

主な機能

  1. 01トリガー・条件・アクションの作成
  2. 02スクリプトとシーンの設定
  3. 03オートメーションのブループリント利用
  4. 04オートメーションの実行モード選択

活用シーン

  1. 01デバイスの状態変化を操作の契機にする
  2. 02時刻や条件に応じたデバイス制御
  3. 03遅延・待機・分岐アクションの記述

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/laurigates/claude-plugins --skill ha-automations

インストール後、Claude Code で/ha-automationsを入力して読み込まれたか確認します。

同梱ファイルREFERENCE.md

詳細

Home Assistant のオートメーション

このスキルを使う場面

次のような場合にこのスキルを使います…次のような場合は ha-configuration を使います…
オートメーションルールを作成するconfiguration.yaml を編集する
トリガー/条件/アクションを記述するインテグレーションを設定する
スクリプトやシーンを扱うシークレットを管理する
ブループリントを使うパッケージを整理する
デバイストリガーを設定する一般的な YAML 設定を行う

オートメーションの構造

automation:
  - id: "unique_automation_id"
    alias: "Descriptive Name"
    description: "What this automation does"
    mode: single  # single, restart, queued, parallel

    trigger:
      - platform: state
        entity_id: binary_sensor.motion
        to: "on"

    condition:
      - condition: time
        after: "08:00:00"
        before: "22:00:00"

    action:
      - service: light.turn_on
        target:
          entity_id: light.living_room

トリガーの種類

状態トリガー
trigger:
  # Basic state change
  - platform: state
    entity_id: binary_sensor.door
    to: "on"
    from: "off"

  # With duration
  - platform: state
    entity_id: binary_sensor.motion
    to: "off"
    for:
      minutes: 5

  # Attribute change
  - platform: state
    entity_id: climate.thermostat
    attribute: current_temperature
時刻トリガー
trigger:
  # Specific time
  - platform: time
    at: "07:00:00"

  # Input datetime
  - platform: time
    at: input_datetime.alarm_time

  # Time pattern (every hour)
  - platform: time_pattern
    hours: "*"
    minutes: 0
    seconds: 0

  # Every 15 minutes
  - platform: time_pattern
    minutes: "/15"

その他のトリガーの種類(数値状態、太陽、デバイス、イベント、Webhook、テンプレート、ゾーン)については、REFERENCE.md を参照してください。

条件の種類

状態条件
condition:
  # Single entity
  - condition: state
    entity_id: binary_sensor.door
    state: "off"

  # Multiple states allowed
  - condition: state
    entity_id: alarm_control_panel.home
    state:
      - armed_home
      - armed_away

  # Check for duration
  - condition: state
    entity_id: binary_sensor.motion
    state: "off"
    for:
      minutes: 10
時刻条件
condition:
  # Time range
  - condition: time
    after: "08:00:00"
    before: "22:00:00"

  # Weekdays only
  - condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri

  # Combined
  - condition: time
    after: "09:00:00"
    before: "17:00:00"
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri

その他の条件の種類(数値状態、太陽、テンプレート、ゾーン、論理、簡略記法)については、REFERENCE.md を参照してください。

アクションの種類

サービス呼び出し
action:
  # Basic service call
  - service: light.turn_on
    target:
      entity_id: light.living_room
    data:
      brightness_pct: 80
      color_temp: 350

  # Multiple targets
  - service: light.turn_off
    target:
      entity_id:
        - light.bedroom
        - light.bathroom
      area_id: upstairs
遅延と待機
action:
  - service: light.turn_on
    target:
      entity_id: light.living_room

  # Fixed delay
  - delay:
      seconds: 30

  # Wait for trigger
  - wait_for_trigger:
      - platform: state
        entity_id: binary_sensor.motion
        to: "off"
    timeout:
      minutes: 5
    continue_on_timeout: true

  # Wait for template
  - wait_template: "{{ is_state('light.bedroom', 'off') }}"
    timeout: "00:05:00"
If/Then/Else(モダン)
action:
  - if:
      - condition: state
        entity_id: binary_sensor.motion
        state: "on"
    then:
      - service: light.turn_on
        target:
          entity_id: light.hallway
    else:
      - service: light.turn_off
        target:
          entity_id: light.hallway

高度なアクションパターン(choose、repeat、変数、並列実行)、スクリプト、シーン、一般的なオートメーションパターンについては、REFERENCE.md を参照してください。

オートメーションモード

モード動作
single実行中は新しいトリガーを無視する
restart現在の実行を停止して、新たに開始する
queued最大 max 回の実行をキューに追加する
parallel最大 max 回を並列実行する
automation:
  - alias: "Motion Light"
    mode: restart
    max: 10  # For queued/parallel
    max_exceeded: silent  # silent, warning, error

エージェント向けの最適化

用途コマンド
オートメーションを検索するgrep -r "alias:" config/automations.yaml
トリガーを検索するgrep -r "platform: state" config/ --include="*.yaml"
スクリプトを一覧表示するgrep -r "^ [a-z_]*:" config/scripts.yaml
シーンを検索するgrep -r "^ - name:" config/scenes.yaml
オートメーション ID を確認するgrep -r "^ - id:" config/automations.yaml

コメント