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 -%}
1 Like

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.

Here’s my 2 cents because I was looking at some simple sensors to put on my weather/radar page.

This gives me 2 sensors for the major and minor warnings with the state being the number of sensors and the “titles” of the warnings as a list in the attributes. These are then easy to use in automation or display on your dashboards.

Note that by putting text in to the sensor attributes, you bypass the 255 character limit.

Your input sensor name will need to change to reflect your own setup.

template:
  -sensor:
    - name: "BoM Major Warnings"
      unique_id: bom_major_warnings
      state: >
        {{ state_attr('sensor.bom_warnings', 'warnings')
           | selectattr('warning_group_type', 'search', 'major')
           | rejectattr('phase', 'search', 'cancelled')
           | list | count }}
      attributes:
        titles: >
          {{ state_attr('sensor.bom_warnings', 'warnings')
             | selectattr('warning_group_type', 'search', 'major')
             | rejectattr('phase', 'search', 'cancelled')
             | map(attribute='title')
             | join('\n') }}
    - name: "BoM Minor Warnings"
      unique_id: bom_minor_warnings
      state: >
        {{ state_attr('sensor.bom_warnings', 'warnings')
           | selectattr('warning_group_type', 'search', 'minor')
           | rejectattr('phase', 'search', 'cancelled')
           | list | count }}
      attributes:
        titles: >
          {{ state_attr('sensor.bom_warnings', 'warnings')
             | selectattr('warning_group_type', 'search', 'minor')
             | rejectattr('phase', 'search', 'cancelled')
             | map(attribute='title')
             | join('\n') }}
1 Like

I also have to binary sensors made in the Helpers GUI to give me severe thunderstorms and severe weather warnings using these templates:

Severe thunderstorms:

{%- for state in state_attr('sensor.bom_warnings', 'warnings') -%}
{%- if state.type == 'severe_thunderstorm_warning' 
   and state.warning_group_type == 'major' 
   and 'central forecast district' |lower in state.title | lower
   and state.phase != 'cancelled' -%}
True
{%- endif -%}
{%- endfor -%}

Severe weather:

{%- for state in state_attr('sensor.bom_warnings', 'warnings') -%}
{%- if state.type == 'severe_weather_warning' 
   and state.warning_group_type == 'major' 
   and 'central forecast district' |lower in state.title | lower
   and state.phase != 'cancelled' -%}
True
{%- endif -%}
{%- endfor -%}

Then the part of my dashboard with all the warnings and text is nice and neat:

1 Like

@safepay below is my latest yaml for my BOM sensors.

To avoid the 255 character limit use this, splits it over two sensors. This enables you to pull the longer than 255 character attribute out of the BOM sensor and allow display on dashboard. Rejoin in Node Red or Jinja Templates.

      # Template Weather Report Text- BOM Current Conditions - TTS Input - To avoid 255 character limit spilt over two sensors.
      weather_report_conditions:
        unique_id: ed7a9c4f-ae78-495d-bc42-b6e23f7c6f1e
        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:
        unique_id: b38fdba1-19d1-4193-a590-aa85ea9694cf
        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 '' }}
