Nebri Automation for Weather Feed to Twitter
The season was intermittently rainy or dry as I began to take interest in weather. After getting stuck with “If-this-than-that” (IFTTT) for multiple location feeds of weather, I found out that I wasn’t alone, a geek hit the same wall, yet bringing another automation forgery: Nebri OS, an event-driven development platform based-on writing rules in Python. Without despise, eventually I still use IFTTT on the other end to send weather alert to my smartwatch again.
A quick adaptation of Nebri’s straightforward blog post is to first shortlist rain related codes into 15 of them and changing from forecast to latest measurement instead. Bridging Nebri and my smartwatch are Twitter and IFTTT recipe–the watch merely mirrored my phone, you don’t need it actually. Why (again) Twitter? Well, rather than the “then that” side–the watch enabler, the “if this” side of IFTTT for Twitter recipes is quite powerful given so many tweet filtering options.
The workflow starts with Drips, a scheduler (
cron) where key value-pairs (KVP) is created at certain time. A rule script (
yweather) is triggered when this KVP is created. The weather results are sets of later KVPs feeding the
Many things already taken care by Nebri, hence unseasoned programmer should easily cope with writing simple Python rule and focus on the automation, nevertheless complex rule should also be accommodated. I was having trouble on using previous KVP from different PID though–moved them to comment in the script, but they seem to be working on it. Check their YWeather blog post on how the basics work and compare what I did in Github. I embed an example tweet from @twithujan below. Yahoo! Weather frequency of measurement and accuracy are of different topic by the way.
Bogor is Light Rain with temperature at 23 °C. Taken at Thu, 28 May 2015 7:00 pm WIT
— Twit Hujan (@twithujan) May 28, 2015
PS: “hujan” means “rain” in Indonesian