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.
Tags: bot, faq, load shedding, loadshed