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:
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'
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
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
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.
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.
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.