我在home assistant中写的一段UI代码,{% if is_state(entity, 'off') %} ha-card {--chip-background: #FFED97;} {% endif %}这段代码不起作用,但把{% if is_state(entity, 'off') %} 和{% endif %}去掉就可以,但这样就不能判断了,请问怎么更改
是这个卡片不允许这样写吗
- type: custom:mushroom-chips-card
alignment: justify
chips:
- type: template
entity: climate.keting_aux
tap_action:
action: call-service
service: climate.set_hvac_mode
target:
entity_id: climate.keting_aux
data:
hvac_mode: 'off'
icon: mdi:power
icon_color: |
{% if is_state(entity, 'off') %}
amber
{% else %}
grey
{% endif %}
content: 关闭
card_mod:
style: |
{% if is_state(entity, 'off') %}
ha-card {--chip-background: #FFED97;}
{% endif %}
|