『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
楼主: qiaofei828

[UI界面] 蘑菇卡片分享

  [复制链接]

0

主题

23

帖子

192

积分

注册会员

Rank: 2

积分
192
金钱
169
HASS币
0
发表于 2024-6-30 23:13:02 | 显示全部楼层

代码交出来
回复

使用道具 举报

0

主题

47

帖子

266

积分

中级会员

Rank: 3Rank: 3

积分
266
金钱
219
HASS币
0
发表于 2024-7-6 18:20:52 | 显示全部楼层
感谢分享
回复

使用道具 举报

1

主题

30

帖子

159

积分

注册会员

Rank: 2

积分
159
金钱
129
HASS币
0
发表于 2024-7-22 16:09:34 | 显示全部楼层

状态栏
type: custom:stack-in-card
cards:
  - type: custom:layout-card
    layout_type: masonry
    layout: {}
    cards:
      - type: horizontal-stack
        cards:
          - type: custom:mushroom-template-card
            icon: |
              {% if is_state(entity, 'online') %}
                mdi:wifi
              {% elif is_state(entity, 'driving') %}
                mdi:steering
              {% elif is_state(entity, 'asleep') %}
                mdi:sleep
              {% elif is_state(entity, 'charging') %}
                mdi:battery-charging
              {% else %}
                mdi:help-rhombus
              {% endif %}
            icon_color: |
              {{ 'green' if is_state(entity, 'online') else 'grey' }}
            primary: 当前
            secondary: |
              {% if is_state(entity, 'online') %}
                在线
              {% elif is_state(entity, 'asleep') %}
                睡眠
              {% elif is_state(entity, 'charging') %}
                充电
              {% elif is_state(entity, 'driving') %}
                行驶中
              {% else %}
                未知
              {% endif %}
            entity: sensor.zhuang_tai
            fill_container: false
            multiline_secondary: false
            layout: vertical
            card_mod:
              style: |
                mushroom-card {
                  background-size: 42px 42px;
                }
                ha-card {
                  width: 68px;
                  border-radius: 30px;
                  margin-left: auto;
                  margin-right: auto;
                }
            tap_action:
              action: more-info
          - type: custom:mushroom-template-card
            icon: mdi:shield-home
            icon_color: |
              {{ 'green' if is_state(entity, 'true') else 'grey' }}
            primary: 哨兵
            secondary: '{{ ''开'' if is_state(entity, ''true'') else ''关'' }} '
            entity: sensor.shao_bing_mo_shi
            fill_container: false
            multiline_secondary: false
            layout: vertical
            card_mod:
              style: |
                mushroom-card {
                  background-size: 42px 42px;
                }
                ha-card {
                  width: 68px;
                  border-radius: 30px;
                  margin-left: auto;
                  margin-right: auto;
                }
            tap_action:
              action: more-info
          - type: custom:mushroom-template-card
            icon: mdi:lock
            icon_color: |
              {{ 'blue' if is_state(entity, 'true') else 'grey' }}
            primary: 车锁
            secondary: '{{ ''已锁'' if is_state(entity, ''true'') else ''未锁'' }} '
            entity: sensor.zhi_shi_che_liang_shi_fou_yi_suo_zhi
            fill_container: false
            multiline_secondary: false
            layout: vertical
            card_mod:
              style: |
                mushroom-card {
                  background-size: 42px 42px;
                }
                ha-card {
                  width: 68px;
                  border-radius: 30px;
                  margin-left: auto;
                  margin-right: auto;
                }
            tap_action:
              action: more-info
          - type: custom:mushroom-template-card
            icon: >
              {% set battery_level =
              states('sensor.dian_chi_dian_liang_bai_fen_bi') | int %}

              {% if battery_level < 20 %}
                mdi:battery-20
              {% elif battery_level >= 80 %}
                mdi:battery
              {% else %}
                mdi:battery-80
              {% endif %}
            icon_color: >
              {% set battery_level =
              states('sensor.dian_chi_dian_liang_bai_fen_bi') | int %}

              {% if battery_level < 20 %}
                red
              {% elif battery_level >= 80 %}
                brown
              {% else %}
                green
              {% endif %}
            primary: 电量
            secondary: |
              {{ states('sensor.dian_chi_dian_liang_bai_fen_bi') }}%
            entity: sensor.dian_chi_dian_liang_bai_fen_bi
            fill_container: false
            multiline_secondary: false
            layout: vertical
            card_mod:
              style: |
                mushroom-card {
                  background-size: 42px 42px;
                }
                ha-card {
                  width: 68px;
                  border-radius: 30px;
                  margin-left: auto;
                  margin-right: auto;
                }
            tap_action:
              action: more-info
          - type: custom:mushroom-template-card
            icon: mdi:ev-station
            icon_color: |
              {{ 'green' if is_state(entity, 'true') else 'grey' }}
            primary: 充电器
            secondary: '{{ ''已插入'' if is_state(entity, ''true'') else ''未插入'' }} '
            entity: sensor.ru_guo_che_liang_dang_qian_yi_cha_ru_chong_dian_qi
            fill_container: false
            multiline_secondary: false
            layout: vertical
            card_mod:
              style: |
                mushroom-card {
                  background-size: 42px 42px;
                }
                ha-card {
                  width: 68px;
                  border-radius: 30px;
                  margin-left: auto;
                  margin-right: auto;
                }
            tap_action:
              action: more-info
card_mod:
  style: |
    ha-card {
      padding: 2px;
      background: rgba(var(--rgb-primary-text-color), 0.01);
    }
回复

使用道具 举报

1

主题

30

帖子

159

积分

注册会员

Rank: 2

积分
159
金钱
129
HASS币
0
发表于 2024-7-22 16:10:44 | 显示全部楼层

温度
type: custom:vertical-stack-in-card
cards:
  - type: grid
    square: false
    columns: 2
    cards:
      - type: custom:mushroom-entity-card
        entity: sensor.nei_bu_wen_du
        primary_info: state
        secondary_info: name
        name: 车内温度
        icon_color: green
      - type: custom:mushroom-entity-card
        entity: sensor.wai_bu_wen_du
        primary_info: state
        secondary_info: name
        name: 车外温度
        icon_color: blue
  - type: custom:mini-graph-card
    entities:
      - entity: sensor.nei_bu_wen_du
        name: 车内温度
        color: var(--green-color)
      - entity: sensor.wai_bu_wen_du
        name: 车外温度
        color: var(--blue-color)
        y_axis: secondary
    hours_to_show: 24
    line_width: 3
    font_size: 50
    animate: true
    show:
      name: false
      icon: false
      state: false
      legend: false
      fill: fade
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-24 05:58 , Processed in 0.112405 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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