Australian Weather Forecast using BOM Public FTP

This is my bad, fixed now. thanks for your patience while i figure this all out, very new to me. @aidbish @tom_l

1 Like

Hey RKor, the stations are for current observations, they are basically big weather stations that report current observations.

If you can find a weather forecast for a particular suburb I could try and integrate it.

Just updated, works perfectly
Thanks for the quick updates

Hi Brendan

bom_forecast.py is located in my custom_components folder

Hi Brendan

My fault, didnt read it properly and didnt notice the “sensor” folder added that and put the bom_forecast.py and now its all good. Thanks for the help

1 Like

That would be great mate, because another thing I wish your component does is give me current observations and locally

Here’s my station http://www.bom.gov.au/products/IDN60901/IDN60901.94757.shtml

Also, ever thought about making it an animated card? :smile:.

Or

I know I’m asking for a bit much but see how you go…

I don’t think I am going to be putting current observations into my component because it is already in the main bom sensor. Also, that link you showed me is for current and historical observations only, not for a forecast. I dont think BOM do forecasts per ‘station’, they only do it per city/town/district.

1 Like

Thanks. I did manage to sort out the log file error which was as per the link you suggested. I do still have an issue if I try to run the standard BOM component but I have now moved to just the BOM sensor and your forecast

any chance of adding a .json file for this component so it can be tracked with the custom_updater?

Hey Dave,

That issue link says he had updater.updater in his lovelace file and when he removed it, the error stopped.
I don’t have that entity in my lovelace.
How did you fix it?

Anyone want to share how they’re using it in automatons? I need help with the second one if anyone would care to have a go.

  1. If forecast max above x, let me know via my morning routines (that are announced over Google Home) for me to shower at work, not at home (I prefer to shower at home before my short cycle to work, but if it’s too hot, I’ll get too sweaty, so shower at work). This is pretty simple.

  2. (I need help). If it’s close to the weekend (say from Wednesday), start telling me the weekend forecast in the morning/afternoon, so I can think about weekend activities.

I’m using the friendly option. The weekday condition is simple enough, just a bit of now().weekday() etc , but I can’t think of logic to point the action to the relevant weekend sensor/attributes.

Does that make sense? Can anyone help?

Thinking out loud:

now().weekday() returns 0-6 for Monday to Sunday. So…

Wednesday is day 2,
Thursday is day 3,
Friday is day 4.

For saturday’s forecast:
On Wednesday (day 2) you want the attributes of sensor.bom_forecast_[location]_3
On Thursday (day 3) you want the attributes of sensor.bom_forecast_[location]_2
On Friday (day 4) you want the attributes of sensor.bom_forecast_[location]_1

Or for all three days you want sensor.bom_forecast_[location]_{{ 5 - now().weekday() }}

Unfortunately this is where it all falls down as I don’t seem to be able to access the attributes of

states.sensor.bom_forecast_[location]_{{ 5 - now().weekday() }}

e.g. for max temp I expected it to be:

states.sensor.bom_forecast_[location]_{{ 5 - now().weekday() }}.attributes.max_temp_c

But this returns nothing. So does:

states.sensor.bom_forecast_[location]_3.attributes.max_temp_c

So there’s nothing wrong with the template. There’s something funny about the attributes of this sensor.

If that’s going in a template, that won’t work. You’ll need to use code like this:

{{ state_attr('bom_forecast_[location]_{}'.format(5 - now().weekday()), 'max_temp_c') }}

Thanks @petro. That makes sense but there’s still something screwy with this sensor’s attributes:

What does states.sensor.bom_forecast_hobart_3.attributes return?

It’s shown in second part of the image (under the second blue bar).

The test under that returns nothing.

Could it be the capitalisation? There is every chance there is something screwy with the attributes :slight_smile: I can take a deeper look at this through the week or someone could try and poke holes in my python code if they felt up to it

I hope you didn’t take any offence by that Brendan. I’m very grateful for your work on this.

Could be. Looking at the attributes of my other sensors they are all lower case and use underscores for spaces.

Ah ok, these asses decided to use spaces in the names. First off, there was a typo in my original template to you. It should have been this:

{{ state_attr('sensor.bom_forecast_[location]_{}'.format(5 - now().weekday()), 'max_temp_c') }}

If that still doesn’t work, try this:

{{ state_attr('sensor.bom_forecast_[location]_{}'.format(5 - now().weekday()), 'Max Temp C') }}

And worse case if that doesn’t work:

{{ states.sensor['bom_forecast_[location]_{}'.format(5 - now().weekday())].attributes['Max Temp C'] }}

Whoa there dude. It’s @BrendanMoran’s first go at this and he’s done way more than I ever could. For which a lot of us here are very grateful as the scraper we were using has started to be blocked. He’s still working on this custom component too.

In regards to your templates, I get ‘None’, ‘None’ and and 'Error rendering template: UndefinedError: ‘None’ has no attribute ‘attributes’ respectively.

I reckon we give Brendan a bit of time to have a look at it.

Edit: scratch that. The last two templates work. I forgot to put my location in [location].

Thanks for your help @petro.