New weather briefing TTS template and script
This commit is contained in:
@ -898,3 +898,10 @@ script:
|
||||
entity_id: sensor.flood_warning
|
||||
- service: homeassistant.update_entity
|
||||
entity_id: sensor.flood_watch
|
||||
|
||||
weather_briefing:
|
||||
sequence:
|
||||
- service: script.speech_engine
|
||||
data_template:
|
||||
who: "{{ who }}"
|
||||
message: !include ../templates/speech/weather_briefing_full.yaml
|
30
templates/speech/weather_briefing_full.yaml
Normal file
30
templates/speech/weather_briefing_full.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
>
|
||||
{# 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>
|
||||
|
||||
{%- 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()) -}}
|
Reference in New Issue
Block a user