Part of my RPi security camera to allow switching of lights in response to motion events.

It consists of a server that listens for messages coming in, and switching RPi's GPIO pin(s) high or low depending on whether a "on" or "off" was received. The client program gets called by "motion" and sends an "on" when a motion event starts, an "off" when it ends.

See for more details.