diff --git a/custom_templates/server.jinja b/custom_templates/server.jinja new file mode 100644 index 0000000..877a694 --- /dev/null +++ b/custom_templates/server.jinja @@ -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 %} diff --git a/templates/speech/basement_briefing.yaml b/templates/speech/basement_briefing.yaml index 603de93..8e8f839 100644 --- a/templates/speech/basement_briefing.yaml +++ b/templates/speech/basement_briefing.yaml @@ -6,6 +6,7 @@ {% from 'speech.jinja' import greeting, today_is, sun_status %} {% from 'weather.jinja' import weatherReport %} {% from 'sports.jinja' import sports_updates %} + {% from 'server.jinja' import services_down %}

{{ greeting('date') }}

@@ -22,10 +23,7 @@

- There are {{ states('sensor.services_down') }} services currently offline. - {% if states('sensor.services_down') | int > 0 %} - They are {{ state_attr('sensor.services_down','services') }}. - {% endif %} + {{ services_down() }}