- element: switch.zdc1_plug0_84f3eb9d9f1f
tap_action:
action: fire-dom-event
browser_mod:
service: browser_mod.popup
data:
content:
type: horizontal-stack
cards:
- type: custom:button-card
entity: switch.zdc1_logoled_84f3eb9d9f1f
tap_action:
action: toggle
show_name: false
styles:
card:
- color: white
- font-size: 8px
- text-transform: capitalize
- height: 100px
- padding: 10%
custom_fields:
current:
- padding-bottom: 1px
- padding-left: 3px
- justify-self: start
- '--text-color-sensor': >-
[[[ if
(states["switch.zdc1_logoled_84f3eb9d9f1f"].state ==
"off") return "grey"; ]]]
power:
- padding-bottom: 1px
- padding-left: 3px
- justify-self: start
- '--text-color-sensor': >-
[[[ if
(states["switch.zdc1_logoled_84f3eb9d9f1f"].state ==
"off") return "grey"; ]]]
voltage:
- padding-bottom: 1px
- padding-left: 3px
- justify-self: start
- '--text-color-sensor': >-
[[[ if
(states["switch.zdc1_logoled_84f3eb9d9f1f"].state ==
"off") return "grey"; ]]]
today:
- padding-bottom: 1px
- padding-left: 3px
- justify-self: start
- '--text-color-sensor': >-
[[[ if
(states["switch.zdc1_logoled_84f3eb9d9f1f"].state ==
"off") return "grey"; ]]]
yesterday:
- padding-bottom: 1px
- padding-left: 3px
- justify-self: start
- '--text-color-sensor': >-
[[[ if
(states["switch.zdc1_logoled_84f3eb9d9f1f"].state ==
"off") return "grey"; ]]]
grid:
- grid-template-areas: ' "current current" "voltage voltage" "power power" "today today" "yesterday yesterday"'
- grid-template-columns: min-content
- grid-template-rows: >-
min-content min-content min-content min-content
min-content
img_cell:
- justify-content: start
- align-items: start
- margin: none
custom_fields:
current: |
[[[
return `电流<span> <span style="color: var(--text-color-sensor);">${states['sensor.zdc1_current_84f3eb9d9f1f'].state}A</span></span>`
]]]
power: |
[[[
return `功率<span> <span style="color: var(--text-color-sensor);">${states['sensor.zdc1_power_84f3eb9d9f1f'].state}W</span></span>`
]]]
voltage: |
[[[
return `电压<span> <span style="color: var(--text-color-sensor);">${states['sensor.zdc1_voltage_84f3eb9d9f1f'].state}V</span></span>`
]]]
today: |
[[[
return `今天<span> <span style="color: var(--text-color-sensor);">${states['sensor.zdc1_today_84f3eb9d9f1f'].state}度</span></span>`
]]]
yesterday: |
[[[
return `昨天<span> <span style="color: var(--text-color-sensor);">${states['sensor.zdc1_yesterday_84f3eb9d9f1f'].state}度</span></span>`
]]]
- type: custom:button-card
entity: switch.zdc1_plug0_84f3eb9d9f1f
entity_picture: /local/pic/12.png
icon: mdi:power
show_entity_picture: true
show_name: false
state:
- styles:
card:
- filter: opacity(80%)
icon:
- filter: grayscale(100%)
value: 'off'
styles:
card:
- height: 100px
- padding: 0px
entity_picture:
- width: 100%
- padding-bottom: 0%
tap_action:
action: toggle
confirmation:
exemptions: []
text: >-
[[[ return `确定${(entity.state === "on") ? "关闭" : "打开"}
${entity.attributes.friendly_name}?`]]]
- type: custom:button-card
entity: switch.zdc1_plug1_84f3eb9d9f1f
entity_picture: /local/pic/9.png
icon: mdi:power
show_entity_picture: true
show_name: false
state:
- styles:
card:
- filter: opacity(80%)
icon:
- filter: grayscale(100%)
value: 'off'
styles:
card:
- height: 100px
- padding: 0px
entity_picture:
- width: 100%
- padding-bottom: 0%
tap_action:
action: toggle
confirmation:
exemptions: []
text: >-
[[[ return `确定${(entity.state === "on") ? "关闭" : "打开"}
${entity.attributes.friendly_name}?`]]]
- type: custom:button-card
entity: switch.zdc1_plug2_84f3eb9d9f1f
entity_picture: /local/pic/9.png
icon: mdi:power
show_entity_picture: true
show_name: false
state:
- styles:
card:
- filter: opacity(80%)
icon:
- filter: grayscale(100%)
value: 'off'
styles:
card:
- height: 100px
- padding: 0px
entity_picture:
- width: 100%
- padding-bottom: 0%
tap_action:
action: toggle
confirmation:
exemptions: []
text: >-
[[[ return `确定${(entity.state === "on") ? "关闭" : "打开"}
${entity.attributes.friendly_name}?`]]]
- type: custom:button-card
entity: switch.zdc1_plug3_84f3eb9d9f1f
entity_picture: /local/pic/6.png
icon: mdi:power
show_entity_picture: true
show_name: false
state:
- styles:
card:
- filter: opacity(80%)
icon:
- filter: grayscale(100%)
value: 'off'
styles:
card:
- height: 100px
- padding: 0px
entity_picture:
- width: 100%
- padding-bottom: 0%
tap_action:
action: toggle
confirmation:
exemptions: []
text: >-
[[[ return `确定${(entity.state === "on") ? "关闭" : "打开"}
${entity.attributes.friendly_name}?`]]]
复制代码
UI配置代码大概是这样
固件使用了@情留メ蚊子 大佬的固件,自己魔改的
去除了一些我认为不需要擦写flash的地方(增加寿命),增加了logo灯控制(小孩晚上睡觉不要光),硬改了USB独立控制(大佬github上有说怎么改)