I thought I might share my toying with this type of approach with the Australian BOM radar images. I wasn’t able find a url that had the wanted images (although I am sure it exists) as BOM seem to provide the png’s in transparent layer format. So wanting to play a little with ImageMagick I installed the package and created a quick bash script. I am sure the python gurus can do better with a more eloquent script.
get_radar_img.sh
#!/bin/bash
#Config Variables
ID="IDR713"
iqty=5
img_out="/home/homeassistant/.homeassistant/satimgs/"
#Change to the images directory
cd $img_out
#Get the 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}'.locations.png'
#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.locations.png -dispose previous $ID.T*.png -set delay 75 -loop 0 radar_$ID.gif
#Clean up temp files
rm $ID*
I then add an automation to grab and process the images on a regular (20 mins??) basis. This is the downside of this approach as I am downloading even when I am not using them. It takes about 5+ secs to download and process for me which was a bit laggy to call the script on page load.
script:
get_radar:
alias: Grab the latest BOM radar
sequence:
- service: shell_command.get_bom_radar
automation:
alias: Call Radar Images
trigger:
platform: time
minutes: '/20'
seconds: 00
action:
service: script.get_radar
I then just added a camera.local_file to the appropriate group and all was well. There are still a couple of rough edges like the ImageMagick command is not quite right but I will tidy that up when I get a chance. BTW: You can easily change the number of images in the loop, size of the images, type of background overlays. This is really flexible in how the images look.
camera:
- platform: local_file
file_path: /home/homeassistant/.homeassistant/satimgs/radar_IDR713.gif
name: bom radar
Let me know if anyone makes some improvements as I am a absolute HA nube (2 weeks and counting).