I want my background to change according to the value of a sensor so I can see in an eye blink that action is necessary. But if have something wrong in my sentence. Can someone tell me what because I don’t get errors but it seems that ‘<’ isn’t working:
This is what I made:
type: sensor
style: |
ha-card {
background:
{% if is_state('sensor.luftdaten_3081_p1', '< 4.17' ) %}
lightblue
{% else if is_state('sensor.luftdaten_3081_p1', '< 14.17' ) %}
lightgreen
{% else %}
red
{% endif %}
;
}
entity: sensor.luftdaten_3081_p1
graph: line
type: sensor
style: |
ha-card {
background:
{% if is_state('sensor.luftdaten_3081_p1) | float < 4.17' ) %}
lightblue
{% else if is_state('sensor.luftdaten_3081_p1') float < 14.17 ) %}
lightgreen
{% else %}
red
{% endif %}
;
}
entity: sensor.luftdaten_3081_p1
graph: line
after reading about templates and the use of states. versus state('sensor… Now it works fine.
But now the next problem. I use Netatmo sensors and I want to use the wind_angle to procuce some nice pictures with a wind compass. Therefor I wanted to use the following sentences:
I always get back ‘N’. Even if I know the wind is blowing from the South. It must have something to do with the attribute state of sensor.netatmo_wind-angle because the reading of this sensor is: SE(132°) But how do I split that up. Can someone help me with the correct code?