Lovelace Multiple Entity Row 使用教程
项目介绍
Lovelace Multiple Entity Row 是一个 Home Assistant 的自定义卡片组件,允许用户在 Lovelace UI 中一行显示多个实体。这个组件特别适合需要在一个视图中展示多个相关实体信息的用户,比如显示温度和湿度传感器的数据,或者在一个行中展示多个开关的状态。
项目快速启动
安装
- 首先,确保你已经安装了 Home Assistant。
- 在 Home Assistant 的
configuration.yaml
文件中添加以下代码来安装lovelace-multiple-entity-row
:
resources:
- url: /hacsfiles/lovelace-multiple-entity-row/lovelace-multiple-entity-row.js
type: module
- 重启 Home Assistant 以应用更改。
配置
在 Lovelace UI 的 ui-lovelace.yaml
文件中添加以下配置来使用 lovelace-multiple-entity-row
:
type: entities
entities:
- type: 'custom:multiple-entity-row'
entity: sensor.temperature
name: 温度和湿度
secondary_info: last-changed
entities:
- entity: sensor.humidity
name: 湿度
应用案例和最佳实践
案例一:显示温度和湿度
假设你有两个传感器,一个用于温度,一个用于湿度,你可以使用 lovelace-multiple-entity-row
在一行中同时显示这两个数据:
type: entities
entities:
- type: 'custom:multiple-entity-row'
entity: sensor.temperature
name: 温度和湿度
secondary_info: last-changed
entities:
- entity: sensor.humidity
name: 湿度
案例二:显示多个开关状态
如果你有多个开关,并希望在一个视图中查看它们的状态,可以这样配置:
type: entities
entities:
- type: 'custom:multiple-entity-row'
entity: switch.living_room_light
name: 客厅灯光
entities:
- entity: switch.bedroom_light
name: 卧室灯光
- entity: switch.kitchen_light
name: 厨房灯光
典型生态项目
Lovelace Multiple Entity Row 是 Home Assistant 生态系统中的一个组件,它与 Home Assistant 的其他组件和插件兼容良好。以下是一些典型的生态项目:
- Home Assistant: 一个开源的家庭自动化平台,允许用户通过一个集中的系统控制家中的各种设备。
- Lovelace UI: Home Assistant 的默认用户界面,支持自定义卡片和组件。
- HACS (Home Assistant Community Store): 一个社区驱动的存储库,提供各种自定义组件和插件,包括
lovelace-multiple-entity-row
。
通过这些生态项目,用户可以扩展和定制他们的 Home Assistant 系统,以满足特定的自动化需求。