Customising the BOM Weather and lovelace - now in HACS

Grant - do you see a fire_danger entity in HA?? Maybe it’s not parsing it in the template?

I haven’t implemented the fire rating code yet unfortunately so can’t help just now

Yes, just no state

I’ll see if I can work out how to read it… No promises though.

Dave, no problem… whatever happens… thanks

It’s been so long since I setup my weather component that I can’t remember whats what… which component gives you the fire danger? I don’t see it in any of mine

it’s in the BOM FTP that was updated this week (and the card to display it) You need to add the conditions per the readme/instructions in HACS

ah… I see whats going on here. I previously had the original bom_forecast custom component by Bremor… I also have your one installed in HACS. Now to figure out which one HA is currently using… I guess it’s your one since that would have over-written the previous one

Yes it would have overwritten it - same file, same location, same sensors.

First off I want to say that this is an awesome Lovelace config. I use it all the time.

Anyway, something weird is happening with my UV sensor. However I suspect it is the source from the BOM rather that anything in the custom component or the Lovelace config.

I noticed after I rebooted yesterday that my logs had an error could not render bom_uv_alert_summary:. I thought it was because I hadn’t added the extra lines to the template. However after adding the error was still there?

I did some more digging and saw that my sensor: [sensor.bom_melbourne_uv_alert_1] was showing its state as ## . I went WTF thats weird. So I went to the BOM web site and it had the correct UV for tomorrow

So I went to the source and browsed to the FTP site under anon/gen/fwo/ and then opened the xml for Melbourne ( [IDV10450.xml] and in the code it had " ##"

So I am not sure if there is anything from the config side, or it is just one of the BOM coders not bothering…

I think there might be a problem with the UV scrape sensor for Hobart. Last night as I was going to bed I noticed the UV alert summary was unavailable but on checking the BoM website they were still listed (using the correct resource id). All I could do at the time was grab a few screenshots:

Could not render template bom_uv_alert_summary: UndefinedError: list object has no element 1

If it happens again I’ll check the FTP data as well.

Edit: it’s still unavailable now.

Sensor:

    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 }}

Ah. I’m surprised anything is working:

Status:	Resolving address of ftp.bom.gov.au
Status:	Connecting to 134.178.253.145:21...
Status:	Connection established, waiting for welcome message...
Status:	Insecure server, it does not support FTP over TLS.
Status:	Logged in
Status:	Retrieving directory listing...
Command:	PWD
Response:	257 "/"
Command:	TYPE I
Response:	200 Switching to Binary mode.
Command:	PASV
Response:	227 Entering Passive Mode (134,178,253,145,48,179).
Command:	LIST
Error:	Connection timed out after 20 seconds of inactivity
Error:	Failed to retrieve directory listing
Status:	Disconnected from server
Status:	Resolving address of ftp.bom.gov.au
Status:	Connecting to 134.178.253.145:21...
Status:	Connection established, waiting for welcome message...
Status:	Insecure server, it does not support FTP over TLS.
Status:	Logged in
Status:	Retrieving directory listing...
Command:	PWD
Response:	257 "/"
Command:	TYPE I
Response:	200 Switching to Binary mode.
Command:	PASV
Response:	227 Entering Passive Mode (134,178,253,145,163,179).
Command:	LIST
Error:	Connection timed out after 20 seconds of inactivity
Error:	Failed to retrieve directory listing

Yeah it’s BOM. The XML file has ## there as well…


image
Last night it was showing those states for tomorrow (_1) not today.

Could change the template to cope with this but it’s the first time I’ve seen that kind of state so I don’t know if it’s likely to continue of if it’s a one-off? Anyway my immediate inclination is to ignore it.

Note I also changed the text for the slots as it was too long and looked nasty on a mobile device. The js weather card on the repo has been updated but I haven’t done a new release yet. So if someone wants to play with the template I can put that in and release…

I’ll give it a go later. Have some LED strips to install today.

One other question, what is the setting to move the day summary (“Shower or Two” in your screen shot) down so that it does not interfere with the animated icon on displays with limited width?

EDIT: NM, found it current_text_top_margin:

Yeah I got sick of the current text overwriting stuff a few releases ago…
So I think this will work:

      bom_uv_alert:
        value_template: >
            {%- if states('sensor.bom_gosford_uv_alert_0') == '##' -%}
            UV Today: No Data
            {%- elif states('sensor.bom_gosford_uv_alert_0') != 'n/a' -%} 
            UV Today: {{ states('sensor.bom_gosford_uv_alert_0') }}
            {%- elif states('sensor.bom_gosford_uv_alert_1') == '##' -%}
            UV Tomorrow: No Data
            {%- else -%}
            UV Tomorrow: {{ states('sensor.bom_gosford_uv_alert_1') }}
            {%- endif -%}

      bom_uv_alert_summary:
        value_template: >
            {%- if states('sensor.bom_gosford_uv_alert_0') == '##' -%} 
            {% set val = 'No Data' %}
            {%- elif states('sensor.bom_gosford_uv_alert_0') != 'n/a' -%} 
            {% set val = states('sensor.bom_gosford_uv_alert_0').split('[')[1].split(']')[0] %}
            {%- elif states('sensor.bom_gosford_uv_alert_1') == '##' -%} 
            {% set val = 'No Data' %}
            {%- elif states('sensor.bom_gosford_uv_alert_1') != 'n/a' -%} 
            {% set val = states('sensor.bom_gosford_uv_alert_1').split('[')[1].split(']')[0] %}
            {%- else -%}
            {%- set val = 'No Data' -%}
            {%- endif -%}
            {{ val | title }} 
          
      bom_fire_danger:
        value_template: >
            {%- if states('sensor.bom_gosford_fire_danger_0') == '##' -%}
            Fire Danger Today: No Data
            {%- elif states('sensor.bom_gosford_fire_danger_0') != 'n/a' -%} 
            Fire Danger Today: {{ states('sensor.bom_gosford_fire_danger_0') }}
            {%- elif states('sensor.bom_gosford_fire_danger_1') == '##' -%}
            Fire Danger Tomorrow: No Data
            {%- else -%}
            Fire Danger Tomorrow: {{ states('sensor.bom_gosford_fire_danger_1') }}
            {%- endif -%}

      bom_fire_danger_summary:
        value_template: >
            {%- if states('sensor.bom_gosford_fire_danger_0') == '##' -%}
            No Data
            {%- elif states('sensor.bom_gosford_fire_danger_0') != 'n/a' -%} 
            {{ states('sensor.bom_gosford_fire_danger_0') }}
            {%- elif states('sensor.bom_gosford_fire_danger_1') == '##' -%}
            No Data
            {%- else -%}
            {{ states('sensor.bom_gosford_fire_danger_1') }}
            {%- endif -%}

Seems to work ok…

Grant - not in a release yet but if you download sensor.py from repo and replace it in custom_components (make sure you use raw mode for d/l) it will return both conditions for fire danger now Scratch that - updated HACS and you’ll need to use a Template sensor to extract what you need.
If you copy me on the sensor I will include that in the readme.md and info.md and in the sample package in case someone else from Perth needs that…

1 Like

I changed No Supply to No Data in the above templates… note the templates are just suggestions and you can use whatever text you like…

Day just ticked over and the ## is gone and I have real forecast up again…

Thank David for your help- will try and get to this as soon as I can and let you know.

Sweet Grant. I configured for your product_id and it’s working for that so sure it’s good…

My initial observations - will have to play with it to make it fit