找回密码
 立即注册

微信扫码登录

搜索
查看: 592|回复: 6

[UI界面] 软路由ikuai的监控UI卡片

[复制链接]

1

主题

7

回帖

68

积分

注册会员

积分
68
金钱
60
HASS币
0
发表于 2025-7-21 11:49:29 | 显示全部楼层 |阅读模式
首先安装需要的卡片

1. button-card
2. mini-graph-card
image.png

代码如下:
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文件夹里
实体需要替换成自己的实体
image.png
connect.png
memory.png
CPU.png
回复

使用道具 举报

kndo 手机认证

2

主题

39

回帖

489

积分

中级会员

积分
489
金钱
448
HASS币
0
发表于 2025-7-21 17:08:20 | 显示全部楼层
学到了

                               
登录/注册后可看大图

button card+css grid
回复

使用道具 举报

25

主题

298

回帖

2305

积分

金牌会员

积分
2305
金钱
1982
HASS币
0
发表于 2025-7-21 19:00:42 | 显示全部楼层
感谢分享
回复

使用道具 举报

0

主题

105

回帖

942

积分

高级会员

积分
942
金钱
837
HASS币
0
发表于 2025-7-23 18:06:55 | 显示全部楼层
开心版能用吗?
回复

使用道具 举报

8

主题

188

回帖

1342

积分

论坛技术达人

积分
1342
金钱
1141
HASS币
40
发表于 7 天前 | 显示全部楼层
本帖最后由 2CMOL 于 2025-7-26 18:43 编辑

貌似这个不止是要这么点插件吧? 我叫群里面好几个老哥试了下 发现排版都有问题
image.png
回复

使用道具 举报

0

主题

46

回帖

243

积分

中级会员

积分
243
金钱
197
HASS币
0
发表于 6 天前 | 显示全部楼层
我也出现楼上的问题
回复

使用道具 举报

2

主题

501

回帖

3144

积分

论坛元老

积分
3144
金钱
2641
HASS币
0
QQ
发表于 3 天前 | 显示全部楼层
本帖最后由 [email protected] 于 2025-7-31 09:08 编辑

微信截图_20250731090529.png

type: custom:button-card
styles:
  card:
    - width: 100%
    - height: 345px
    - padding: 5px
    - display: flex
  grid:
    - grid-template-areas: |
        "b1 b1 b1 b1 b1 b1 b1 b1 b1 bb1"
        "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 e  e  e  e  e  b5 b8 b8 b4"
        "b2 e  e  e  e  e  b5 s4 s4 b4"
        "b2 b9 b9 b9 b9 b9 b9 b9 b9 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(5.5, minmax(0, 1fr))
    - grid-template-rows: repeat(1, minmax(0, 1fr))
    - align-items: center
    - gap: 3px
custom_fields:
  e:
    card:
      type: custom:button-card
      show_entity_picture: true
      entity_picture: /local/UI/IK1800.png
      styles:
        card:
          - width: 200px
          - height: 200px
        entity_picture:
          - width: 200px
          - height: 200px
  s1:
    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: 35px 50px
          - grid-template-rows: 30px
        card:
          - width: 120px
          - height: 40px
      custom_fields:
        i:
          card:
            type: custom:button-card
            show_entity_picture: true
            show_name: true
            entity_picture: /local/UI/CPU.png
            styles:
              card:
                - width: 30px
                - height: 30px
                - padding: 0
              name:
                - font-size: 13px
              entity_picture:
                - width: 20px
                - height: 20px
        s:
          card:
            type: custom:button-card
            entity: sensor.ikuai_cpu
            show_name: false
            show_icon: false
            show_state: true
            styles:
              state:
                - font-size: 12px
              card:
                - width: 78px
  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: 35px 50px
          - grid-template-rows: 30px
        card:
          - width: 120px
          - height: 40px
      custom_fields:
        i:
          card:
            type: custom:button-card
            show_entity_picture: true
            show_name: true
            entity_picture: /local/UI/connect.png
            styles:
              card:
                - width: 30px
                - height: 30px
                - padding: 0
              name:
                - font-size: 13px
              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: 78px
  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: 35px 50px
          - grid-template-rows: 30px
        card:
          - width: 120px
          - height: 40px
      custom_fields:
        i:
          card:
            type: custom:button-card
            show_entity_picture: true
            show_name: true
            entity_picture: /local/UI/memory.png
            styles:
              card:
                - width: 30px
                - height: 30px
                - padding: 0
              name:
                - font-size: 13px
              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: 78px
  s4:
    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: 35px 50px
          - grid-template-rows: 30px
        card:
          - width: 120px
          - height: 40px
      custom_fields:
        i:
          card:
            type: custom:button-card
            show_entity_picture: true
            show_name: true
            entity_picture: /local/UI/memory.png
            styles:
              card:
                - width: 30px
                - height: 30px
                - padding: 0
              name:
                - font-size: 13px
              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: 78px
  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

简单下修复,给有需要的人
image.png
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )

GMT+8, 2025-8-2 15:01 , Processed in 0.067601 second(s), 11 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表