本帖最后由 消逝 于 2024-8-9 22:43 编辑
18、右边动作调修改对应实体就行了
- type: image
info: '************************ 右边状态栏 ************************'
- type: custom:button-card
styles:
grid:
- grid-template-areas: |
"bar1" "bar2" "bar3" "bar4" "bar5" "bar6"
- grid-template-columns: 60px
- grid-template-rows: 80px 80px 80px 80px 80px 80px
card:
- '--mdc-ripple-press-opacity': 0
- width: 60px
- height: 480px
style:
left: 970px
top: 460px
custom_fields:
bar1:
card:
type: custom:button-card
entity: sensor.fullroom_climate_num
tap_action:
action: more-info
show_icon: true
show_name: true
icon: mdi:air-conditioner
name: 空调
custom_fields:
num: |
[[[ return states['sensor.fullroom_climate_num'].state;]]]
styles:
custom_fields:
num:
- background: >
[[[ var num
=states['sensor.fullroom_climate_num'].state;
if (num> 0) return 'DeepSkyBlue';
if (num==0) return 'transparent'; ]]]
- color: >
[[[ var num
=states['sensor.fullroom_climate_num'].state;
if (num> 0) return 'white';
if (num==0) return 'transparent'; ]]]
- padding: 1px 1px 0 1px
- font-size: 12px
- font-weight: bold
- width: 16px
- height: 16px
- border-radius: 100%
- position: absolute
- margin-left: 40px
- align-self: start
icon:
- padding: 5px 0 0 0
- color: >
[[[ var num
=states['sensor.fullroom_climate_num'].state;
if (num> 0) return 'DeepSkyBlue';
if (num==0) return 'white'; ]]]
name:
- padding: 0 0 5px 0
- font-size: 14px
- font-weight: bold
card:
- '--mdc-ripple-press-opacity': 0.1
- padding: 0 0 0 0
- width: 60px
- height: 65px
- border-radius: 10px
- background: >-
linear-gradient(180deg, transparent 0%,rgba(0,0,0,0.4)
50%)
bar2:
card:
type: custom:button-card
entity: sensor.fullroom_humidifier_num
tap_action:
action: more-info
show_icon: true
show_name: true
icon: mdi:air-humidifier
name: 加湿器
custom_fields:
num: >
[[[ return
states['sensor.fullroom_humidifier_num'].state;]]]
styles:
custom_fields:
num:
- background: >
[[[ var num
=states['sensor.fullroom_humidifier_num'].state;
if (num> 0) return 'DeepSkyBlue';
if (num==0) return 'transparent'; ]]]
- color: >
[[[ var num
=states['sensor.fullroom_humidifier_num'].state;
if (num> 0) return 'white';
if (num==0) return 'transparent'; ]]]
- padding: 1px 1px 0 1px
- font-size: 12px
- font-weight: bold
- width: 16px
- height: 16px
- border-radius: 100%
- position: absolute
- margin-left: 40px
- align-self: start
icon:
- padding: 5px 0 0 0
- color: >
[[[ var num
=states['sensor.fullroom_humidifier_num'].state;
if (num> 0) return 'DeepSkyBlue';
if (num==0) return 'white'; ]]]
name:
- padding: 0 0 5px 0
- font-size: 14px
- font-weight: bold
card:
- '--mdc-ripple-press-opacity': 0.1
- padding: 0 0 0 0
- width: 60px
- height: 65px
- border-radius: 10px
- background: >-
linear-gradient(180deg, transparent 0%,rgba(0,0,0,0.4)
50%)
bar3:
card:
type: custom:button-card
entity: sensor.fullroom_fan_num
tap_action:
action: more-info
show_icon: true
show_name: true
icon: mdi:air-purifier
name: 净化器
custom_fields:
num: |
[[[ return states['sensor.fullroom_fan_num'].state;]]]
styles:
custom_fields:
num:
- background: >
[[[ var num
=states['sensor.fullroom_fan_num'].state;
if (num> 0) return 'LimeGreen';
if (num==0) return 'transparent'; ]]]
- color: >
[[[ var num
=states['sensor.fullroom_fan_num'].state;
if (num> 0) return 'white';
if (num==0) return 'transparent'; ]]]
- padding: 1px 1px 0 1px
- font-size: 12px
- font-weight: bold
- width: 16px
- height: 16px
- border-radius: 100%
- position: absolute
- margin-left: 40px
- align-self: start
icon:
- padding: 5px 0 0 0
- color: |
[[[ var num =states['sensor.fullroom_fan_num'].state;
if (num> 0) return 'LimeGreen';
if (num==0) return 'white'; ]]]
name:
- padding: 0 0 5px 0
- font-size: 14px
- font-weight: bold
card:
- '--mdc-ripple-press-opacity': 0.1
- padding: 0 0 0 0
- width: 60px
- height: 65px
- border-radius: 10px
- background: >-
linear-gradient(180deg, transparent 0%,rgba(0,0,0,0.4)
50%)
bar4:
card:
type: custom:button-card
entity: sensor.fullroom_yuba_num
tap_action:
action: more-info
show_icon: true
show_name: true
icon: mdi:hvac
name: 浴霸
custom_fields:
num: |
[[[ return states['sensor.fullroom_yuba_num'].state;]]]
styles:
custom_fields:
num:
- background: >
[[[ var num
=states['sensor.fullroom_yuba_num'].state;
if (num> 0) return 'DarkOrange';
if (num==0) return 'transparent'; ]]]
- color: >
[[[ var num
=states['sensor.fullroom_yuba_num'].state;
if (num> 0) return 'white';
if (num==0) return 'transparent'; ]]]
- padding: 1px 1px 0 1px
- font-size: 12px
- font-weight: bold
- width: 16px
- height: 16px
- border-radius: 100%
- position: absolute
- margin-left: 40px
- align-self: start
icon:
- padding: 5px 0 0 0
- color: |
[[[ var num =states['sensor.fullroom_yuba_num'].state;
if (num> 0) return 'DarkOrange';
if (num==0) return 'white'; ]]]
name:
- padding: 0 0 5px 0
- font-size: 14px
- font-weight: bold
card:
- '--mdc-ripple-press-opacity': 0.1
- padding: 0 0 0 0
- width: 60px
- height: 65px
- border-radius: 10px
- background: >-
linear-gradient(180deg, transparent 0%,rgba(0,0,0,0.4)
50%)
bar5:
card:
type: custom:button-card
entity: sensor.fullroom_media_num
tap_action:
action: more-info
show_icon: true
show_name: true
icon: mdi:multimedia
name: 媒体
custom_fields:
num: |
[[[ return states['sensor.fullroom_media_num'].state;]]]
styles:
custom_fields:
num:
- background: >
[[[ var num
=states['sensor.fullroom_media_num'].state;
if (num> 0) return 'Magenta';
if (num==0) return 'transparent'; ]]]
- color: >
[[[ var num
=states['sensor.fullroom_media_num'].state;
if (num> 0) return 'white';
if (num==0) return 'transparent'; ]]]
- padding: 1px 1px 0 1px
- font-size: 12px
- font-weight: bold
- width: 16px
- height: 16px
- border-radius: 100%
- position: absolute
- margin-left: 40px
- align-self: start
icon:
- padding: 5px 0 0 0
- color: >
[[[ var num
=states['sensor.fullroom_media_num'].state;
if (num> 0) return 'Magenta';
if (num==0) return 'white'; ]]]
name:
- padding: 0 0 5px 0
- font-size: 14px
- font-weight: bold
card:
- '--mdc-ripple-press-opacity': 0.1
- padding: 0 0 0 0
- width: 60px
- height: 65px
- border-radius: 10px
- background: >-
linear-gradient(180deg, transparent 0%,rgba(0,0,0,0.4)
50%)
bar6:
card:
type: custom:button-card
entity: sensor.fullroom_other_num
tap_action:
action: more-info
show_icon: true
show_name: true
icon: mdi:tune-variant
name: 其他
custom_fields:
num: |
[[[ return states['sensor.fullroom_other_num'].state;]]]
styles:
custom_fields:
num:
- background: >
[[[ var num
=states['sensor.fullroom_other_num'].state;
if (num> 0) return 'OrangeRed';
if (num==0) return 'transparent'; ]]]
- color: >
[[[ var num
=states['sensor.fullroom_other_num'].state;
if (num> 0) return 'white';
if (num==0) return 'transparent'; ]]]
- padding: 1px 1px 0 1px
- font-size: 12px
- font-weight: bold
- width: 16px
- height: 16px
- border-radius: 100%
- position: absolute
- margin-left: 40px
- align-self: start
icon:
- padding: 5px 0 0 0
- color: >
[[[ var num
=states['sensor.fullroom_other_num'].state;
if (num> 0) return 'OrangeRed';
if (num==0) return 'white'; ]]]
name:
- padding: 0 0 5px 0
- font-size: 14px
- font-weight: bold
card:
- '--mdc-ripple-press-opacity': 0.1
- padding: 0 0 0 0
- width: 60px
- height: 65px
- border-radius: 10px
- background: >-
linear-gradient(180deg, transparent 0%,rgba(0,0,0,0.4)
50%)
|