Hi all
After crawling the forum and inet for hours I came to the conclusion that I am lost.
We have a typical German kitchen door: open, closed and tilted. Three states, so I didn’t choose a binary sensor for the template:
# New sensor for kitchen door statuses Open | Closed | Tilted using two Aquara contact sensors
- sensor:
- name: "Status kitchendoor"
unique_id: status_kitchendoor
state: |
{% set b1 = states('binary_sensor.contact_sensor') %}
{% set b2 = states('binary_sensor.gartentur_8') %}
{% if b1 == 'off' and b2 == 'off' %} Geschlossen
{% elif b1 == 'on' and b2 == 'off' %} Gekippt
{% elif b2 == 'on' %} Offen
{% elif b1 == 'unavailable' or b2 == 'unavailable' %} nicht verfügbar
{% else %}
{% endif %}
icon: |
{% set b1 = states('binary_sensor.contact_sensor') %}
{% set b2 = states('binary_sensor.gartentur_8') %}
{% if b1 == 'off' and b2 == 'off' %} mdi:door
{% elif b1 == 'on' and b2 == 'off' %} mdi:window-open-variant
{% elif b2 == 'on' %} mdi:door-open
{% elif b1 == 'unavailable' or b2 == 'unavailable' %} mdi:exclamation
{% else %} mdi:help-circle
{% endif %}
In contrast to the other doors and windows, which are (still) added in the normal way (and therefore only know two states: open/closed) and therefore also switch nicely between the colors using state_color: true, this is not possible in the template.
Then changed mdi:door-open as SVG, i.e. recolored and stored under www/my_svg/door-open-recolor.svg.
But is it even possible to specify a path for an icon in a template, i.e. /local/my_svg/door-open-recolor.svg?
I had inserted it instead of mdi:door-open once as a test, there was no error, but also no colored icon when the state changed.
Perplexed & capable of learning
Greetings
RAV