Hi All,
I thought I had this cracked but my icon remains stubbornly white can anyone help?
The goal is to have it blue when below 7c and gradually change colour to red when above 35c
{% set temperature = states('sensor.average_house_temperature') | int %}
{% set r, g, b = 0, 0, 255 %}
{% if (temperature > 35) %}
{% set r = 255 %}
{% set g = 0 %}
{% set b = 0 %}
{% else if (temperature > 30) %}
{% set r = 255 %}
{% set g = 128 %}
{% set b = 0 %}
{% else if (temperature > 20) %}
{% set r = 255 %}
{% set g = 255 %}
{% set b = 0 %}
{% else if (temperature > 7) %}
{% set r = 0 %}
{% set g = 255 %}
{% set b = 0 %}
{% endif %}
{{ "#%0x" | format( r * 0x10000 + g * 0x100 + b * 0x1 ) }}
I have it working for a battery but this is based on a percentage of 100% I have tried to repurposed it here but I feel a little out of my depth and would really appreciate someones help here!
BTW here is my working code for a battery I hope this helps someone
{% if states('sensor.solis_s6_solis_battery_charge_power') | float == 0 and states('sensor.solis_s6_solis_battery_discharge_power') | float |round(0) == 0 %} W
{% elif states('sensor.solis_s6_solis_battery_charge_power') | float |round(0) != 0 and states('sensor.solis_s6_solis_battery_discharge_power') | float |round(0) != 0 %} W
{{states('sensor.solis_s6_solis_battery_charge_power') | float |round(0) }} W
{{states('sensor.solis_s6_solis_battery_discharge_power') | float |round(0) }} W
{% elif states('sensor.solis_s6_solis_battery_charge_power') | float |round(0) != 0 and states('sensor.solis_s6_solis_battery_discharge_power') | float |round(0) == 0 %}
{{states('sensor.solis_s6_solis_battery_charge_power') | float |round(0) }} W
{% elif states('sensor.solis_s6_solis_battery_charge_power') | float |round(0) == 0 and states('sensor.solis_s6_solis_battery_discharge_power') | float |round(0) != 0 %}
{{states('sensor.solis_s6_solis_battery_discharge_power') | float |round(0) }} W
{% endif %}
Solution depends on a particular card/place.
Someone’s solution may not work on another place.
That is why I suggest not to take someone’s ready code blindly - but go to a proper place & find out a needed proper solution.
Yes, for me this isn’t going to work due to other cards / chips in place already, surely this must be doable with the code I have (I must being doing something wrong as it works fine with the battery?)