############左边插排##############
- type: horizontal-stack #水平
cards:
- type: 'custom:button-card'
entity: 'switch.zdc1_plug0_84f3eb9d9f1f'
icon: 'mdi:power'
name: 客厅左插排
show_name: false
lock:
enabled: true
unlock: hold
tap_action:
action: toggle
confirmation:
text: '[[[ return `确定开关 ${entity.attributes.friendly_name}?` ]]]'
exemptions: []
state:
- value: 'off'
styles:
card:
- filter: opacity(80%)
icon:
- filter: grayscale(100%)
styles:
card:
- color: white
- font-size: 16px
- text-transform: capitalize
- height: 185px
grid:
- grid-template-areas: '"i i" "current current" "voltage voltage" "power power"'
- grid-template-columns: 1fr 1fr
- grid-template-rows: min-conten 1fr 1fr 1fr 1fr
img_cell:
- justify-content: start
- align-items: start
- margin: none
icon:
- color: >
[[[
if (entity.state == "on") return 'red';
else return 'white';
]]]
- width: 40%
- margin-top: 10%
- margin-left: 30%
custom_fields:
current:
- padding-bottom: 15px
- padding-left: 10px
- align-self: middle
- justify-self: start
- --text-color-sensor: '[[[ if (states["sensor.zdc1_current_84f3eb9d9f1f"].state > 0.1) return "white"; ]]]'
voltage:
- padding-bottom: 15px
- padding-left: 10px
- align-self: middle
- justify-self: start
- --text-color-sensor: '[[[ if (states["sensor.zdc1_voltage_84f3eb9d9f1f"].state > 220) return "white"; ]]]'
power:
- padding-bottom: 10px
- padding-left: 10px
- align-self: middle
- justify-self: start
- --text-color-sensor: '[[[ if (states["sensor.zdc1_power_84f3eb9d9f1f"].state > 0.1) return "white"; ]]]'
custom_fields:
current: >
[[[
return `<ha-icon
icon="mdi:flash-auto"
style="width: 18px; height: 18px; color: white;">
</ha-icon><span> <span style="color: var(--text-color-sensor);">${states['sensor.zdc1_current_84f3eb9d9f1f'].state}A</span></span>`
]]]
voltage: >
[[[
return `<ha-icon
icon="mdi:flash"
style="width: 18px; height: 18px; color: white;">
</ha-icon><span> <span style="color: var(--text-color-sensor);">${states['sensor.zdc1_voltage_84f3eb9d9f1f'].state}V</span></span>`
]]]
power: >
[[[
return `<ha-icon
icon="mdi:gauge"
style="width: 18px; height: 18px; color: white;">
</ha-icon><span> <span style="color: var(--text-color-sensor);">${states['sensor.zdc1_power_84f3eb9d9f1f'].state}W</span></span>`
]]]
- type: 'custom:button-card'
entity: switch.zdc1_plug1_84f3eb9d9f1f
name: Switch
icon: 'mdi:power'
show_entity_picture: true
entity_picture: /local/pic/1.png
styles:
entity_picture:
- width: 100%
- padding-bottom: 0%
card:
- height: 185px
- padding: 0px
state:
- value: 'off'
styles:
card:
- filter: opacity(80%)
icon:
- filter: grayscale(100%)
tap_action:
action: toggle
confirmation:
text: '[[[ return `确定开关 ${entity.attributes.friendly_name}?` ]]]'
exemptions: []
- type: 'custom:button-card'
entity: switch.zdc1_plug2_84f3eb9d9f1f
name: 天猫精灵
icon: 'mdi:power'
show_entity_picture: true
entity_picture: /local/pic/6.png
styles:
entity_picture:
- width: 100%
- padding-bottom: 0%
card:
- height: 185px
- padding: 0px
state:
- value: 'off'
styles:
card:
- filter: opacity(80%)
icon:
- filter: grayscale(100%)
tap_action:
action: toggle
confirmation:
text: '[[[ return `确定开关 ${entity.attributes.friendly_name}?` ]]]'
exemptions: []
- type: 'custom:button-card'
entity: switch.zdc1_plug3_84f3eb9d9f1f
name: 空闲
icon: 'mdi:power'
show_entity_picture: true
entity_picture: /local/pic/9.png
styles:
entity_picture:
- width: 100%
- padding-bottom: 0%
card:
- height: 185px
- padding: 0px
state:
- value: 'off'
styles:
card:
- filter: opacity(80%)
icon:
- filter: grayscale(100%)
tap_action:
action: toggle
confirmation:
text: '[[[ return `确定开关 ${entity.attributes.friendly_name}?` ]]]'
exemptions: []
|