mcpField
H
ha-entities

ha-entities

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

ha-entities について

Home Assistant のエンティティを扱うユーザーやエージェント向けのリファレンススキルです。ドメインやカスタマイズ、テンプレート、グループ、属性、状態の参照を扱い、自動化ルールは対象外です。

主な機能

  1. 01エンティティのドメインと ID
  2. 02エンティティのカスタマイズ
  3. 03テンプレートセンサー
  4. 04グループとデバイスクラス
  5. 05状態と属性の参照

活用シーン

  1. 01適切なエンティティドメインの特定
  2. 02エンティティ名とアイコンの変更
  3. 03テンプレートセンサーの作成
  4. 04テンプレートでの状態参照

インストール

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

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

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

同梱ファイルREFERENCE.md

詳細

Home Assistant エンティティ

このスキルを使用する場面

次の場合はこのスキルを使用します…次の場合は ha-automations を使用します…
エンティティドメインを理解するオートメーションルールを作成する
エンティティをカスタマイズするトリガー/アクションを扱う
テンプレートセンサーを作成するオートメーションの条件を記述する
グループを設定するスクリプト/シーンを扱う
デバイスクラスを扱うイベントを処理する

エンティティ ID の構造

domain.object_id

例:

  • light.living_room_ceiling
  • sensor.outdoor_temperature
  • binary_sensor.front_door_contact
  • switch.garden_irrigation

一般的なドメイン

ドメイン説明例
light照明の制御light.kitchen
switchオン/オフスイッチswitch.outlet
sensor数値センサーsensor.temperature
binary_sensorオン/オフセンサーbinary_sensor.motion
climateHVAC の制御climate.thermostat
coverブラインド、ガレージドアcover.garage
lockドアロックlock.front_door
media_playerメディアデバイスmedia_player.tv
cameraカメラ映像camera.front_yard
vacuumロボット掃除機vacuum.roomba
fanファンの制御fan.bedroom
alarm_control_panel警報システムalarm_control_panel.home
person人の追跡person.john
device_trackerデバイスの位置情報device_tracker.phone
weather天気情報weather.home
input_boolean仮想トグルinput_boolean.guest_mode
input_number仮想数値input_number.target_temp
input_select仮想ドロップダウンinput_select.house_mode
input_text仮想テキストinput_text.message
input_datetime仮想日時input_datetime.alarm
input_button仮想ボタンinput_button.reset
automationオートメーションautomation.motion_light
scriptスクリプトscript.morning_routine
sceneシーンscene.movie_night
groupエンティティグループgroup.all_lights
timerカウントダウンタイマーtimer.laundry
counterカウンターcounter.guests
zone地理的ゾーンzone.home
sun太陽の位置sun.sun

デバイスクラス(バイナリーセンサーおよびセンサー)の完全な一覧は、REFERENCE.md を参照してください。

エンティティのカスタマイズ

customize.yaml
# Single entity
light.living_room:
  friendly_name: "Living Room Light"
  icon: mdi:ceiling-light

# Binary sensor
binary_sensor.front_door:
  friendly_name: "Front Door"
  device_class: door

# Sensor
sensor.outdoor_temperature:
  friendly_name: "Outdoor Temperature"
  device_class: temperature
  unit_of_measurement: "°C"
グロブによるカスタマイズ
customize_glob:
  "light.*_ceiling":
    icon: mdi:ceiling-light

  "sensor.*_temperature":
    device_class: temperature
    unit_of_measurement: "°C"

  "binary_sensor.*_motion":
    device_class: motion

テンプレートセンサー

template:
  - sensor:
      # Simple state
      - name: "Average Temperature"
        unit_of_measurement: "°C"
        device_class: temperature
        state: >-
          {{ ((states('sensor.living_room_temp') | float +
               states('sensor.bedroom_temp') | float +
               states('sensor.kitchen_temp') | float) / 3) | round(1) }}

      # With attributes
      - name: "Power Usage"
        unit_of_measurement: "W"
        device_class: power
        state: "{{ states('sensor.energy_meter_power') }}"
        attributes:
          cost_per_hour: >-
            {{ (states('sensor.energy_meter_power') | float * 0.15 / 1000) | round(2) }}

      # Availability
      - name: "Solar Power"
        unit_of_measurement: "W"
        device_class: power
        state: "{{ states('sensor.inverter_power') }}"
        availability: "{{ states('sensor.inverter_power') != 'unavailable' }}"

テンプレートバイナリーセンサー、スイッチ、ボタン、数値、グループ、ユーティリティメーター、カウンター、タイマーについては、REFERENCE.md を参照してください。

状態属性

一般的な属性
ドメイン一般的な属性
lightbrightness、color_temp、rgb_color、hs_color、effect
climatetemperature、current_temperature、hvac_action、preset_mode
media_playervolume_level、media_title、media_artist、source
covercurrent_position、current_tilt_position
weathertemperature、humidity、pressure、wind_speed、forecast
personsource、latitude、longitude、gps_accuracy
sunelevation、azimuth、next_rising、next_setting
属性へのアクセス
# In templates
{{ state_attr('light.living_room', 'brightness') }}
{{ state_attr('climate.thermostat', 'current_temperature') }}
{{ state_attr('sun.sun', 'elevation') }}

# In conditions
condition:
  - condition: numeric_state
    entity_id: light.living_room
    attribute: brightness
    above: 100

クイックリファレンス

状態関数
関数説明例
states('entity')状態を取得states('sensor.temp')
state_attr('entity', 'attr')属性を取得state_attr('light.x', 'brightness')
is_state('entity', 'value')状態を確認is_state('light.x', 'on')
is_state_attr('entity', 'attr', 'val')属性を確認is_state_attr('climate.x', 'hvac_action', 'heating')
states.domainドメイン内のすべてのエンティティstates.light
expand('group.x')グループのメンバーを展開expand('group.all_lights')

Agentic Optimizations

ContextCommand
Find entity usagegrep -r "entity_id:" config/ --include="*.yaml"
List customizationsgrep -rA2 "^[a-z_]*\\..*:" config/customize.yaml
Find template sensorsgrep -rB2 "platform: template" config/ --include="*.yaml"
Find groupsgrep -rA5 "^group:" config/ --include="*.yaml"
List domains usedgrep -roh "[a-z_]*\\." config/ --include="*.yaml" | sort -u

コメント