HOW TO: 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

# 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)
  - 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 results in the below. This will parse as a complete code.

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)

Template to place in Mushroom Template Card shown above:

                card:
                  type: custom:mushroom-template-card
                  primary: ''
                  secondary: >-
                    {{ states('sensor.weather_report_warnings') }} {{
                    states('sensor.weather_report_temperature') }} {{
                    states('sensor.weather_report_conditions') }} {{-
                    states('sensor.weather_report_conditions_2') }} {{
                    states('sensor.weather_report_rain') }} {{
                    states('sensor.weather_report_fire_uv') }}
                  icon: null
                  entity: button.weather_report
                  multiline_secondary: true
                  multiline_primary: 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
                         --text-shadow: 0 0 3px #FF0000, 0 0 5px #0000FF !important;
                      }
                      ha-card  {
                        {% for state in states('sensor.devonport_warnings') %}
                        {%- if '0' in state %}
                        background: radial-gradient(circle, black, black, darkslategrey)
                        {%- elif '1' in state %}
                        background: radial-gradient(circle, black, black, deepskyblue)
                        {%- elif '2' in state %}
                        background: radial-gradient(circle, black, black, crimson)
                        {%- elif '3' in state %}
                        background: radial-gradient(circle, black, black, crimson)
                        {%- elif '4' in state %}
                        background: radial-gradient(circle, black, black, crimson)
                        {%- endif -%}
                        {%- endfor -%}
                      }


For use in Node Red The state from the sensors below are recombined into the full weather report that can be sent to TTS.

NOTE: There is a 254 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._extended_text_0’ has been split to two sensors at 230 characters each. This includes room for text prior the condition report.

AVILABLE ON NODE RED FOR IMPORT!

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

  - 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_temperature_comfort_outside', with_unit=true)  | lower }}
          {{'and'}}
          {{states('sensor.text_dewpoint_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.

NOTE: The state from ‘sensor._extended_text_0’ has been split to two sensors at 230 characters each. This includes room for text prior the condition report.

  - 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

  - 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

  - 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,'}}
          {%- elif is_state('sensor.devonport_fire_danger_0', 'No Rating') %}
          {{'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

  - 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%}
          {% elif 'minor' in state.warning_group_type%}
          {{ state.warning_group_type | upper}} {{ state.title | upper }}
          {% elif 'major' in state.warning_group_type%}
          {{ 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

  - platform: template
    sensors:
# 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_temperature_comfort_outside', with_unit=true)  | lower }}
          {{'and'}}
          {{states('sensor.text_dewpoint_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 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
      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,'}}
          {%- elif is_state('sensor.devonport_fire_danger_0', 'No Rating') %}
          {{'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%}
          {% elif 'minor' in state.warning_group_type%}
          {{ state.warning_group_type | upper}} {{ state.title | upper }}
          {% elif 'major' in state.warning_group_type%}
          {{ state.title | upper }}
          {%- endif %}
          {%- endfor -%}

Updated Template Sensors to prevent breaking past the 255 Character Limit.
Split state from sensor..extended.text.0 over two 230 character sensors.
Added Node Red Flow to download.