J’ai trouvé si ça peut servir à d’autres
type: picture-elements
style: |
ha-card {
{% set state = states('sensor.frigo_3') %}
{% if is_number(state) and (state | float < 30 and state | float > 10) %}
--my-state-color: red;
{% elif is_number(state) and (state | float < 10 and state | float > 0) %}
--my-state-color: green;
{% endif %}
}
ha-card {
{% set state = states('sensor.frizzeur_3') %}
{% if is_number(state) and (state | float < 20 and state | float > -10) %}
--my-state-color-1: red;
{% elif is_number(state) and (state | float < -10 and state | float > -30) %}
--my-state-color-1: green;
{% endif %}
}
ha-card {
{% set state = states('sensor.congelateur_3') %}
{% if is_number(state) and (state | float < 20 and state | float > -10) %}
--my-state-color-2: red;
{% elif is_number(state) and (state | float < -10 and state | float > -30) %}
--my-state-color-2: green;
{% endif %}
}
ha-card {
{% set state = states('sensor.exterieur_temperature') %}
{% if is_number(state) and (state | float < -20 and state | float > 0) %}
--my-state-color-3: red;
{% elif is_number(state) and (state | float < 30 and state | float > 0) %}
--my-state-color-3: green;
{% endif %}
}
elements:
- type: state-badge
entity: sensor.exterieur_temperature
style:
top: 50%
left: 5%
font-size: 8px
color: transparent
'--label-badge-text-color': var(--my-state-color-3)
- type: state-badge
entity: sensor.congelateur_3
style:
top: 90%
left: 34%
font-size: 8px
color: transparent
'--label-badge-text-color': var(--my-state-color-2)
- type: state-badge
entity: sensor.frigo_3
style:
top: 45%
left: 17%
font-size: 8px
color: transparent
'--label-badge-text-color': var(--my-state-color)
- type: state-badge
entity: sensor.frizzeur_3
style:
top: 45%
left: 21%
font-size: 8px
color: transparent
'--label-badge-text-color': var(--my-state-color-1)
image: /local/floor/Eteint.png