Does anyone have a working config they could share for Home Assistant that will change icons based on the state of the entity?
I've tried several configs from the HA forums but a lot of the commands are deprecated and none seem to work. The closest I've got is the config below but the states don't change the icon.
MQTT is working and I can control the door and see the State change from 1 (closed) to 0 (open).
The following is in my configuration.yaml file running HASS 2022.8.7
mqtt:
cover:
- name: "Garage Door MQTT"
device_class: "garage"
state_topic: "shellies/shelly1-485519/input/0"
command_topic: "shellies/shelly1-485519/relay/0/command"
state_closed: "1"
state_open: "0"
payload_open: "toggle"
payload_stop: "toggle"
payload_close: "toggle"
payload_available: "online"
payload_not_available: "offline"
icon: >-
{% if states['cover.garage_door_mqtt'].state == 'closed' %}
'mdi:garage'
{% elif states['cover.garage_door_mqtt'].state == 'open' %}
'mdi:garage-open'
{%else%}
'mdi:alert'
{%endif%}