Customising the BOM Weather and lovelace - now in HACS

I went the other way… sigh… I intended to use uv_summary so I just changed the card and re-released it… I’m going to edit my above post to save confusion…

1 Like

Makes sense. It matches the fire summary now. Will update and change it.

Yeah that’s what I figured Tom. Appreciate your help checking this before it propagated too far…

No probs. Thank you for making it!

Just updated and it all looks good.

1 Like

Hi David, I got this error early this morning:
Could not render template bom_uv_alert_summary: UndefinedError: list object has no element 1

Using:

    bom_uv_alert_summary:
      value_template: >
        {%- if states('sensor.bom_hobart_uv_alert_0') != 'n/a' -%}
        {% set val = states('sensor.bom_hobart_uv_alert_0').split('[')[1].split(']')[0] %}
        {%- else -%}
        {% set val = states('sensor.bom_hobart_uv_alert_1').split('[')[1].split(']')[0] %}
        {%- endif -%}
        {{ val | title }}

This is because there was a very brief window where sensor.bom_hobart_uv_alert_0 and sensor.bom_hobart_uv_alert_1 were unavailable.

Untitled0
Untitled1
Untitled3

To prevent this I propose the following template:

    bom_uv_alert_summary:
      value_template: >
        {%- if states('sensor.bom_hobart_uv_alert_0') != 'n/a' -%}
          {% set val = states('sensor.bom_hobart_uv_alert_0').split('[')[1].split(']')[0] %}
        {%- elif states('sensor.bom_hobart_uv_alert_1') != 'n/a' -%}
          {% set val = states('sensor.bom_hobart_uv_alert_1').split('[')[1].split(']')[0] %}
        {%- else -%}
          {%- set val = 'unavailable' -%}
        {%- endif -%}
          {{ val | title }}
1 Like

I haven’t seen mine do that but I agree with your solution. Thanks Tom.

(of course I need to re-release this to update the info.md display in HACS…)

1 Like

I updated all 4 templates just in case:

    bom_uv_alert:
      value_template: >
        {%- if states('sensor.bom_hobart_uv_alert_0') != 'n/a' -%}
          UV Today: {{ states('sensor.bom_hobart_uv_alert_0') }}
        {%- elif states('sensor.bom_hobart_uv_alert_1') != 'n/a' -%}
          UV Tomorrow: {{ states('sensor.bom_hobart_uv_alert_1') }}
        {%- else -%}
          UV: Unavailable
        {%- endif -%}

    bom_uv_alert_summary:
      value_template: >
        {%- if states('sensor.bom_hobart_uv_alert_0') != 'n/a' -%}
          {% set val = states('sensor.bom_hobart_uv_alert_0').split('[')[1].split(']')[0] %}
        {%- elif states('sensor.bom_hobart_uv_alert_1') != 'n/a' -%}
          {% set val = states('sensor.bom_hobart_uv_alert_1').split('[')[1].split(']')[0] %}
        {%- else -%}
          {%- set val = 'Unavailable' -%}
        {%- endif -%}
          {{ val | title }}

    bom_fire_danger:
      value_template: >
        {%- if states('sensor.bom_hobart_fire_danger_0') != 'n/a' -%}
          Fire Danger Today: {{ states('sensor.bom_hobart_fire_danger_0') }}
        {%- elif states('sensor.bom_hobart_fire_danger_1') != 'n/a' -%}
          Fire Danger Tomorrow: {{ states('sensor.bom_hobart_fire_danger_1') }}
        {%- else -%}
          Fire Danger: Unavailable
        {%- endif -%}

    bom_fire_danger_summary:
      value_template: >
        {%- if states('sensor.bom_hobart_fire_danger_0') != 'n/a' -%}
          {{ states('sensor.bom_hobart_fire_danger_0') }}
        {%- elif states('sensor.bom_hobart_fire_danger_1') != 'n/a' -%}
          {{ states('sensor.bom_hobart_fire_danger_1') }}
        {%- else -%}
          Unavailable
        {%- endif -%}

ok…

with the current template, bom_uv_alert will become n/a as it defaults to uv_alert_1 if _0 is n/a and there is no test… the bom_uv_alert is either real or n/a… will of course display as UV Tomorrow: n/a
I think that’s ok.

the summary is fixed with your fix.

fire_danger as same… worst case it will show Fire Danger Tomorrow: n/a - I’m good with that… Ditto for fire-danger summary.

1 Like

Anyone else want more slots?


@tom_l @grantc

3 Likes

Looks good!

I am probably overlooking something… How do I take the fire danger off the bottom summary? I’d like to leave the UV info there.

from the docs…
image

            slot_l1: daytime_high           #daytime_high
            slot_l2: daytime_low            #daytime_low
            slot_l3: wind                   #wind
            slot_l4: pressure               #pressure
            slot_l4: sun_next               #sun_next
            slot_r1: pop                    #pop
            slot_r2: humidity               #humidity
            slot_r3: uv_alert               #uv_alert
            slot_r4: empty
            slot_r5: sun_following          #sun_following

I mean right down the bottom in the text under forecasts.

summary%20text

ah ok. Just don’t map the entity in lovelace… don’t leave it blank, remove the entity mapping completely. If it’s not mapped it will be ignored.

delete this line in Lovelace

            entity_fire_danger: sensor.bom_fire_danger
1 Like

Thanks! Found it!

1 Like

Looks great David - not sure why Perth “fire danger” does not display a state? Can only assume it has multiple sectors for the Perth metro? I assume other capital cities would be having this issue also.

image

What product ID are you using?

Perth - IDW12300

http://www.bom.gov.au/wa/forecasts/perth.shtml

Appears only Perth have a fire rating for the hills and flats

My region shows this:
<text type="fire_danger">Low-Moderate</text>
Perth shows:

                    <p>Perth Coastal Plain: High</p>
                    <p>Perth Hills: High</p>
                </text>

I guess that’s why…
(Just checked and Sydney is valid as is my non-capital city and Tom hasn’t complained about Hobart)

Seems only Perth feel the need to segregate the hills and coastal areas. I would have thought the other capital cities may have been in the same format. Thanks anyway

@sparkydave - Can you confirm your fire rating is working or not?