Move "services down" to a macro for possible re-use elsewhere

Also improved the wording
This commit is contained in:
2024-12-10 16:03:07 -05:00
parent 6c145f0ca9
commit 6b9380f015
2 changed files with 13 additions and 4 deletions

View File

@ -0,0 +1,11 @@
{% from 'formatting.jinja' import cleanup %}
{% macro services_down() %}
{% if states('sensor.services_down') | int == 1 %}
There is one service offline. It is {{ state_attr('sensor.services_down','services') }}.
{% elif states('sensor.services_down') | int > 1 %}
There are {{ states('sensor.services_down') }} services currently offline. They are {{ state_attr('sensor.services_down','services') }}.
{% else %}
There are no services currently offline.
{% endif %}
{% endmacro %}