Skip to main content
Headliner II
March 5, 2013

Sonos with node.js, my attempt!

INFO

Source code here: https://github.com/jishi/node-sonos-http-api
Sonos Web Controller draft (work in progress!): https://github.com/jishi/node-sonos-web-controller
Sonos IR control (requires lircd and IR reciever): https://github.com/jishi/node-sonos-remote-control

==============================================================


I know that there already is an attempt at this by this guy: http://forums.sonos.com/showthread.php?t=32643, but I found it to be a bit lacking in functionality so I decided to write up my own.

I have created a simple web-based API using what I have, which could be useful for integrating stuff with other applications. This web based API is inspired by other RESTful APIs, however I don't think it follows the correct guidelines to be called a REST API.

IT supports most basic features like:

play, pause, seek, next, prev, volume, mute, setAVTransportURI

It also supports these advanced fatures:

State of player as JSON, zone info as JSON, Play favorite item, presets (grouping, volume, avTransportURI)

You can read more in the README for each project.

To run it as a service under linux, I suggest using pm2 (https://github.com/Unitech/pm2). You need to run it in forked mode (-x)!

For Windows, you might try Winser http://jfromaniello.github.io/winser/

Cheers!
    This topic has been closed for further comments. You can use the search bar to find a similar topic, or create a new one by clicking Create Topic at the top of the page.

    391 replies

    Avid Contributor I
    March 24, 2014
    ...

    Hi Jishi,

    Thanks for your project and support you provide. Would it be possible to get an image for my Raspberry Pi from you. I'm not so used to compiling and more. An alternative would be a detailed installation guide. Is one or the other possible?

    Best regards, Olly
    jishiAuthor
    Headliner II
    March 25, 2014
    Hi Jishi,

    Thanks for your project and support you provide. Would it be possible to get an image for my Raspberry Pi from you. I'm not so used to compiling and more. An alternative would be a detailed installation guide. Is one or the other possible?

    Best regards, Olly


    I'm a little rusty on how to create an image but I can probably write up a step-by-step how-to on the raspberry installation, but I would need to redo it all from scratch to take note of all steps. If I manage to create a clean installation I may even be able to create an image for it, but in that case it would be preferable to have some sort of easy update feature as well.
    Avid Contributor I
    March 25, 2014
    I'm a little rusty on how to create an image but I can probably write up a step-by-step how-to on the raspberry installation, but I would need to redo it all from scratch to take note of all steps. If I manage to create a clean installation I may even be able to create an image for it, but in that case it would be preferable to have some sort of easy update feature as well.

    That's great news. I was doing some little projects with the Raspberry in the past and I have to some extend experience with programming and computers, but not as much as you are talking about in this whole thread. So I'm a little worried, but I'll start soon. Still waiting for the IR receiver, case and some other accessories. Maybe I can help with the HTML/CSS UI support. My use case is your mentioned BigPicture-Support (what is playing now and next) and IR support (for basic navigation like Play/Stopp, Next, Previous, Favorite 10).
    Avid Contributor I
    March 26, 2014
    I installed this app on a Raspberry Pi an it looks great! But now I'm trying to get it running on boot (with Forever) and there is one strange thing. When I navigate to the sonos folder first, it runs just fine:

    cd /home/pi/sonos
    node server.js


    But when I run it from any other folder I only get a blank screen in the web browser:

    node /home/pi/sonos/server.js


    No error message. It seems to be running though...
    jishiAuthor
    Headliner II
    March 26, 2014
    I installed this app on a Raspberry Pi an it looks great! But now I'm trying to get it running on boot (with Forever) and there is one strange thing. When I navigate to the sonos folder first, it runs just fine:

    cd /home/pi/sonos
    node server.js


    But when I run it from any other folder I only get a blank screen in the web browser:

    node /home/pi/sonos/server.js


    No error message. It seems to be running though...


    Found the problem. I have pushed an update to the git-repo that fixes that.
    Avid Contributor I
    March 27, 2014
    Thank you for fixing that. Boots fine how.
    In Firefox it works great. But in Safari (iMac, iPhone, iPad) I have several small issues. For example the queue is not scrollable on iMac. But on iPhone and iPad it is fully expanded but also not scrollable. The volume behaves strangely. When I change the volume, the group volume slider goes wild and sometimes the button even flies off the slider. Keep up the good work.
    jishiAuthor
    Headliner II
    March 27, 2014
    As I have stated in the readme, I will never target Safari personally. Focus will be on cross-platform available browsers.

    Webkit is also seriously broken when it comes to some newer css-techniques which makes it difficult to support for this.

    It is also not intended for mobile devices, since it doesn't handle touch events. The plan is to create a touch-friendly layout instead (when I find the time).
    jishiAuthor
    Headliner II
    April 4, 2014
    I just ordered a CuBox-i2 from http://cubox-i.com/

    It has a really nice form factor, with built-in IR-receiver. I ordered the i2 because I am going to run Plex on it, but for only controlling Sonos via IR, hosting the http api and run the web-controller the i1 would probably be more than enough.

    Maybe I can even make a pre-made image with everything needed 😃
    buzz
    Grand Maestro
    April 5, 2014
    I remember my first single board computer. It was ground breaking at the time with a four character seven segment display, a numeric keypad, and was about the size of the larger iPads. I paid several times the cost of CuBox.
    Avid Contributor I
    April 21, 2014
    I'm a little rusty on how to create an image but I can probably write up a step-by-step how-to on the raspberry installation, but I would need to redo it all from scratch to take note of all steps. If I manage to create a clean installation I may even be able to create an image for it, but in that case it would be preferable to have some sort of easy update feature as well.

    Any news about this? I'll start tomorrow with my raspberry pi and appreciate every piece and bit to help me getting started...