You can get nice, weather-based wallpapers for free, but then you’re at the mercy of whoever designed it, both when it comes to quality of the wallpaper and weather service. I’ve been wanting to try my Tasker skills on something weather based for a while now, so I thought I would see if I could make my own weather-based wallpaper changer.

The basic concept here isn’t too complicated, and as I already said, I used Tasker for this. The idea goes something like this: Pull weather data from somewhere, and tie that to various wallpaper changing actions. I started by checking out the Norwegian weather service yr.no, which should be the most accurate for me here in Norway. It offers several methods for accessing weather data, but after poking around for a bit, I found that the simplest way to extract it would be to get a PHP script that simply extracts all the alternative text attributes from all the images on a web page, displaying weather for my location. This is because they display a whole range of icons on that page, and those icons have alternative text attributes in the HTML that are standardized weather states, e.g. “Partly cloudy.”

I already have a PHP script for another Tasker setup that does something similar, so with a bit of help from people smarter than me, I had a copy that extracted the alternative text attributes. Then I moved to Tasker and used its HTTP Get feature to pull that data into a text file, and then back into a variable that I could modify. Using Variable Section and Variable Split I was left with a %Weather1 variable that always displays the “code” (e.g. Partly cloudy) for the next 6 hours.

With that working, it was off to Photoshop. I made a template using a screenshot of my home screen, with a torn paper effect that tears away part of the black wallpaper to shine something else through. That something else is one of 7 weather related images. The weather service has way more than 7 weather states, but I don’t really care much about the difference between e.g. sleet and thunder versus rain and thunder.

With the wallpapers made and saved to a folder on my phone, the rest was fairly simple. I found a list of all the potential weather states the weather services uses, and created 7 individual Set Wallpaper actions following the actions that pull the weather data into %Weather1. Each of them uses the If condition to match %Weather1 to one of multiple different weather state codes. E.g. the thunder wallpaper triggers when %Weather matches *thunder*/*Thunder*, while the fog wallpaper simply triggers on Fog.

All things combined, when the task runs, it pulls the weather data into %Weather1, and then runs the Set Wallpaper version where it finds a match. I then added the entire task to an existing 1 hour timer profile, so that it checks the weather and updates the wallpaper every hour. Since the hourly timer already existed to run another task, it’s not too much of a pain to have it run another task too.

The difference between this method and using a stock method basically comes down to three things: I was able to use my own weather service, I was able to use my own wallpaper, and it uses static wallpaper – not live ones. As far as Tasker setups go it’s medium in terms of difficulty, and it’s possible to do this entirely in Tasker instead of using PHP. In fact, there’s already an existing tutorial for doing this on the Tasker wiki. My method uses another provider and a different method for filtering the data, but at the core the two are rather similar.

As with everything Tasker, this sort of system also has implications for other things. The Set Wallpaper feature can be used to create situation-base wallpaper for essentially anything, like whether the phone’s on silent or switching between a personal and a professional wallpaper when you’re at the office.

I’m not sure if I’m actually going to keep using this, as it’s sort of pointless when the little weather icon in my Make Your Clock widget pulls the same data from the same source, but it was a learning experience to do it nonetheless.