After installing a hidden Linn DS for my bathroom, I found controlling it tricky, whilst using the phone is okay, I'd still like the convenience of a remote to switch off the music on the way out.
I worked around this problem by extending the alarm clock functionality already in use for my kitchen to include a 'set standby' option. This would place the bathroom DS into standby mode at known times. Not ideal, but more useful.
The Linn solution to this is a control panel on the wall which offers volume, power and a remote IR sensor. Whilst this gives me the ability to switch off on the way out. It would mean having a remote control in the bathroom to change source and not something I'd like. Since I'd added functionality to schedule stored playlists to start as well as the radio I convinced myself I also wanted the ability to preload a known selection of music at the press of a button. I'm a coder and after watching the RI Christmas lectures on 'hacking your home' I felt this was something I should do myself.
After some online digging around I was going to go for a home grown button panel solution hooked up to a RaspberryPi in the loft; until a work colleague @kylegordon suggested a home automation solution might be an alternative. After discovering the RFXCom433 and the LightwaveRF Mood Switch I realised I could make this happen. Kyle also recommended a Node.js library https://github.com/bigkevmcd/node-rfxcom which had support for everything I needed and would advertise the LightwaveRF button clicks as events.
I ordered an RFXcom433 and a LightwaveRF Mood Switch/LightwaveRF inline relay bundle; the original idea was to replace the bathroom light switch tying the 'on' and 'off' buttons of the Mood switch to trigger the in-line relay (switching the bathroom light).
On Friday I received all the bits.
I initially installed the Windows drivers and upgraded the firmware for the RFXcom, although it already had support for everything I wanted. I had a few issues getting the node-rfxcom package installed on windows due to a serialport dependency node-gyp which required python. Updating the package.json for node-rfxcom to a newer version of serialport (~1.4) solved this problem on windows.
I then wrote a quick node.js app using the node-rfxcom library to send a LightwaveRF switch command on initialisation so I could pair the lightswitch, then display a console message on each button click afterwards.
Once paired and working I transferred the RFXcom to my Debian Linux Microserver, where I found I needed no drivers for the RFXcom transceiver. The node.js app was updated to send HTTP calls to the DS playlist service to toggle standby and preload 1 of 3 named playlists.
The code I wrote is on Github https://github.com/bazwilliams/home-automation.
After trying it out, I realised I didn't want to just toggle standby, I wanted to override the standby button to play radio if it was already off.
'GroupOff' = Switch Off or Switch On and Play Radio
'Mood 1' = Play 'preset1' playlist
'Mood 2' = Play 'preset2' playlist
'Mood 3' = Play 'preset3' playlist
After installing this on the wall next to the lightswitch I realised, the top buttons could be refashioned as volume controls and I could leave the existing 'manual' light switch. I added some new endpoints to the upnp-playlist-service to increase or decrease the volume of a Upnp device via a RESTful HTTP call and reconfigured the home-automation app to call these when the buttons are pressed.
After just a day, I've got a fully functional control pad on the wall, controlling my bathroom DS giving me, power, volume, radio and preset playlist support!
I've also got a spare radio controlled relay burning a hole in my pocket for installation somewhere - I'm thinking my outdoor light could do with some geofence based control!