Australian Weather Forecast using BOM Public FTP

Hi I’m getting following errors. I tried this on v0.91.0 and v0.93.1 but the result is the same. Could it be that there is no access to ftp.bom.gov.au? Any help would be much appreciated.

Blockquote
Mon May 20 2019 22:27:30 GMT+0800 (Australian Western Standard Time)
Error while setting up platform bom_forecast
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py”, line 126, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/local/lib/python3.7/asyncio/tasks.py”, line 416, in wait_for
return fut.result()
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/bom_forecast/sensor.py”, line 241, in setup_platform
bom_forecast_data.update()
File “/usr/local/lib/python3.7/site-packages/homeassistant/util/init.py”, line 224, in wrapper
result = method(*args, **kwargs)
File “/config/custom_components/bom_forecast/sensor.py”, line 418, in update
ftp = ftplib.FTP(‘ftp.bom.gov.au’)
File “/usr/local/lib/python3.7/ftplib.py”, line 117, in init
self.connect(host)
File “/usr/local/lib/python3.7/ftplib.py”, line 152, in connect
source_address=self.source_address)
File “/usr/local/lib/python3.7/socket.py”, line 707, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File “/usr/local/lib/python3.7/socket.py”, line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

My config is as per https://github.com/bremor/bom_forecast

I’m on 0.92.2 and it works for me.

What platform are you using to run HA. Can you ftp to ftp.bom.gov.au from the cli? OR ping?

I can ping it but I get " ftp.bom.gov.au refused to connect." when I try to connect. I tried to connect from two different locations but the result is the same.

Is ftp.bom.gov.au working for you?

Try ftp://ftp.bom.gov.au/

Yes that link works but what does it mean regarding the error I’m getting when starting the platform bom_forecast.

Impossible to say as you haven’t posted your configuration.

Did you fix this? I have the same error:

2019-05-22 08:17:34 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform bom_forecast
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/bom_forecast/sensor.py", line 241, in setup_platform
    bom_forecast_data.update()
  File "/usr/local/lib/python3.7/site-packages/homeassistant/util/__init__.py", line 224, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/bom_forecast/sensor.py", line 421, in update
    ftp.retrbinary('RETR ' + self._product_id + '.xml', file_obj.write)
  File "/usr/local/lib/python3.7/ftplib.py", line 442, in retrbinary
    with self.transfercmd(cmd, rest) as conn:
  File "/usr/local/lib/python3.7/ftplib.py", line 399, in transfercmd
    return self.ntransfercmd(cmd, rest)[0]
  File "/usr/local/lib/python3.7/ftplib.py", line 365, in ntransfercmd
    resp = self.sendcmd(cmd)
  File "/usr/local/lib/python3.7/ftplib.py", line 273, in sendcmd
    return self.getresp()
  File "/usr/local/lib/python3.7/ftplib.py", line 246, in getresp
    raise error_perm(resp)
ftplib.error_perm: 550 Failed to open file.

Config:
# Sensors
sensor:
# Weather prediction
- platform: yr
- platform: bom_forecast
product_id: IDN60801
name: Canberra
forecast_days: 3
rest_of_today: True
friendly: True
friendly_state_format: ‘{max}, {summary}’
monitored_conditions:
- ‘max’
- ‘min’
- ‘chance_of_rain’
- ‘possible_rainfall’
- ‘summary’
- ‘detailed_summary’

No I haven’t, but I didn’t have much time to look into it. BTW your error message looks different than mine but your config is very similar to mine.

sensor:
  - platform: bom_forecast
    product_id: IDV10450
    name: Melbourne
    forecast_days: 3
    rest_of_today: True
    friendly: True
    friendly_state_format: '{max}, {summary}'
    monitored_conditions:
      - 'max'
      - 'min'
      - 'chance_of_rain'
      - 'possible_rainfall'
      - 'summary'
      - 'detailed_summary'

As I said before my config is a copy/paste as per description from https://github.com/bremor/bom_forecast

1 Like

Did you try this:

Looking at your error, it does seem that you are unable to reach the ftp server for some reason.

Router? Firewall?

So I set this up yesterday for the first time and it works perfectly. There was an addition of some files and a new script 7 days ago. Did you get the latest versions of this component?

I downloaded the files last night, not sure what the issue is TBO.

How did you download the files?

As a zip file is best. Otherwise you can get the files downloaded in html format.

I’m now wondering if I’ve got the right product ID.

Perhaps it should be:
IDN10035 City Forecast - Canberra (NSW)

I’ll try that tomorrow (or on the weekend).

Missed that. Sorry. Yeah that’s your problem. IDN60801 is latest observations, not forecast.

1 Like

yes I did, and followed the README.md and did a copy/paste without changing anything on the code just to be sure not to mess anything up before I change my location in Perth.

Don’t be, the mistake was mine. Don’t know how I arrived at the wrong product ID. RTFM comes to mind!!

I changed the product in config yaml, rebooted and observed this in the log:

You are using a custom integration for bom_forecast which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

So it must be working OK. Now to figure out the how to configure the front end.

Thanks for your good work and for taking the time to reply to my post. Both are appreciated.

Hey mate, nice layout. I’m looking to do something similar. How did you astronomical data? I can see the sun data via the badge, but I don’t know how to display the attributes (like next_rising, next_setting and so on).

Thanks for posting your setup.

I used these template sensors:

- platform: template
  sensors:
    solar_elevation:
      friendly_name: "Sun Elevation"
      entity_id: sun.sun
      unit_of_measurement: '°'
      value_template: "{{ states.sun.sun.attributes.elevation }}"
    solar_azimuth:
      friendly_name: "Sun Azimuth"
      entity_id: sun.sun
      unit_of_measurement: '°'
      value_template: "{{ states.sun.sun.attributes.azimuth }}"
    nextsunrise:
      friendly_name: 'Next Sunrise'
      entity_id: sun.sun
      value_template: "{{ as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_local }}"
    nextsunset:
      friendly_name: 'Next Sunset'
      entity_id: sun.sun
      value_template: "{{ as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_local }}"
1 Like

Awesome, I shall give that a go. Thanks.

Has this been done?

Has anyone else made one of these?