Code I'm using for a Home Automation system based on the Raspberry Pi.