Hello,
I have a switch button to open/close my garage and I would like to change the icon of it on my lovelace card, based on another sensor state which return open / close.
I’m ttying to use a type: custom:button-card and I’m trying to use template for the first time.
I created a template :
button_card_templates:
garage:
icon: >
{% if states("sensor.garage_door_mqtt") == 'close' %}
mdi:home-alert
{%- else -%}
mdi:home
{%- endif %}
views:
....
The condition has been tested into the template dev tool and it returns mdi:home or mdi:home-alert
My lovelace card is configured as below :
entity: switch.relaygaragedoor
template: garage
name: Garage
type: custom:button-card
icon: null
icon: null comes after a refresh. I guess it comes from the template.
Do you have any idea why it does not work ?
Maybe this is not the right way to do that ?
Thanks in advance for any suggestion or help
Guillaume
1 post - 1 participant