logIt Log Around The Clock

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.

Nebri OS workflow from YWeather to Twitter

Key-value pairs as trigger for event driven Nebri OS workflow

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 twitter rule script where our simple Nebri workflow ends. This is how I get multiple cities, by using different Drips, different events, running the same workflow. Both yweather and twitter scripts are also example of API connectivity to Nebri.

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.

PS: “hujan” means “rain” in Indonesian

Leave a Reply