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

    Lyricist III
    January 25, 2016
    I've tried in IE, Safari on Mac, no difference, and the console from IE had an HTML error (which I fixed just to check) and that went away and there are no messages/errors logged in the console now
    Lyricist III
    January 25, 2016
    ok, interesting, i just installed it on my mac and it works. Must be something to do with Windows but i can't work out what it is!
    jishiAuthor
    Headliner II
    January 25, 2016
    I'll see if I can fire up a virtual win 2012 and see whats going on. Give me a day or two.
    Lyricist III
    January 25, 2016
    ok that will be great, thanks
    jishiAuthor
    Headliner II
    January 26, 2016
    I've tried in IE, Safari on Mac, no difference, and the console from IE had an HTML error (which I fixed just to check) and that went away and there are no messages/errors logged in the console now

    I tested with a clean win2012 R2, and it runs without a glitch, I just needed to allow the node.exe program through the firewall. There must be something else going on. How is that machine connected to the network? Multiple interfaces? Any VPN or similar that might give issues?

    Btw, both IE and Safari is unsupported. Safari probably works, IE, probably not. Target browsers are Chrome and Firefox, since they are cross platform.
    Lyricist III
    January 28, 2016
    Thanks for trying, to be honest, I'm not sure what's going on. everything else works fine on those servers, no multiple interfaces, no VPN, no VLANs, just directly connected to the same network as the sonos and the official controller works fine.

    Not to worry though, I installed an Ubuntu VM on the windows server and installed it there, and that works fine, which is fine for me
    Lyricist II
    March 10, 2016
    I would love a way in the mobile screen to dictate the player is displays. I am trying to integrate something in a control application that will show as a URL.
    Any way that can happen?

    On second thought I could also just run multiple instances if we are able to dictate which players are picked up by the app.
    jishiAuthor
    Headliner II
    March 11, 2016
    I would love a way in the mobile screen to dictate the player is displays. I am trying to integrate something in a control application that will show as a URL.
    Any way that can happen?

    On second thought I could also just run multiple instances if we are able to dictate which players are picked up by the app.


    I did a workaround for this for the dashboard view a while back, where you could append the UUID to the url (http://localhost:8080/#UUID_12345678901400) to force the selected group when loading the view, but I can't seem to find it right now.

    I'm guessing you want this in order to have a fixed controller for a certain zone/player? Unfortunately the web-controller project hasn't gotten any love in the past year because of limited free time, but what you are asking for is fairly trivial to achieve.
    Lyricist II
    March 11, 2016
    That is exactly what I am looking for. Really just a status screen that shows currently playing art, title, and next up title for a specific player. I would be happy to donate to the cause if that could free up some of your time.
    jishiAuthor
    Headliner II
    March 11, 2016
    That is exactly what I am looking for. Really just a status screen that shows currently playing art, title, and next up title for a specific player. I would be happy to donate to the cause if that could free up some of your time.

    I wish it did, but unfortunately not 🙂 the /dashboard view is actually what you are looking for then, see this video: https://www.youtube.com/watch?v=0x-Nhzd0ueg. However it doesn't have a flexible design atm and is designed for a full HD resolution, but it might be a good start if you are a bit familiar with HTML/CSS.