Sonos with node.js, my attempt!



Show first post
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.

397 replies

steelrat how did you get it working when i go to ip/dashboard i get blank just black

Well, I don't really have an answer.... other than, I wonder if it's because of how the pandora on your side is doing the stream. It's a logical assumption that slacker or rdio are acting closer to how the spotify is functioning that J's using....

Can you try any other sources than pandora? Even say the freeby version of slacker, which I have working here?
Sorry no matter what i do nothing comes up in the dash info where in the code can o force a zone name or id ....I don't understand biggest zone I am sorry.....

If I'm understanding the logic.... it's the device group with the most players....

Lets say you have 10 devices total....

Groups 5 players, 3 players, and a few singles....

It would pick the 5 player group.
Userlevel 2
Yes it does work with groups only not a single player is there a way that i could force the player id in the script so it will work for a single player I am just learning here and so please excuse my lack of understanding I appreciate your patience ......Robert
Userlevel 2
I have a single player in my setup (play5) and the dashboard is operating as expected in firefox. It would be nice to have the basic controls like volume, next, previous and play/pause along the bottom. Nothing fancy, just a nice layout for listening and viewing the album art
Userlevel 2
I do not dispute single player working it is when you have many players in your system the first player only will display if none are in a group I believe he did this to help me get a handle on the code am just trying to work out how to make it work a specific zone
Userlevel 4
Badge +14
As I said, it was never meant to be a controllable GUI, I only made it for my personal use in the Office.

If you want to control which player you will use, you will need to modify the "topology-change" event, line 43 in index.html to make another selection based on some input parameter (#uuid or ?uuid), something like this:

/dashboard/#RINCON_0058000000

code:

socket.on('topology-change', function (data) {

var players = {};

// make a hashtable of all players
data.forEach(function (i) {
players[i.uuid] = i;
});

// find which player you are interested in
var desiredPlayer = players[location.hash.substring(1)];

// now, we want the coordinator instead
currentZone = players[desiredPlayer.coordinator];

renderInfo();
});


It would probably be possible to rewrite it using roomName instead, but that requires some more thinking which I'm not capable of at the moment. If someone wants to create an enhanced version of this dashboard you are welcome to fork and send a pull request to me, but I will try and focus on some other alternative controller views.
Userlevel 2
No problem and many thanks........ for the guidance it really helps...
Userlevel 4
Badge +14
Been silent the last week, been trying to reclaim some sleep.

However, got some news for you. The web controller now has a working master mute. I also re-made the content of all buttons in SVG which means that it will scale nicely when making the interface bigger. Also added some css effects for a better feeling.

I also tried to make a fix when having multiple interfaces in your computer. Now it will search for Sonos players on all networks, and use then one which find a player first. Probably not of concern for most of you, but might help some of you with more advanced setups.

Enjoy!
Userlevel 2
A gift for the holiday thank you ....:D
Userlevel 4
Badge +14
I'm sorry but I broke compatibility with node 0.8 in my last changes. This is fixed now. This is mostly for rasberry Pi-users, since it's a pain upgrading from source on it.

EDIT: Actually, you can download pre-compiled version here:
http://nodejs.org/dist/v0.10.22/node-v0.10.22-linux-arm-pi.tar.gz
Userlevel 2
A bit off topic but how does one run your code as a server on a raspberry as a service every time i redirect node server.js > robert.txt i do not return to the bash so i can run the other script .....thanks

It does run though so the install is correct.....But have no clue what I am doing yet but learning....

Thanks
Userlevel 2
you can use the screen command to launch individual sessions on linux. Attach and detach from sessions at will
Userlevel 2
tried the new version works well in puppy linux but not so well in FreeBSD where it worked previously. Now the IP detection for the controler no longer functions. I get the following:
- binding SSDP to port 2509
- relevant IPs {}
- info - socket.io started
- http server listening on port 8000
notification server listening on port 3500

looks like it does not detect the network interface and then scan for sonos. This worked in previous versions. Any advice??
Userlevel 4
Badge +14
tried the new version works well in puppy linux but not so well in FreeBSD where it worked previously. Now the IP detection for the controler no longer functions. I get the following:
- binding SSDP to port 2509
- relevant IPs {}
- info - socket.io started
- http server listening on port 8000
notification server listening on port 3500

looks like it does not detect the network interface and then scan for sonos. This worked in previous versions. Any advice??


Which version of node are you running? Apparently the interfaces aren't detected on freebsd for some reason, probably an incompatibility in node.
Userlevel 2
Thanks for the quick reply. I am running FreeBSD 9.1p5 and Node-Devel-0.9.3 the latest port that I am aware of.
Userlevel 4
Badge +14
Thanks for the quick reply. I am running FreeBSD 9.1p5 and Node-Devel-0.9.3 the latest port that I am aware of.

The dev build and the stable build are different packages, could you try it with the stable build, which should be 0.8.x something?

I'm not sure how the package system on freebsd works, but there seems to exist ports for 0.10 as well, but maybe not for your version?http://www.freshports.org/www/node