Hi, I am trying to change the color of the text value and prefix for an entity when the status of another entity is on or off.
I have done the below, but it does not change the color. what am I missing or doing wrong?
type: picture-elements
elements:
- type: state-label
entity: sensor.ithodaalderop_amber_domestic_hot_water_temperature
prefix: "TW (boiler): "
card_mod:
style: |
:host {
background: {{ 'red' if is_state(binary_sensor.ithodaalderop_amber_water_flow_switch, 'on') else 'black' }};
}
style:
top: 4%
left: 29%
And I tried with a variabel set:
- type: state-label
entity: sensor.ithodaalderop_amber_domestic_hot_water_temperature
prefix: "TW (boiler): "
card_mod:
style: >-
ha-card {
--boiler_heat: {% if state_attr('binary_sensor.ithodaalderop_amber_water_flow_switch') =="on" %} red {% else %} black {% endif %}
}
style:
top: 4%
left: 29%
color: var(--boiler_heat)
What am I doing wrong? or what is missing?