ha-entities について
Home Assistant のエンティティを扱うユーザーやエージェント向けのリファレンススキルです。ドメインやカスタマイズ、テンプレート、グループ、属性、状態の参照を扱い、自動化ルールは対象外です。
主な機能
- 01エンティティのドメインと ID
- 02エンティティのカスタマイズ
- 03テンプレートセンサー
- 04グループとデバイスクラス
- 05状態と属性の参照
活用シーン
- 01適切なエンティティドメインの特定
- 02エンティティ名とアイコンの変更
- 03テンプレートセンサーの作成
- 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_ceilingsensor.outdoor_temperaturebinary_sensor.front_door_contactswitch.garden_irrigation
一般的なドメイン
| ドメイン | 説明 | 例 |
|---|---|---|
light | 照明の制御 | light.kitchen |
switch | オン/オフスイッチ | switch.outlet |
sensor | 数値センサー | sensor.temperature |
binary_sensor | オン/オフセンサー | binary_sensor.motion |
climate | HVAC の制御 | 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 を参照してください。
状態属性
一般的な属性
| ドメイン | 一般的な属性 |
|---|---|
light | brightness、color_temp、rgb_color、hs_color、effect |
climate | temperature、current_temperature、hvac_action、preset_mode |
media_player | volume_level、media_title、media_artist、source |
cover | current_position、current_tilt_position |
weather | temperature、humidity、pressure、wind_speed、forecast |
person | source、latitude、longitude、gps_accuracy |
sun | elevation、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
| Context | Command |
|---|---|
| Find entity usage | grep -r "entity_id:" config/ --include="*.yaml" |
| List customizations | grep -rA2 "^[a-z_]*\\..*:" config/customize.yaml |
| Find template sensors | grep -rB2 "platform: template" config/ --include="*.yaml" |
| Find groups | grep -rA5 "^group:" config/ --include="*.yaml" |
| List domains used | grep -roh "[a-z_]*\\." config/ --include="*.yaml" | sort -u |
コメント
Markdown 対応