Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106800

Is this a 'guarded' template

$
0
0

having a full checkup of the templates, I was experimenting with this

        icon_template: >
          {% if states.persistent_notification|count > 0 %} mdi:message-bulleted
          {% else %} mdi:message-bulleted-off
          {% endif %}

is the regular form I use all over, but given the two options, could be shortened:

{{'mdi:message-bulleted-off' if states.persistent_notification|count == 0 else 'mdi:message-bulleted'}}

now, I can even take out the ‘mdi:message-bulleted-’ bit and try something like this

mdi:message-bulleted{{'-off' if states.persistent_notification|count == 0}}

which works for now. Not perfectly sure though this is a guarded enough template.
Thoughts on the matter are appreciated.
thanks

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106800

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>