For quite a while now, I had thought about controlling my away status in chat programs (IRC once, Skype today) by my actual presence or absence at my computer. While feeding the signal of a small switch on my chair to the serial or parallel port has a certain charm of its own, the cabling always troubled me. So it came to pass today that a bright light illumated the hazy dimness of my mind and a voice whispered 'webcam'.
Appearing as a major project at first, it quickly boiled down to two components and about an hour of work: a program for motion detection and a script for feeding Skype API commands to Skype. Last things frist I thought, so I reduced the python sample code for Linux from the Skype developer pages to a small script passing Skype API commands from the command line to a Skype instance, essentially allowing you to control Skype from shell scripts and the like.
In order to detect whether the webcam sees me or my empty chair, face recognition would be ideal but seemed somewhat daunting. Picking my nose, I realized that I do that a lot while my empty chair does not, leading to a rather simple deduction: motion -> I am at my keyboard picking my nose - no motion -> I am at my keyboard asleep and won't respond to IRC/Skype messages. Soon I found Motion, a superb little Linux application for motion detection on Video4Linux devices, for watching your PC being stolen, and many other paranoid kind of things, therefore perfectly suited to my plans. All I needed to do was to configure an appropriate length of events and make it call my python script at the beginning and at the end of events:
gap 60
on_event_start skype-command.py SET USERSTATUS ONLINE
on_event_end skype-command.py SET USERSTATUS AWAY
Vastly more creative uses of this do not appear to be completely impossible.



