I’ve set up a template switch in my configuration.yaml so that I can customise the icon showing in lovelace from the standard flash which switches default to. The switch toggle works fine but the specified icon is proving problematic.
If I remove the icon_template block the standard flash on/off works fine but I want to replace that.
switch:
- platform: template
switches:
tv_toggle:
friendly_name: "TV"
value_template: "{{ is_state('switch.tv', 'on') }}"
turn_on:
service: switch.turn_on
target:
entity_id: switch.tv
turn_off:
service: switch.turn_off
target:
entity_id: switch.tv
icon_template: >-
{% if is_state('switch.tv', 'on') %}
mdi:Television
{% else %}
mdi:TelevisionOff
{% endif %}
However I cannot get this icon showing in lovelace and I don’t believe that it’s a new icon either (?). ui-lovelace.yaml:
- type: button
name: TV
entity: switch.tv_toggle
show_icon: true
show_state: true
tap_action:
action: toggle
I’ve also tried the TelevisionClassic/TelevisionClassicOff icons but they don’t work either.
I’ve restarted and recreated home assistant (docker) several times and cleared my browser cache but no joy.
Any ideas?