# TTS: Full Text Weather Report, BOM Australia Integration, Extract Weather Warning Data & Other Text

**URL:** <https://discourse.nodered.org/t/tts-full-text-weather-report-bom-australia-integration-extract-weather-warning-data-other-text/94632>\
**Category:** Share Your Projects\
**Created:** [15 January 2025 02:04 UTC](https://discourse.nodered.org/t/tts-full-text-weather-report-bom-australia-integration-extract-weather-warning-data-other-text/94632 "2025-01-15T02:04:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MankiniChykan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mankinichykan/32/89774_2.png) [@MankiniChykan](https://discourse.nodered.org/u/MankiniChykan)\
**Post date:** [15 January 2025 02:04 UTC](https://discourse.nodered.org/t/tts-full-text-weather-report-bom-australia-integration-extract-weather-warning-data-other-text/94632/1 "2025-01-15T02:04:50Z")

</div>

[LINK TO FLOW HERE](https://flows.nodered.org/flow/e3500837b81117ae9f117d04776be41b)

# TTS: Full Text Weather Report, BOM Australia Integration, Extract Weather Warning Data & Other Text

Thanks @StormyKnight17 I thought I would place a few examples down on how I used your template examples. It actually took me a number of years to find, as this post does not come up easily in Google Search. This post has been made to help others point to the closed [Severe Weather Alert Issue #37](https://github.com/bremor/bureau_of_meteorology/issues/37)

**# Template Weather Warning Phase Text - Act as trigger for lovelace conditional card**

**Note:** to prevent early execution of _ **'elif'** _ statement:

- (new and renewal) may need to change to (new and wal). or just (new)
- (upgrade and downgrade) may need to change to (up and down) or just (grade)

```auto
  - platform: template
    sensors:
      weather_warning_phase:
        entity_id: sensor.devonport_warnings
        friendly_name: "Weather Warning Phase"
        value_template: >-
          {%- for state in state_attr('sensor.devonport_warnings', 'warnings') -%}
          {%- if 'new' in state.phase %}
          {{state.phase | upper}}
          {%- elif 'renewal' in state.phase %}
          {{state.phase | upper}}
          {%- elif 'update' in state.phase %}
          {{state.phase | upper}}
          {%- elif 'upgrade' in state.phase %}
          {{state.phase | upper}}
          {%- elif 'downgrade' in state.phase %}
          {{state.phase | upper}}
          {%- elif 'final' in state.phase %}
          {{state.phase | upper}}
          {%- elif 'cancelled' in state.phase %}
          {{state.phase | upper}}
          {%- endif -%}
          {%- endfor -%}

```

**THE SIX SENSORS BELOW MAKE ONE FULL WEATHER REPORT.**

I did have it as one complete code in my **configuration.yaml** but it kept breaking, I had to divide it up. (obviously too long to parse)

Combining all templates in a [Custom: Mushroom Template Card](https://github.com/piitaya/lovelace-mushroom/blob/b1cb2328dabb8aa7b2154b2e04a633300e794e5e/docs/cards/template.md) results in the below. This will parse as a complete code.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/b/5b85073fede71cfb99d7d96801b327c9193c3e39.png) Card changes colour, Crimson for Major or Minor warning\_group\_type.

**NOTE:** sensor.text\_dewpoint\_comfort\_outside is created using [Weather Word Descriptions from Dew Point, Temperature, VOC & Tado (Simple Air Comfort Card)](https://flows.nodered.org/flow/1b013cda55a8252806e6d23aa2e0a2e0)

**Template to place in Mushroom Template Card shown above:**

```auto
type: custom:mushroom-template-card
primary: >-
  {%- for state in state_attr('sensor.devonport_warnings', 'warnings') %} {%- if
  'major' in state.warning_group_type -%} {{state.warning_group_type | upper}}
  {{ state.title | upper}} {%- endif -%} {%- endfor -%}
secondary: >-
  {%- for state in state_attr('sensor.devonport_warnings', 'warnings') %} {%- if
  'minor' in state.warning_group_type -%} {{state.warning_group_type | upper}}
  {{ state.title | upper}} {%- endif -%} {%- endfor -%} {{-('. Currently it is
  ')-}} {{- states('sensor.netatmo_devonport_tas_indoor_outdoor_temperature',
  with_unit=true) -}} {{-(' but feels like ')-}} {{-
  states('sensor.outside_feels_like_temperature', with_unit=true)-}} {{-(', it
  is ')-}} {{- states('sensor.text_dewpoint_comfort_outside', with_unit=true) |
  lower-}} {{-(' and ')-}} {{- states('sensor.text_temperature_comfort_outside',
  with_unit=true) | lower-}} {{-(' outside. The ')-}} {{-
  states('sensor.devonport_now_now_label', with_unit=true) -}} {{-(' is ')-}}
  {{- states('sensor.devonport_now_temp_now', with_unit=true) -}} {{-(', ')-}}
  {{- states('sensor.devonport_now_later_label', with_unit=true) -}} {{-(' will
  be ')-}} {{- states('sensor.devonport_now_temp_later', with_unit=true) -}}
  {{-('. Conditions are ')-}} {{- states('sensor.weather_report_conditions') -}}
  {{- states('sensor.weather_report_conditions_2') -}} {%- if
  is_state('sensor.devonport_rain_chance_0', '0') %} {{-(' There is No Rain
  Forecast, with ')-}} {{- states('sensor.devonport_airport_rain_since_9am',
  with_unit=true) -}} {{-('since 9am. ')-}} {%- else %} {{-(' There is a ')-}}
  {{- states('sensor.devonport_rain_chance_0', with_unit=true) -}} {{-(' chance
  of ')-}} {{- states('sensor.devonport_rain_amount_range_0', with_unit=true)
  -}} {{-(' mm rain, with ')-}} {{-
  states('sensor.devonport_airport_rain_since_9am', with_unit=true) -}} {{-('
  since 9am. ')-}} {%- endif -%} {%- if
  is_state('sensor.devonport_fire_danger_0', 'unknown') %} {{-(' Fire Danger is
  LOW, ')-}} {%- else -%} {{-(' Fire Danger Rating is ')-}}
  {{-states('sensor.devonport_fire_danger_0') | upper -}} {%- endif -%} {%- if
  is_state('sensor.devonport_uv_category_0', 'unknown') %} {{-(' and NO UV ')-}}
  {%- else %} {{-(' and UV is ')-}} {{- states('sensor.devonport_uv_category_0')
  | upper -}} {%- endif -%}   
icon: null
entity: button.weather_report
multiline_secondary: true
tap_action:
  action: toggle
fill_container: true
icon_color: ''
card_mod:
  style: |
    ha-card {
       --card-primary-font-size: 20px !important;
       --card-primary-line-height: 1.2
    }
    ha-card {
       --card-secondary-font-size: 20px !important;
       --card-secondary-line-height: 1.2
    }
    ha-card {
       {%- for state in state_attr('sensor.devonport_warnings', 'warnings') %} 
       {%- if ('major' or 'minor') in state.warning_group_type -%} 
       background: radial-gradient(circle, black, black, crimson)
       {%- endif -%} 
       {%- endfor -%}
    }

    }

```

For use in [Node Red](https://nodered.org/) The state from the sensors below are recombined into the full weather report that can be sent to TTS.

**NOTE:** There is a 255 Character limit on the condition report. This will return 'unknown' if the state of the BOM Extended Text Weather Report exceeds this limit.

**NOTE:** The state from 'sensor.your\_location\_extended\_text\_0' has been split to two sensors at 230 characters each. This includes room for text prior the condition report.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/8/185bbf208b73b0f9ae5ac0524c740ef3724c0193.png)

**# Template Weather Report Text- BOM Current Feel - Temperature Report - TTS Input**

```auto
  - platform: template
    sensors:
      weather_report_temperature:
        entity_id: sensor.weather_report_temperature
        friendly_name: "Weather Report Temperature"
        value_template: >-
          {{'Currently it is'}}
          {{ states('sensor.netatmo_devonport_tas_indoor_outdoor_temperature', with_unit=true) }}
          {{'but feels like'}}
          {{ states('sensor.outside_feels_like_temperature',with_unit=true) }}
          {{', it is'}}
          {{ states('sensor.text_dewpoint_comfort_outside', with_unit=true) | lower }}
          {{'and'}}
          {{states('sensor.text_temperature_comfort_outside', with_unit=true) | lower}}
          {{'outside. The '}}
          {{ states('sensor.devonport_now_now_label', with_unit=true) }}
          {{'is'}}
          {{ states('sensor.devonport_now_temp_now', with_unit=true) }}
          {{','}}
          {{ states('sensor.devonport_now_later_label', with_unit=true) }}
          {{'will be'}}
          {{ states('sensor.devonport_now_temp_later', with_unit=true) }}

```

**# Template Weather Report Text- BOM Current Feel - Temp and Conditions Report - TTS Input - To avoid 255 character limit spilt over two sensors.**

**NOTE:** The state from 'sensor.your\_location\_extended\_text\_0' has been split to two sensors at 230 characters each. This includes room for text prior the condition report.

```auto
  - platform: template
    sensors:
      weather_report_conditions:
        entity_id: sensor.weather_report_conditions
        friendly_name: "Weather Report Conditions"
        value_template: >-
          {{'. Conditions are'}}
          {% set details = state_attr('sensor.devonport_extended_text_0', 'state') %}
          {{ details[:230] if state | length < 230 else '' -}}
      weather_report_conditions_2:
        entity_id: sensor.weather_report_conditions_2
        friendly_name: "Weather Report Conditions_2"
        value_template: >-
          {%- set details = state_attr('sensor.devonport_extended_text_0', 'state') %}
          {{- details[230:] if state | length < 230 else '' }}

```

**# Template Weather Report Text - BOM Current rain and chance of rain - TTS Input**

```auto
  - platform: template
    sensors:
      weather_report_rain:
        entity_id: sensor.weather_report_rain
        friendly_name: "Weather Report Rain"
        value_template: >-
          {%- if is_state('sensor.devonport_rain_chance_0', '0') %}
          {{'There is No Rain Forecast, with'}}
          {{states('sensor.devonport_airport_rain_since_9am', with_unit=true) }}
          {{'since 9 AM.'}}
          {%- else %}
          {{'There is a'}}
          {{ states('sensor.devonport_rain_chance_0', with_unit=true) }}
          {{'chance of'}}
          {{ states('sensor.devonport_rain_amount_range_0', with_unit=true) }}
          {{'mm rain, with'}}
          {{ states('sensor.devonport_airport_rain_since_9am', with_unit=true) }}
          {{'since 9 AM.'}}
          {%- endif -%}

```

**# Template Weather Report Text - BOM Current Fire Danger and UV - TTS Input**

```auto
  - platform: template
    sensors:
      weather_report_fire_uv:
        entity_id: sensor.weather_report_fire_uv
        friendly_name: "Weather Report Fire UV"
        value_template: >-
          {%- if is_state('sensor.devonport_fire_danger_0', 'unknown') %}
          {{'Fire Danger is LOW,'}}
          {%- else %}
          {{'Fire Danger Rating is'}}
          {{ states('sensor.devonport_fire_danger_0') | upper }}
          {%- endif -%}
          {%- if is_state('sensor.devonport_uv_category_0', 'unknown') %}
          {{'and NO UV'}}
          {%- else %}
          {{'and UV is'}}
          {{ states('sensor.devonport_uv_category_0') | upper }}
          {%- endif -%}

```

**# Template Weather Report Text - BOM Current weather warnings - TTS Input**

```auto
  - platform: template
    sensors:
      weather_report_warnings:
        entity_id: sensor.weather_report_warnings
        friendly_name: "Weather Report Warnings"
        value_template: >-
          {%- for state in state_attr('sensor.devonport_warnings', 'warnings') %}
          {%- if 'cancelled' in state.phase %}
            NO WEATHER WARNINGS 
          {%- elif 'minor' in state.warning_group_type%}
            . 
          {{ state.warning_group_type | upper}} {{ state.title | upper }}
          {%- elif 'major' in state.warning_group_type%}
            . 
          {{ state.warning_group_type | upper}} {{ state.title | upper }}
          {%- endif %}
          {%- endfor -%}

```

To enter all of the above sensors into your configuration.yaml file just copy the below. Ensure it is under the -platform: template section. You will have to change the sensor names to your own entities. **# ALL BOM TEXT SENSORS**

```auto
  - platform: template
    sensors:
# Template Weather Warning Phase Text - Act as trigger for lovelace conditional card
      weather_warning_phase:
        entity_id: sensor.devonport_warnings
        friendly_name: "Weather Warning Phase"
        value_template: >-
          {%- for state in state_attr('sensor.devonport_warnings', 'warnings') -%}
          {%- if 'new' in state.phase %}
          {{state.phase | upper}}
          {%- elif 'renewal' in state.phase %}
          {{state.phase | upper}}
          {%- elif 'update' in state.phase %}
          {{state.phase | upper}}
          {%- elif 'upgrade' in state.phase %}
          {{state.phase | upper}}
          {%- elif 'downgrade' in state.phase %}
          {{state.phase | upper}}
          {%- elif 'final' in state.phase %}
          {{state.phase | upper}}
          {%- elif 'cancelled' in state.phase %}
          {{state.phase | upper}}
          {%- endif -%}
          {%- endfor -%}
# Template Weather Report Text- BOM Current Feel - Temp Report - TTS Input
      weather_report_temperature:
        entity_id: sensor.weather_report_temperature
        friendly_name: "Weather Report Temperature"
        value_template: >-
          {{'Currently it is'}}
          {{ states('sensor.netatmo_devonport_tas_indoor_outdoor_temperature', with_unit=true) }}
          {{'but feels like'}}
          {{ states('sensor.outside_feels_like_temperature',with_unit=true) }}
          {{', it is'}}
          {{ states('sensor.text_dewpoint_comfort_outside', with_unit=true) | lower }}
          {{'and'}}
          {{states('sensor.text_temperature_comfort_outside', with_unit=true) | lower}}
          {{'outside. The '}}
          {{ states('sensor.devonport_now_now_label', with_unit=true) }}
          {{'is'}}
          {{ states('sensor.devonport_now_temp_now', with_unit=true) }}
          {{','}}
          {{ states('sensor.devonport_now_later_label', with_unit=true) }}
          {{'will be'}}
          {{ states('sensor.devonport_now_temp_later', with_unit=true) }}
# Template Weather Report Text- BOM Current Conditions - TTS Input - To avoid 255 character limit spilt over two sensors.
      weather_report_conditions:
        entity_id: sensor.weather_report_conditions
        friendly_name: "Weather Report Conditions"
        value_template: >-
          {{'. Conditions are'}}
          {% set details = state_attr('sensor.devonport_extended_text_0', 'state') %}
          {{ details[:230] if state | length < 230 else '' -}}
      weather_report_conditions_2:
        entity_id: sensor.weather_report_conditions_2
        friendly_name: "Weather Report Conditions_2"
        value_template: >-
          {%- set details = state_attr('sensor.devonport_extended_text_0', 'state') %}
          {{- details[230:] if state | length < 230 else '' }}
# Template Weather Report Text - BOM Current rain and chance of rain - TTS Input
      weather_report_rain:
        entity_id: sensor.weather_report_rain
        friendly_name: "Weather Report Rain"
        value_template: >-
          {%- if is_state('sensor.devonport_rain_chance_0', '0') %}
          {{'There is No Rain Forecast, with'}}
          {{states('sensor.devonport_airport_rain_since_9am', with_unit=true) }}
          {{'since 9am.'}}
          {%- else %}
          {{'There is a'}}
          {{ states('sensor.devonport_rain_chance_0', with_unit=true) }}
          {{'chance of'}}
          {{ states('sensor.devonport_rain_amount_range_0', with_unit=true) }}
          {{'mm rain, with'}}
          {{ states('sensor.devonport_airport_rain_since_9am', with_unit=true) }}
          {{'since 9am.'}}
          {%- endif -%}
# Template Weather Report Text - BOM Current Fire Danger and UV - TTS Input
      weather_report_fire_uv:
        entity_id: sensor.weather_report_fire_uv
        friendly_name: "Weather Report Fire UV"
        value_template: >-
          {%- if is_state('sensor.devonport_fire_danger_0', 'unknown') %}
          {{'Fire Danger is LOW,'}}
          {%- else %}
          {{'Fire Danger Rating is'}}
          {{ states('sensor.devonport_fire_danger_0') | upper }}
          {%- endif -%}
          {%- if is_state('sensor.devonport_uv_category_0', 'unknown') %}
          {{'and NO UV'}}
          {%- else %}
          {{'and UV is'}}
          {{ states('sensor.devonport_uv_category_0') | upper }}
          {%- endif -%}
# Template Weather Report Text - BOM Current weather warnings - TTS Input
      weather_report_warnings:
        entity_id: sensor.weather_report_warnings
        friendly_name: "Weather Report Warnings"
        value_template: >-
          {%- for state in state_attr('sensor.devonport_warnings', 'warnings') %}
          {%- if 'cancelled' in state.phase %}
            NO WEATHER WARNINGS 
          {%- elif 'minor' in state.warning_group_type%}
            . 
          {{ state.warning_group_type | upper}} {{ state.title | upper }}
          {%- elif 'major' in state.warning_group_type%}
            . 
          {{ state.warning_group_type | upper}} {{ state.title | upper }}
          {%- endif %}
          {%- endfor -%}

```