# SENSORS -----------------------------------------------------------
sensor:
  # Sensor Feed Parser
  - platform: feedparser
    name: Tas Alerts
    feed_url: "https://alert.tas.gov.au/data/incidents-and-alerts.xml"
    date_format: "%a, %d %b %H:%M"
    scan_interval:
      hours: 1
    inclusions:
      - title
      - summary

  # TEMPLATE SENSORS OLD FORMAT -----------------------------------------------------------
  - platform: template
    sensors:

      # Template Weather Warning Phase Text - Act as trigger for lovelace conditional card
      weather_warning_phase:
        unique_id: e03261f0-bad5-407d-8b0a-0fbacbf8c70c
        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:
        unique_id: 4027719d-97c1-413f-88dc-2594dac8c921
        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:
        unique_id: ed7a9c4f-ae78-495d-bc42-b6e23f7c6f1e
        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:
        unique_id: b38fdba1-19d1-4193-a590-aa85ea9694cf
        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:
        unique_id: 85e80fdb-a548-49aa-94b4-113d9b579de6
        friendly_name: "Weather Report Rain"
        value_template: >-
          {%- set rain_chance = states('sensor.devonport_rain_chance_0') %}
            {%- set rain_amount = states('sensor.devonport_rain_amount_range_0') %}
            {%- set rain_since_9am = states('sensor.netatmo_devonport_tas_indoor_rain_rain_today') %}
            {%- if rain_chance in ['unknown', 'unavailable'] or rain_amount in ['unknown', 'unavailable'] or rain_since_9am in ['unknown', 'unavailable'] %}
              There is no rain expected today.
            {%- elif rain_amount == '0' %}
              There is a {{ rain_chance }}% chance of rain today.
            {%- else %}
              There is a {{ rain_chance }}% chance of up to {{ rain_amount }} mm of rain today. {{ rain_since_9am }} mm has fallen since midnight.
            {%- endif %}

      # Template Weather Report Text - BOM Current Fire Danger and UV - TTS Input
      weather_report_fire_uv:
        unique_id: 504be70f-dd85-48be-b1e5-c32406c15f14
        friendly_name: "Weather Report Fire UV"
        value_template: >-
          {%- if is_state('sensor.devonport_fire_danger_0', 'unknown') %}
          {{'No Fire Danger,'}}
          {%- elif is_state('sensor.devonport_fire_danger_0', 'No Rating') %}
          {{'No Fire Danger,'}}
          {%- 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:
        unique_id: 6000f96b-37cc-4c9c-868d-abdc3240aab6
        friendly_name: "Weather Report Warnings"
        value_template: >-
          {%- for state in state_attr('sensor.devonport_warnings', 'warnings') %}
          {%- if state.phase in ['new', 'update', 'upgrade', 'renewal'] %}
            {%- if state.warning_group_type == 'minor' -%}
              {{ state.warning_group_type | upper }} {{ state.title | upper }} | 
            {%- elif state.warning_group_type == 'major' -%}
              {{ state.warning_group_type | upper }} {{ state.title | upper }} | 
            {%- endif %}
          {%- endif %}
          {%- endfor -%}
1 Like

Another 2 cents. You’ve done a great job.

I would suggest using sensor attributes to avoid splitting the sensor:

# Template Weather Report Text - BOM Current Conditions - TTS Input
template:
  - sensor:
      - name: "Weather Report Conditions"
        unique_id: ed7a9c4f-ae78-495d-bc42-b6e23f7c6f1e
        state: >-
          {% set details = state_attr('sensor.devonport_extended_text_0', 'state') %}
          {{ 'available' if details else 'unavailable' }}
        attribute_templates:
          full_text: >-
            {% set details = state_attr('sensor.devonport_extended_text_0', 'state') %}
            Conditions are {{ details if details else 'unavailable' }}

And your other code could be moderised quite a bit. E.g.:

# SENSORS -----------------------------------------------------------
sensor:
  # Sensor Feed Parser
  - platform: feedparser
    name: Tas Alerts
    feed_url: "https://alert.tas.gov.au/data/incidents-and-alerts.xml"
    date_format: "%a, %d %b %H:%M"
    scan_interval:
      hours: 1
    inclusions:
      - title
      - summary

# TEMPLATE SENSORS - MODERN FORMAT -----------------------------------------------------------
template:
  - sensor:
      # Weather Warning Phase - Act as trigger for lovelace conditional card
      - name: "Weather Warning Phase"
        unique_id: e03261f0-bad5-407d-8b0a-0fbacbf8c70c
        state: >-
          {% set phases = ['new', 'renewal', 'update', 'upgrade', 'downgrade', 'final', 'cancelled'] %}
          {% set warnings = state_attr('sensor.devonport_warnings', 'warnings') or [] %}
          {% for warning in warnings %}
            {% if warning.phase in phases %}
              {{ warning.phase | upper }}
            {% endif %}
          {% endfor %}

      # Weather Report Temperature
      - name: "Weather Report Temperature"
        unique_id: 4027719d-97c1-413f-88dc-2594dac8c921
        state: >-
          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) }}.

      # Weather Report Conditions - Consolidated into single sensor
      - name: "Weather Report Conditions"
        unique_id: ed7a9c4f-ae78-495d-bc42-b6e23f7c6f1e
        state: >-
          {% set details = state_attr('sensor.devonport_extended_text_0', 'state') %}
          Conditions are {{ details if details else 'unavailable' }}

      # Weather Report Rain
      - name: "Weather Report Rain"
        unique_id: 85e80fdb-a548-49aa-94b4-113d9b579de6
        state: >-
          {% set rain_chance = states('sensor.devonport_rain_chance_0') %}
          {% set rain_amount = states('sensor.devonport_rain_amount_range_0') %}
          {% set rain_since_9am = states('sensor.netatmo_devonport_tas_indoor_rain_rain_today') %}
          {% if rain_chance in ['unknown', 'unavailable'] or rain_amount in ['unknown', 'unavailable'] or rain_since_9am in ['unknown', 'unavailable'] %}
            There is no rain expected today.
          {% elif rain_amount == '0' %}
            There is a {{ rain_chance }}% chance of rain today.
          {% else %}
            There is a {{ rain_chance }}% chance of up to {{ rain_amount }} mm of rain today. {{ rain_since_9am }} mm has fallen since midnight.
          {% endif %}

      # Weather Report Fire Danger and UV
      - name: "Weather Report Fire UV"
        unique_id: 504be70f-dd85-48be-b1e5-c32406c15f14
        state: >-
          {% set fire_danger = states('sensor.devonport_fire_danger_0') %}
          {% set uv_category = states('sensor.devonport_uv_category_0') %}
          {% if fire_danger in ['unknown', 'No Rating'] %}
            No Fire Danger
          {% else %}
            Fire Danger Rating is {{ fire_danger | upper }}
          {% endif %}
          {% if uv_category == 'unknown' %}
            and NO UV.
          {% else %}
            and UV is {{ uv_category | upper }}.
          {% endif %}

      # Weather Report Warnings
      - name: "Weather Report Warnings"
        unique_id: 6000f96b-37cc-4c9c-868d-abdc3240aab6
        state: >-
          {% set warnings = state_attr('sensor.devonport_warnings', 'warnings') or [] %}
          {% set active_phases = ['new', 'update', 'upgrade', 'renewal'] %}
          {% set warning_types = ['minor', 'major'] %}
          {% for warning in warnings %}
            {% if warning.phase in active_phases and warning.warning_group_type in warning_types %}
              {{ warning.warning_group_type | upper }} {{ warning.title | upper }} | 
            {% endif %}
          {% endfor %}
1 Like

@safepay Thanks for the tips, few years ago when I wrote that and still learning yaml.

I am pretty sure I went the route of pulling the BOM attribute into two sensors to make them available for TTS and Lovelace. Otherwise I would have just pulled the attribute value straight from the BOM sensor, which may be possible.

Yes I have a mixture of legacy and modern templates in my config. my configuration.yaml is split into packages so it does not matter too much.

They serve their purpose. I may look at a direct pull from the BOM sensor attributes.

I am sure there will be one day when legacy template sensors are not supported anymore.

I also do not need the 255 character limit work around in the below flow. As the sensors do not go past the 255 character limit and return unknown.

BTW This is my weather page, responsive design for multiple size screens.

1080x1920 Vertical 15.6"-21.5" screens
Colour changes on weather report depending on Major, Minor on No Warning.

.

Mobile Phone

1 Like