Manage your Chumby’s alarms via WebDAV
Note This article is substantially out-of-date (especially with regard to how the crontab works on Chumby). If you really insist on using this method, you may want to glance at the other story, Manage your Chumby’s alarms via Email for reference.
As it turns out, I’ve been having quite a few sleepovers at the significant other’s abode lately. My alarm is as loud as the sun is bright; during the depths of the dark, rainy Portland winter, I decided to pick up a new and innovative alarm clock. After looking through alarm clocks that shock you, roll around the room, fly up into the air, and donate money to the Republican Party if you press ‘snooze’, I settled upon the most innovative of them all: The Chumby. Running a version of embedded Linux named BusyBox, it’s really more of a tiny computer than an alarm clock— the guys at Chumby Industries like to call it an Internet Appliance.
As I was saying, this alarm clock is loud; after initially being woken up by the oddest selections of Pandora at 5:00 AM, I decided to just send one of my favorite relaxing wake-up songs (‘Hibernating‘ by Console, if you must know) to the device, but enable something called the ‘Backup Alarm’— just in case for some reason it cannot find any MP3s on its generous internal storage.
If I fail to turn my alarm off within five minutes of its first peep, I’ll risk being be terrified to death by the shrieking hellfire of electronically-synthesized waveform doom that the Backup Alarm will let loose upon my bedroom. Since I’m often not home, this shrieking noise may awaken (and potentially piss off) my roommate, neighbors, city— especially if it is going off for a whole hour before I arrive home in the morning to dismiss it— and I generally try to be as considerate of a person as is practical.
So, I wrote a couple of little scripts—one to synchronize the file containing alarm information with an arbitrary WebDav server, and one to edit said file while on said WebDav server.
WebDav Share
Setting up a WebDav share is outside of the scope of this walkthrough, but as always google has developed a solution to this problem.
Python on the Chumby
After SSHing into your Chumby, you’ll need to download, extract, and install the pre-compiled version of Python2.6 for your Chumby.
# Temporarily re-mount the root drive as read-write mount -o remount,rw / # Create a folder to hold your python installation, and head over there mkdir /mnt/storage/python cd /mnt/storage/python # Download and extract the Python binaries wget http://files.chumby.com/languages/python/python2.6-chumby.tgz tar -xvzf ./python2.6-chumby.tgz # Link these libraries to their proper homes cd /usr/lib/ ln -s /mnt/storage/python/lib/* ./ cd /usr/bin/ ln -s /mnt/storage/python/bin/* ./
Install this script
# Copy the script from Adam's shared files mkdir /mnt/storage/scripts/ cd /mnt/storage/scripts/ wget http://media.latestrevision.net/ost/chumbyalarmmanager.py
You’ll also need to edit this file to configure it for your environment. It’s really very easy, I promise.
Set up a cron job
crontab -e
Then, add a line looking like this to the very bottom of the editor window that appears:
*/5 * * * * /usr/bin/python /mnt/storage/scripts/chumbyalarmmanager.py --synchronize
Clean up after yourself
# We won't need this anymore rm python2.6-chumby.tgz # Re-mount as read-only mount -o remount,ro /
You’re all set! Your Chumby will begin synchronizing its alarm.xml file in just a few minutes— you are now free to edit your alarms on either the device directly, or by editing the XML file that it has placed a copy of on your WebDav share.
If you run into unexpected situations; the logs are written to /psp/alarms.log.
Editing the XML file
I’ve also written a little application that I use for editing this XML file— mostly to eliminate accidental errors and to cope with some annoyances of the way our friends at Chumby Industries decided to encode times in the XML file. This application is very crude. Use it at your own risk. If you’d like to use this app, you can download it below this entry.
1 year, 6 months ago