Australian Weather Forecast using BOM Public FTP

Looking forward to regional city inclusion. Will be a happy tester if you need one for non major city testing

@ BrendanMoran … great work!! no issue from my side and I’m happy to be a beta tester if you need.

Maybe in future, there is a way to monitor

  • Sea teamperature
  • Tide times

looking forward to your updates… well done!

Yep, that worked perfectly and it’s all up and running. Sorry for the noob problem and thanks again!

Edit: Also if you are looking to split it up into individual sensors then this worked for me:

{{ states.sensor.bom_forecast_sydney_0.attributes['Max Temp C'][0] }}

The other way to do it is use the green clone/download button and download ZIP. Then extract the required file locally.

1 Like

This is awesome. As a future idea, on the friendly mode it would be great to have the forecast temperature in degrees. E.g. Tue, 2 Oct 22, Cloudy

1 Like

Yeah absolutely, that is easy to do. I can format it however we all think is the best.

I think, e.g, 23, Sunny is probably a good start.

Thanks for this components. I’m seeing the following errors when trying to load

2018-10-03 11:53:50 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform bom_forecast
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/sensor/bom_forecast.py”, line 136, in setup_platform
bom_forecast_data.update()
File “/usr/local/lib/python3.6/site-packages/homeassistant/util/init.py”, line 324, in wrapper
result = method(*args, **kwargs)
File “/config/custom_components/sensor/bom_forecast.py”, line 302, in update
tree = xml.etree.ElementTree.parse(file_obj)
AttributeError: module ‘xml’ has no attribute ‘etree’

1 Like

This is good. “7 to 23, Sunny” would be better. Though not sure you can do that for the today sensor. I noticed it does not have a minimum.

I was also mulling over making some template sensors to extract just the next day forecast max and min temps as well as the rain chance and amount attributes.

Setting friendly = false would produce way too many sensors for a 6 day set up.

You could always have two instances of bom_forecast, one friendly = true for 6 days, and one friendly = false for 1 day

1 Like

Oh, this was helpful, I was about to post that the attributes returned seem to need a clean up. The [0] cleans up some surrounding unwanted characters? (‘’,) What’s that all about?

I’m getting all ‘unknown’ states from this sensor since last night. Any ideas? I briefly had the same problem after my net dropped out temporarily, but a HA restart fixed that (same fix isn’t working now).

Working flawlessly here

Pretty sure my python code won’t tolerate a loss of connectivity to BoM while it is trying to update. I willl fix this in the next couple of days.

Hi Guys,

I have created a new field that will allow you to have friendly mode displayed however you want. See the Opening Post for details on “friendly_state_format”

  • friendly_state_format ( Optional ): Friendly state format allows you to format the state of your forecast sensors when in friendly mode. For example, ‘{min} to {max}, {summary}’ will display the state as ‘10 to 25, Cloudy’. Defaults to ‘{summary}’.

Updates:

  • 05/10/18: Fixed the formatting bug described in this post.
  • 05/10/18: Create “friendly_state_format” which will allow you to customise the friendly forecast state however you like.
  • 04/10/18: Updated to include “Towns” as well as cities.
2 Likes

I modified the code a bit to achieve this.

   #if friendly:
    for index in range(start, config.get(CONF_DAYS)+1):
        add_entities([BOMForecastSensorFriendly(bom_forecast_data, monitored_conditions,
        index, name, product_id)])    	
   #else:
	for index in range(start, 1):
        for condition in monitored_conditions:    
            add_entities([BOMForecastSensor(bom_forecast_data, condition,
            index, name, product_id)])

In this case, it shows all forecast sensors and only one for the current day.

Guys,

Is that possible to extract information from the detailed forecast, everything to the first full stop. (Cloudy, Sunny, Mostly Sunny, etc.)

E.g. Short summary as “Possible late shower” is not really a summary for the day, getting “Cloudy” would be more appropriate. Maybe as a separate sensor somehow?

The short text is the official BoM summary. Take the issue up with them :slight_smile:

There are posts on this forum about extracting strings.

Also, thanks, but that alteration you did is not what I am after. I wanted seperate sensors for tomorrow only and all other five days as per friendly setting. I’ll be implementing Brendan’s suggestion of two instances of the sensor. One six day friendly and the other as a one day unfriendly (separate sensors).

The code I posted above does exactly what you want - all sensors for one day and all forecast sensors

In my case one day is today, but you can try playing with values here index in range(start, 1): maybe something like index in range(start+1, 2):

I have followed the instructions for this custom component and restarted HA a few times but I’m not getting the new sensor entity showing up in the dev panel. I found this in the error log aft erthe most recent restart:

Log Details (ERROR)

Fri Oct 05 2018 14:49:59 GMT+0930 (Australian Central Standard Time)

Error while setting up platform bom_forecast

Traceback (most recent call last): File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 128, in _async_setup_platform SLOW_SETUP_MAX_WAIT, loop=hass.loop) File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for return fut.result() File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run result = self.fn(*self.args, **self.kwargs) File “/config/custom_components/sensor/bom_forecast.py”, line 240, in setup_platform bom_forecast_data.update() File “/usr/local/lib/python3.6/site-packages/homeassistant/util/init.py”, line 325, in wrapper result = method(*args, **kwargs) File “/config/custom_components/sensor/bom_forecast.py”, line 409, in update tree = xml.etree.ElementTree.parse(file_obj) AttributeError: module ‘xml’ has no attribute ‘etree’

Any suggestions?

Mine’s been intermittent in successfully setting up too (when I do restarts for various reasons). I get a similar error. A few hard reboots seems to get me there eventually. I dunno why.