Australian BOM Rain Radar Card

I’ve resorted to some older methods (probably how this card was born).

I created a script in /config/custom_scripts/bom_radar.sh:

#!/bin/bash

#Config Variables
ID="IDR253"
iqty=5
img_out="/config/www/bom"

# Install Imagemagik if not there
file="/usr/bin/convert"
if [ -f "$file" ]
then
    echo "Imagemagik $FILE found."
else
    echo "Re-Installing Imagemagik:"
    apk add --update imagemagick
fi

# Change to the images directory
mkdir -p $img_out
cd $img_out

# Get the background images if not there
file="$ID.background.png"
if [ -f "$file" ]
then
    echo "Background images found."
else
    echo "Downloading background images"
    wget -q 'ftp://ftp.bom.gov.au/anon/gen/radar_transparencies/'${ID}'.background.png'
    wget -q 'ftp://ftp.bom.gov.au/anon/gen/radar_transparencies/'${ID}'.topography.png'
    wget -q 'ftp://ftp.bom.gov.au/anon/gen/radar_transparencies/'${ID}'.locations.png'
    wget -q 'ftp://ftp.bom.gov.au/anon/gen/radar_transparencies/'${ID}'.rail.png'
    wget -q 'ftp://ftp.bom.gov.au/anon/gen/radar_transparencies/'${ID}'.range.png'
fi

# Get the $iqty most recent images quietly
curl --silent --list-only ftp.bom.gov.au/anon/gen/radar/|grep $ID.T|tail -$iqty|xargs -i wget -q 'ftp://ftp.bom.gov.au/anon/gen/radar/{}'

# Processes the images
convert -layers flatten -dispose none $ID.background.png $ID.topography.png $ID.locations.png $ID.rail.png $ID.range.png -dispose previous $ID.T*.png -set delay 75 -loop 0 radar_$ID.gif

# Clean up temp files
rm $ID.T.*

Then used Terminal to make it executable:

chmod a+x /config/custom_scripts/bom_radar.sh

Edited /config/configuration.yaml:

shell_command:
  get_bom_radar: bash /config/custom_scripts/bom_radar.sh 

Rebooted Home Assistant and then added a script:

action: shell_command.get_bom_radar
data: {}

Then added an automation to run the script:

alias: Get latest BOM radar
description: ""
triggers:
  - trigger: time_pattern
    minutes: "20"
conditions: []
actions:
  - action: script.get_latest_bom_radar
    metadata: {}
    data: {}
mode: single

Added a generic camera under Integrations pointing to http://localhost:8123/local/bom/radar_IDR023.gif:

And finally added a Picture Entity card:

show_state: false
show_name: false
camera_view: auto
type: picture-entity
entity: camera.localhost

With thanks and references to: