Archive for April, 2008

Load shedding bot FAQs

Thursday, April 17th, 2008

Since posting about my Jabber load shedding warnings bot I’ve had a couple of questions asked about it. So here are the answers:

Where does the data come from?
The City of Cape Town has posted on the web the load shedding timetable as an Excel spreadsheet. I do a bit of manual manipulation on the spreadsheet before dumping it to a CSV file. Then I have a script which parses the CSV file and generates a SQLite database.

What’s the bot coded in?
Python. (Of course.) It uses the xmpppy module to do the Jabber communication, and SQLObject for the database.

How does it work?
The bot is actually made up of two separate components. There is a control daemon that is always available on Jabber, which accepts subscriptions and responds to your commands. Then there is a queuerunner fired by cron at the appropriate times, which sends the warning messages; it uses a negative Jabber priority, so your messages to the control daemon will never go to the queuerunner by accident.

How many users do you have?
As of 18 April, there are 20 users. The average user subscribes to warnings for two different locations.

Get load shedding warnings via Jabber

Saturday, April 12th, 2008

Tired of having the power go out without warning? Now you can get warnings about predictable load-shedding sent to the Jabber account of your choice – including Google Talk accounts. Unfortunately, at the moment the warnings are for the City of Cape Town supply area only.

To set it up, ask your Jabber client to subscribe to loadshed@frith.co.za – in Pidgin that’s the “Add Buddy” command, in GMail it’s “Invite to chat”. The loadshed bot will accept your subscription, and reciprocate with a subscription request to you. When you accept it, the bot will send you instructions about how to proceed.

You can search the list of suburbs by sending the message “search [text]“, which will give you a list of suburbs in the City Council’s list with a name matching “[text]“. Then you can subscribe to warnings for a suburb with “subscribe [number]“, where [number] is the number that was listed next to the suburb in the search results. There’s also a “list” command which shows what susburbs you’re subscribed to; and “unsubscribe [number]” which works in the same way as “subscribe”.

The bot will send you warnings 15, 10, 5, and 2 minutes before the load shedding period is scheduled to start. A planned future development is to make the warning times configurable.