Using a Logitech Touchpad as a light switch for Philips Hue light bulbs
- By nygren
- Fri 25 March 2016
Our nursery lacked any light switches but did have some wall sconces. As part of redecorating the room prior to making it a nursery back in 2013, I replaced the old sconces with some newer ones from Rejuvenation and installed a set of three Philips Hue light bulbs. As Philips did not yet have a good remote lightswitch (which they've recently released), I had to hack together something to allow the bulbs to be controlled by a switch near the door.
My first attempt was to use an X10 wireless RF wall switch through an Insteon PowerLinc USB gateway to some custom python software, but this was quite flakey as I've had bad luck getting the PowerLinc to reliably send me signals for extended periods of time, plus this relies on X10 which is fairly unreliable. (This used the crazy control path of a button push resulting in X10-over-RF to X10-over-powerline to USB to an HTTP-over-ethernet request to the Hue hub to ZigBee RF to the bulbs.)
Even from the beginning, I also setup an experiment (which has worked quite well) of having a cron job run every few minutes and update the color temperature of the lights based on the time of day --- warm lighting in the evenings and cool "daylight" in the mornings. This has worked quite well both for the Hue bulbs I have in my office as well as those in the nursery (and in the Lightstrip I've recently added above some windows in our living room).
Looking around for better ways to control the light bulbs, I had trouble finding any sorts of reasonably priced RF switches with long battery life and a robust way to get control information to a Linux machine (my preferred gateway to my home automation).
What I did find was the "Logitech Wireless Touchpad with Multi-Touch Navigation" which was $25 at the time:
I have software running on my Linux machine that reads this as a USB Input device and then sends out commands to the bulbs via the Hue hub. This gave me two mouse buttons (left and right) which I repurposed for "on" and "off". I was able to use the gestures as additional input control. A single finger up/down gesture can be used to dim the lights. Two fingers left/right adjust the color temperature of the lights (or the hue in color mode). Finally, a "three finger up" gesture puts the lights into "dim red mode" which is particularly good when getting munchkins ready for bed or when stumbling into the nursery in the middle of the night.
Source code is available here on github, although it is meant as a starting point for someone wanting to play with this, and is NOT an easy-to-use off the shelf solution for someone not used to home automation hacking in python. It relies on isaackelly's python-hue library.