Skip to main content

Linn DS Homebrew RCU with Playlist Support

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!

Comments

Popular posts from this blog

Howto: Ubuntu 8.10, Dell 5530, 3G/WWan and GPS

There is an updated howto on the Dell 5530 using my own python based monitoring tool at http://blog.bjw.me.uk/2009/03/dell-5530ericsson-f3507g-on-linux.html

Introduction

Here is a Howto document for getting the Dell 5530 wwan card working along with the onboard GPS under Ubuntu 8.10. This card does not work conveniently with the bundled Network Manager software, but replacing NetworkManager with other utilities will give the ability to get online using a pretty GUI and not have to resort to using wvdial and the command line...

It should also work with the Ericsson f3507g as I believe the Dell 5530 is a rebadged version of this module.

Check Hardware

First you need to check the modem is detected correctly. On my computer, the modem is detected out of the box by the cdc_acm module and exposes three serial ports (/dev/ttyACM[0,1,2]) for communication. Check by running:

dmesg | grep ACM

Mine shows the following:


[ 34.385302] cdc_acm 1-6:1.1: ttyACM0: USB ACM device
[ 34.390039] cdc_a…

BBC Micro:bit Toothbrush Timer

A few months back I bought a BBC Micro:bit at the Science Centre in Glasgow and it's been fun building apps with the single board device. I thought I'd write a blog entry about the latest project which will be a more permanent installation in our bathroom.

A toothbrush timer!

Kitronik sell an add on board which provides power from a coin cell battery and a piezo buzzer called a Mi:power, they also sell a Mi:power case which is designed to fit around a Micro:bit fitted with the Mi:power. This assembly combined with some code offers a neat toothbrushing timer. By using the display on the front we provide a short countdown - with a little tune through the buzzer. The program show 6 areas of the mouth to brush each for 20 seconds before showing a toothy grin and a finishing tune. Each time the area of the mouth changes it plays a 'level up' style jingle.



Links to the parts:
Mi:power https://www.kitronik.co.uk/5610-mipower-board-for-the-bbc-microbit.html
Mi:power case htt…

12 Factor Config for .Net on Mono in a Docker

Recently I've been thinking about how to run a .Net application using Mono inside a Docker, along with this we'd like to use Twelve Factor config.

Whilst it is possible to use some library to access environment variables instead of using appSettings it becomes difficult for database and message broker URLs which other libraries may expect to find within the App.config or Web.config file.

The solution I came up with follows:
Build the application without an App.config moving the existing configuration file renaming it App.config.template. 
Substitute any environment variables you want with ${}.  E.g:
<amqp> <connections> <connection name="rabbit" server="${RABBITMQ_URL}" password="${RABBITMQ_PASSWORD}" /> </connections> </amqp>
Include within the Docker image a script named sub.sh similar to this and add it to /conf:
#!/bin/shwhile read line doeval echo "$line"done Add your config template to /conf
Then …