ActionTiles: Show Local Weather
After I had played with some of the basics of getting tiles in place to control my smart lighting (Philips Hue), I wanted to get some more dynamic content. I wanted pictures and changing tiles and cool looking things to impress, but also to be useful. Reading through the forums, I found that people had copied links from their local news stations for weather imagery.
If you haven’t done that, go take a look. I checked out my local NBC, CBS, and ABC affiliates, and found that NBC had both the info graphics I wanted, as well as static URLs. That means I can create a Media tile, use that URL, and have a cool infographic on my screen with local weather!
Sidebar
What’s a static URL? A static URL is a link that doesn’t change. Images have a URL, which is how your browser knows where to go to pull down a picture so it can display on a web page. Most browsers will let you right click on an image and select ‘Copy Link Location’ or something similar. That is the URL for the image, and can be saved for use later. If the URL changes or is randomized, you can’t reuse it, but if the name is always the same and they just update the picture, then you are set.
Except, I’m really picky.
ActionTiles doesn’t let you edit or crop the image that you point to, and they don’t allow custom CSS (more on that another time) for altering what is shown. This means I had to get creative.
What I needed to do was write some python scripts. After some experimentation, I came up with two individual scripts: one to save the files locally to my webserver, and one to crop the images. Why did I need to crop them? Each picture is meant to be displayed on a nice big screen, and I’m squeezing each into a little 2×3 tile. I wanted less frills and more useful info. So after saving and cropping the pictures, I was able to configure ActionTiles with three media tiles that point to my three, cropped image URLs on my local Synology web server.
Something important to point out though is that those URLs only work when you are on your home network. So if you are at work or a friends house or a coffee shop and you load the ActionTiles page, those tiles will show the little broken ‘…’ sort of icon.
I’m running these scripts on my Synology NAS, which makes it easy for me to schedule the script, and also run a webserver at the same time. You can do the same thing on any random computer in your home, assuming you know how to configure those options. A regular PC will do it, but there is more uplift in the setup since they generally do not come pre-built to do it.
Each script is on it’s own page so I can include notes: