用途:该技能用于 Home Assistant 的实体(entity)与域(domain)管理,包含实体 ID、设备类、模板实体、分组以及各域专属属性。官方文档给出使用边界:处理实体域、定制实体、创建模板传感器、设置分组、处理设备类时使用本技能;而创建自动化规则、处理触发器/动作、编写自动化条件、脚本/场景及事件时,应改用 ha-automations。
主要能力:
- 实体 ID 结构:domain.object_id,例如 light.living_room_ceiling、sensor.outdoor_temperature、binary_sensor.front_door_contact、switch.garden_irrigation。
- 常见域:light、switch、sensor、binary_sensor、climate、cover、lock、media_player、camera、vacuum、fan、alarm_control_panel、person、device_tracker、weather、input_boolean、input_number、input_select、input_text、input_datetime、input_button、automation、script、scene、group、timer、counter、zone、sun。完整的设备类表(binary sensor 与 sensor)见 REFERENCE.md。
- 实体定制:在 customize.yaml 中可为单个实体或使用 customize_glob 通配设置 friendly_name、icon、device_class、unit_of_measurement。
- 模板传感器:在 template 段下定义 sensor,可含 state、attributes 与 availability,支持简单状态、带属性、可用性判断等写法;模板 binary sensor、switch、button、number、group、utility meter、counter、timer 见 REFERENCE.md。
- 状态属性:不同域有常见属性,如 light 的 brightness/color_temp,climate 的 temperature/current_temperature,media_player 的 volume_level,cover 的 current_position,weather 的温度湿度等。可通过 state_attr() 在模板中读取,或在 numeric_state 条件中按 attribute 判断。
- 状态函数速查:states()、state_attr()、is_state()、is_state_attr()、states.domain、expand()。
- 辅助检索命令:如 grep -r "entity_id:" config/ --include="*.yaml" 查找实体使用、grep -rA2 列出定制、grep -rB2 "platform: template" 查找模板传感器、grep -rA5 "^group:" 查找分组、grep -roh 列出所用域。
限制:资料未提供具体版本兼容性、平台收费或价格信息;除上述命令与配置外,未提供其他使用步骤或效果说明。