
在homeassistant中,自带的图标效果并非所爱。我们可以通过安装第三方卡片的形式展现图表。

自带的图表样式
接下来,我们在HACS中搜索并安装apexcharts-card插件。

安装完成后,添加对应卡片。

添加完成后。编辑相应的代码。

几个核心参数:
header: #配置标题
show: true #显示标题
title: 逍遥子大表哥 #标题名称
show_states: true #标题状态
colorize_states: true #标题颜色
实体配置:
series:
- entity: sensor.temp02_temperature #实体名称
type: column #实体类型 默认为线,column为柱
如果你想配置多条线。你可以配置添加多个- entity:即可。
一个完整的示例:
type: custom:apexcharts-card
header:
show: true
title: DHT11设备
show_states: true
colorize_states: true
series:
- entity: sensor.temp02_temperature
group_by:
func: last
duration: 5m
stroke_width: 2
show:
extremas: true
header_color_threshold: true
color_threshold:
- value: 18
color: steelblue
- value: 21
color: midnightblue
- value: 22
color: orange
- value: 23
color: orangered
- value: 26
color: red
- entity: sensor.humidity_humidity
group_by:
func: last
duration: 5m
stroke_width: 2
show:
extremas: true
header_color_threshold: true

显示效果
当然,还支持其他效果的展示,下面是官方的几个例子。


