Skip to main content

Linn DS Alarm Function

Update 2014 - An alternative to this is available on GitHub which uses Node.js and should be cross platform. Linn DS Playlist and Alarm Server

Switching the radio on in the kitchen in the morning is a low priority amongst setting table, pouring cereals, carrying children, etc. The Sonos has an alarm clock facility which allows you to switch on the radio at a set time avoiding hassle of starting a controller.

When I upgraded to my Linn Sneaky DS, I no longer had this function, though the remote control made it easy if I forgot to take my phone downstairs with me.

Last week I decided to figure it out. I have a Linux machine which runs Ubuntu and runs all the media servers, backups and network shares. I decided to investigate how to control my DS from the command line.

Conveniently, the DS can be controlled via a web api, so after reading the docs and a few examples I was able to switch off and on and change source via Postman (Chrome REST client).

I then set about writing a curl script to send the commands and package this up as a shell script.

One final problem was discovering the IP address of the DS which I solved by using gupnp-tools which has a scanner; this scans my network for UPNP devices and since I know the UUID of the DS I can extract the correct IP address.

By adding the script to my Linux box' crontab, the DS starts on the radio each weekday morning.

How it works

Need to install gupnp-tools which provides gssdp-discover.

I created a script called which takes a parameter of the UUID of a Upnp device and returns the IP address:

gssdp-discover -t ${1} -n 3 | grep Location | sed 's/.*http:\/\///' | sed 's/:.....\/.*//'

Next is a script called to set the source of the DS:

curl -X POST -d @${2} $1/Ds/Product/control --header "Content-Type:text/xml" --header "Accept:text/xml" --header ""

This takes in 2 parameters, the first is the IP address of the device you want to control and the second is a file containing an XML body containing details of which source to set on the device, in this case, it is the radio function (source Id 1):

<?xml version="1.0"?>
<s:Envelope xmlns:s="">
  <s:Body s:encodingStyle="">
    <u:SetSourceIndex xmlns:u="">

Finally it's all put together in the following script. Set the SCRIPTS property to where you've saved the files above. Set the UUID property to the UUID of your DS - you'll need to scan your network to find this. In Windows, my DSs appear in the network view of Windows Explorer and I can see the unique identifier (UUID) if I right click the DS and view properties.


Now just add it to your crontab:
45 6 * * 1-5 /home/barry/scripts/

Enjoy one less thing to do in the morning :)

Here's the api documentation for the DS:


Guussie said…
Hi barry, I have tried to modify your code in order to put a DS player in StandBy but I can't get it to work.

Would you have any suggestions on how to do this?

I want to put a DS player in standby from a Raspberry Pi.

Guussie said…
I ahem tried to modify your code with the objective to put a DS player in StandBy but can't get it to work.

The discover code works but I seem to have mistakes in the xml portion.

Would you be able to point me in the right direction?

I want to switch off a DSi from a Raspberry Pi.

Barry said…
To put the Ds into standby, you'd need to use the Product service. Assuming Davaar > 50, the Xml will look something like this:


And the command would look a bit like:

curl -X POST -d @${2} $1/Ds/Product/control --header "Content-Type:text/xml" --header "Accept:text/xml" --header ""

This was written some time ago and I've since moved on to either:

Upnp Playlist Service - this has basic alarm clock functionality

Openhome device Python library - this provides a basic python library - you could set standby functionality using this instead.

Home Assisant - A Smart Home application that can run on a Raspberry Pi, now supports openhome devices. This is what I use.

Let me know how you get on!
Barry said…
That's annoying - XML doesn't work in Blogger comments :(
Barry said…
Basically replace SetSourceIndex with SetStandby
Guussie said…
> Basically replace SetSourceIndex with SetStandby

I tried that but could't get it to work.

But I found a simpler solution through the Linn Forum.

I have now combined that with your and it works very nicely. I will post it soon, once I have cleaned up things.

Thanks for your help!

Barry said…
No worries.

I would recommend the Home Assistant solution though - hooks into any other smart home equipment you may have - including Alexa or Google Home.

Great having my Ds switch off when I leave the house and change colour based on the source!

I wrote the openhome support :)
Guussie said…
I installed the Home Assistant on my test rig. Seems to work OK but the openhome component does not install correctly, even after updating the configuration file.

Looks like an very interesting platform and I will investigate further. Thanks for this suggestion!
Guussie said…

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


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 case htt…