So my baseboard thermostats icons in my picture-elements card are showing the power intensity like these:
This is what custom-ui has for my thermostats
climate.neviweb130_climate_cave:
templates: &climate
entity_picture: >
if (attributes.heat_level < 1) return '/local/heat-0.png';
if (attributes.heat_level < 21) return '/local/heat-1.png';
if (attributes.heat_level < 41) return '/local/heat-2.png';
if (attributes.heat_level < 61) return '/local/heat-3.png';
if (attributes.heat_level < 81) return '/local/heat-4.png';
return '/local/heat-5.png';
Now I’m trying to duplicate this in card-mod and can’t find a way to make it work. Following what I did earlier today for my motion detector, this is what I have so far and well, there is no image showing on screen.
- entity: climate.neviweb130_climate_cave
type: image
card_mod:
style: |
:host {
image:
{% if state_attr('climate.neviweb130_climate_cave','heat_level') | int < 1 %}
/local/heat-0.png
{% elif state_attr('climate.neviweb130_climate_cave','heat_level') | int < 21 %}
/local/heat-1.png
{% elif state_attr('climate.neviweb130_climate_cave','heat_level') | int < 41 %}
/local/heat-2.png
{% elif state_attr('climate.neviweb130_climate_cave','heat_level') | int < 61 %}
/local/heat-3.png
{% elif state_attr('climate.neviweb130_climate_cave','heat_level') | int < 81 %}
/local/heat-4.png
{% else %}
/local/heat-5.png
{% endif %}
}
style:
left: 53%
top: 60%
I tried to replace ‘style: |’ with ‘image: |’, didn’t help. Also tried other alternatives, still with the same result.
Running the template in the Developer Tools template editor gives me
" /local/heat-0.png" (without the quotes but WITH the leading spaces) so I know the template is working (minus the leading spaces, if it matters).
So, anybody can tell me what I’m doing wrong? My other customizations are quite simple (different icon/color depending on states) so once I have this one nailed, I’ll probably be able to drop custom-ui as it’s a Damocles sword over my HA head as I don’t know when an update will permanently break it.
