Mon problème
J’ai une variable sensor.edf_tempo_current
qui vaut soit BLANC, BLEU ou ROUGE (tarif tempo)
Je voudrais changer la couleur de mon icone dans le custom:multiple-entity-row
associer.
Or j’arrive pas a faire de test de comparaison de string
Je teste avec ça (mais ca me donne toujours la couleur orange ) :
style: |
:host
div.entity:nth-child(2) state-badge {
{% set edf = states('sensor.edf_tempo_current') %}
{% if edf==BLANC %}
color: light_grey;
{% elif edf==BLEU %}
color: blue;
{% elif edf == ROUGE %}
color: red;
{% else %}
color: orange;
{% endif %}
}
J’arrive a faire des tests numeriques, en voici un exemple qui me retourne jaune
en ce moment :
style: |
:host
div.entity:nth-child(2) state-badge {
{% set humidity = states('sensor.sonde_salon_humidity') | float(default=0) %}
{% if (humidity < 40) or (humidity > 80) %}
color: red;
{% elif (humidity > 40 and humidity < 45) or (humidity > 75 and humidity <75 ) %}
color: orange;
{% elif (humidity > 45 and humidity < 50) or (humidity > 70 and humidity < 70 ) %}
color: yellow;
{% else %}
color: green;
{% endif %}
}