首先安装需要的卡片
1. button-card
2. mini-graph-card
代码如下:
type: custom:button-card
styles:
card:
- width: 100%
- height: 300px
- padding: 10px
grid:
- grid-template-areas: |
"b1 b1 b1 b1 b1 b1 b1 b1 b1 b1"
"b2 e e e e e b5 s1 s1 b4"
"b2 e e e e e b5 b6 b6 b4"
"b2 e e e e e b5 s2 s2 b4"
"b2 e e e e e b5 b7 b7 b4"
"b2 e e e e e b5 s3 s3 b4"
"b2 b8 b8 b8 b8 b8 b8 b8 b8 b4"
"b2 g g g g g g g g b4"
"b2 g g g g g g g g b4"
"b2 g g g g g g g g b4"
"b2 b3 b3 b3 b3 b3 b3 b3 b3 b3"
- grid-template-columns: repeat(10, minmax(20px, 1fr))
- grid-template-rows: repeat(11, minmax(20px, 1fr))
custom_fields:
e:
card:
type: custom:button-card
show_entity_picture: true
entity_picture: /local/images/icons/router.png
styles:
card:
- width: 200px
- height: 230px
entity_picture:
- width: 200px
- height: 230px
s1:
card:
type: custom:button-card
entity: sensor.ikuai_cpu_temperature
show_icon: false
show_name: false
styles:
grid:
- grid-template-areas: ""i s""
- grid-template-columns: 30px 50px
- grid-template-rows: 50px
card:
- width: 60px
- height: 1fr
custom_fields:
i:
card:
type: custom:button-card
show_entity_picture: true
show_name: true
entity_picture: /local/images/icons/CPU.png
styles:
card:
- width: 30px
- height: 30px
- padding: 0
name:
- font-size: 12px
entity_picture:
- width: 20px
- height: 20px
s:
card:
type: custom:button-card
entity: sensor.ikuai_cpu_temperature
show_name: false
show_icon: false
show_state: true
styles:
state:
- font-size: 12px
card:
- width: 30px
s2:
card:
type: custom:button-card
entity: sensor.ikuai_online_user
show_icon: false
show_name: false
styles:
grid:
- grid-template-areas: ""i s""
- grid-template-columns: 30px 50px
- grid-template-rows: 50px
card:
- width: 60px
- height: 1fr
custom_fields:
i:
card:
type: custom:button-card
show_entity_picture: true
show_name: true
entity_picture: /local/images/icons/connect.png
styles:
card:
- width: 30px
- height: 30px
- padding: 0
name:
- font-size: 12px
entity_picture:
- width: 20px
- height: 20px
s:
card:
type: custom:button-card
entity: sensor.ikuai_online_user
show_name: false
show_icon: false
show_state: true
styles:
state:
- font-size: 12px
card:
- width: 30px
s3:
card:
type: custom:button-card
entity: sensor.ikuai_memory
show_icon: false
show_name: false
styles:
grid:
- grid-template-areas: ""i s""
- grid-template-columns: 30px 50px
- grid-template-rows: 50px
card:
- width: 60px
- height: 1fr
custom_fields:
i:
card:
type: custom:button-card
show_entity_picture: true
show_name: true
entity_picture: /local/images/icons/memory.png
styles:
card:
- width: 30px
- height: 30px
- padding: 0
name:
- font-size: 12px
entity_picture:
- width: 20px
- height: 20px
s:
card:
type: custom:button-card
entity: sensor.ikuai_memory
show_name: false
show_icon: false
show_state: true
styles:
state:
- font-size: 12px
card:
- width: 30px
g:
card:
type: custom:mini-graph-card
entities:
- entity: sensor.ikuai_download
name: 下行
- entity: sensor.ikuai_upload
name: 上行
animate: true
update_interval: 5
show:
state: false
name: false
icon: false
points: true
styles:
card:
- width: 160px
- height: 60px
附上使用到的图标
图标需要放在www/images/icons文件夹里
实体需要替换成自己的实体
|