本帖最后由 Xxxxi 于 2023-10-11 10:07 编辑
楼主,根据你的代码我简单修改了一下。现在有一个问题:
我先创建了灯组:
然后做了如下的弹出卡片:
代码如下:
type: vertical-stack
cards:
- type: custom:bubble-card
card_type: pop-up
name: 餐厅
icon: mdi:microsoft-office
entity: group.canting_lights
hash: '#canting'
- type: grid
square: false
columns: 2
cards:
- type: custom:mushroom-entity-card
primary_info: state
secondary_info: name
name: 温度
fill_container: false
icon_color: green
layout: horizontal
entity: sensor.3429ef0b1eae_envtemperature
card_mod:
style: |
ha-card:active {
transform: scale(0.975);
transition: 0s;
}
ha-card {
box-shadow: none;
background: rgba(var(--rgb-primary-text-color), 0.06);
}
- type: custom:mushroom-entity-card
primary_info: state
secondary_info: name
name: 湿度
icon_color: blue
entity: sensor.3429ef0b1eae_envhumidity
card_mod:
style: |
ha-card:active {
transform: scale(0.975);
transition: 0s;
}
ha-card {
box-shadow: none;
background: rgba(var(--rgb-primary-text-color), 0.06);
}
- type: custom:bubble-card
card_type: separator
name: 灯光
icon: mdi:lightbulb
- type: custom:mushroom-entity-card
entity: switch.d4f0eaeab24b_switch
name: 餐厅主灯
tap_action:
action: toggle
- type: custom:mushroom-entity-card
entity: switch.d4f0eaeab81d_switch
name: 餐厅筒灯
tap_action:
action: toggle
- type: custom:mushroom-entity-card
entity: switch.d4f0eaeab27d_switch
name: 餐厅吊灯
tap_action:
action: toggle
- type: custom:bubble-card
card_type: separator
icon: mdi:fridge
name: 冰箱
- square: false
type: grid
columns: 2
cards:
- type: custom:mushroom-template-card
primary: >-
冷藏室
{% if states('binary_sensor.3429ef0b1eae_refrigeratordoorstatus') ==
'on' %}
已开启
{% elif states('binary_sensor.3429ef0b1eae_refrigeratordoorstatus')
== 'off' %}
已关闭
{% endif%}
secondary: 当前温度:{{states('sensor.3429ef0b1eae_refrigeratortemperaturec')}}°C
icon: mdi:fridge-top
icon_color: blue
layout: horizontal
- type: custom:mushroom-template-card
primary: >-
冷冻室
{% if states('binary_sensor.3429ef0b1eae_freezerdoorstatus') == 'on'
%}
已开启
{% elif states('binary_sensor.3429ef0b1eae_freezerdoorstatus') ==
'off' %}
已关闭
{% endif%}
secondary: 当前温度:{{states('sensor.3429ef0b1eae_freezertemperaturec')}}°C
icon: mdi:fridge-bottom
icon_color: blue
layout: horizontal
现在的情况是,我的餐厅一共有三个灯。
如果我开启一盏灯的情况 ,然后点击顶部的开关按钮
就会将开启的灯关闭,但是同时会将其余两盏未开启的灯打开。
这是什么原因呢?请问你也是这种情况吗?
同时为了验证灯组的设置是否有问题,我单独创建了卡片去试验:
这种情况下,开启一盏,或者两盏灯,去关闭灯组开关,只会把所有灯都关闭,不会打开其余未开启的灯。
希望楼主可以解惑。感谢。
|