Australian Animated Radar using BOM Public FTP

Hello again fellow Australians.

I have been busy at work trying to bring you an animated rain radar courtesy of BoM. The problem with BoMs radar is that they don’t offer a simple, animated GIF that you can simply pull off the web. Instead they offer layered transparencies, that you have to string together yourself to get a meaningful radar.

This makes things a bit tricky and requires a bit of image manipulation. This is where I have come in with a custom component!

Create the folders in your /config directory, “custom_components/camera” and then drop my file, “bom_radar.py” into that folder.

Create a camera in your configuration.yaml file similar to below:

camera:
  - platform: 'bom_radar'
    name: "test_camera"
    product_id: 'IDR023'

To get the Product ID for your preferred radar:

  • Go to this website and search for “Local Scale Radar Image VIC” or “Local Scale Radar Image QLD" for example.
  • The Product ID for your radar will be in the left most column, and will look like “IDR023”
  • I personally prefer the 128km x 128km radar resolution.

Configuration variables:

  • product_id ( Required ): The Product ID string as identified from the BOM website.
  • name ( Optional ): The name you would like to give to the radar.

Hope you all enjoy and please let me know if there are any bugs or feature requests! Cheers.

13 Likes

Gave it a spin, and running ‘check config’ after adding it to the configuration.yaml results in this:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/loader.py", line 92, in get_component
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/homeassistant/.homeassistant/custom_components/camera/bom_radar.py", line 14, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

What’s your product_id @callifo?

@BrendanMoran man you’re the best! Two awesome contributions now. What’s next :slight_smile: ?

This worked perfectly for me. I chose the 512km composite image for a long range view and 128km for close up.

Another way to get your product ID is to visit the BoM website and find the radar and zoom level you want. The product ID is in the URL.

1 Like

Hey Callifo, if you are running in your own python environment you need to install Pillow.

Yep, tried adding to the file, but this didnt take.
REQUIREMENTS = [‘Pillow’]

Tried installing it manually and pillow was still failing with a JPEG dependency missing error. Needed to install this,
apt-get install libjpeg-dev zlib1g-dev

Out of curiosity, how does it handle refreshing? Is it done every page refresh, or does it do it based on time?

I previously had this implemented just by downloading the image off the FTP every 15 minutes, and using the local_camera camera type.

I’m not 100% sure on the internal machinations of home assistant but through experimenting it seems to only update when you view the web front end. I have also programmed it so it will only download frames you don’t already have and append them, and it won’t check for new frames if your current latest frame is less than 10 minutes old

2 Likes

This looks awesome, thought I’m getting the same error as above. Looks like I don’t have pillow either. I’m running HA in a VENV.

@callifo did you end up getting this working with the commands you mentioned above?

This is AWESOME!!!

Does it delete old images or are those accumulating somewhere?

Works great.

1 Like

It only keeps the last 6 frames in memory and discards anything older and doesn’t save anything to disk.

Glad you like it!

1 Like

Yes,

apt-get install libjpeg-dev zlib1g-dev
sudo su -s /bin/bash homeassistant
source /srv/homeassistant/bin/activate
sudo pip3 install Pillow

Given the rest of the modules automatically install the required dependencies, I suspect adding to the .py module should do it

REQUIREMENTS = [‘Pillow’]

Should do it,but mine when starting up HA kept bumming out saying it couldn’t find the jpeg dependency. I then installed that above, and didn’t go back to see whether that fixed it automatically installing the dependency.

HAHA! I just saw your reply as I was installing Pillow to my VENV. Thanks for working it out earlier. I already had the other bits installed.

Thanks @BrendanMoran!! This is awesome!! Now I can get rid of the radar from WU and it’s terrible colours.

1 Like

Just tried this, works brilliantly

Thank you so much Brendan for this

1 Like

Great idea!

1 Like

Thanks for this mate works great

1 Like

Brendan this is absolutely brilliant. I was wanting to do something like this for a while I just don’t have the programming knowledge and couldn’t work out how to grab all the latest images from the FTP site.

Awesome work, thank you so much!

1 Like

Thanks for another fantastic contribution @BrendanMoran. Before I just had a static radar image on our HADashboard but now with an animated display, the wife acceptance factor has happily increased.

1 Like

works great thanks @BrendanMoran

1 Like

This is awesome, thanks @BrendanMoran!

1 Like

@jimpower what interface are you using there?