51 lines
1.8 KiB
YAML
51 lines
1.8 KiB
YAML
>
|
|
{# Weather Briefing #}
|
|
{%- macro getReport() -%}
|
|
|
|
<p>
|
|
{{ states('sensor.current_conditions_detail') }}
|
|
</p>
|
|
<p>
|
|
{{ states('sensor.tomorrow_forecast_detail') }}
|
|
</p>
|
|
<p>
|
|
{{ states('sensor.clothing_forecast_detail') }}
|
|
</p>
|
|
|
|
<p>
|
|
{% if states('sensor.weatheralerts_active_alerts') > '0' %}
|
|
"Currently there are weather alerts active. The total number of alerts is {{ states('sensor.weatheralerts_active_alerts') }}. They are as follows. "
|
|
{% if is_state('sensor.weatheralerts_alert_1','on') %}
|
|
"{{ state_attr('sensor.weatheralerts_alert_1','alert_event') }}"
|
|
{% endif %}
|
|
{% if is_state('sensor.weatheralerts_alert_2','on') %}
|
|
"{{ state_attr('sensor.weatheralerts_alert_2','alert_event') }}"
|
|
{% endif %}
|
|
{% if is_state('sensor.weatheralerts_alert_3','on') %}
|
|
"{{ state_attr('sensor.weatheralerts_alert_3','alert_event') }}"
|
|
{% endif %}
|
|
{% if is_state('sensor.weatheralerts_alert_4','on') %}
|
|
"{{ state_attr('sensor.weatheralerts_alert_4','alert_event') }}"
|
|
{% endif %}
|
|
{% if is_state('sensor.weatheralerts_alert_5','on') %}
|
|
"{{ state_attr('sensor.weatheralerts_alert_5','alert_event') }}"
|
|
{% endif %}
|
|
{% endif %}
|
|
</p>
|
|
|
|
{%- endmacro -%}
|
|
|
|
|
|
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
|
|
{%- macro cleanup(data) -%}
|
|
{%- for item in data.split("\n") if item | trim != "" -%}
|
|
{{ item | trim }} {% endfor -%}
|
|
{%- endmacro -%}
|
|
|
|
{# a macro to call all macros :) #}
|
|
{%- macro mother_of_all_macros() -%}
|
|
{{ getReport() }}
|
|
{%- endmacro -%}
|
|
|
|
{# Call the macro #}
|
|
{{- cleanup(mother_of_all_macros()) -}} |