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

Userlevel 2

Doesn't the playbar have an auto line-in feature like all the other players though?


Thanks for your quick answer.
Yes the PlayBar could be configured to autoswitch to SPDIF then the TV will output signal on the SPDIF.

My current solution is to switch the TV off and on. Also becuse it's a smart TV (not so smart att all) I like to control my music on the PlayBar from the TV browser.

For sure I will use the Raspberry Pi IR functions.
/Palle
Userlevel 4
Badge +14
do you mean the UI in the browser? then no, i just see the UI with nothing populated in it

Which browser? Most of them have a console that you can retrieve (F12 usually, in Windows), which might output some errors.
Userlevel 4
Badge +14
Thanks for your quick answer.
Yes the PlayBar could be configured to autoswitch to SPDIF then the TV will output signal on the SPDIF.

My current solution is to switch the TV off and on. Also becuse it's a smart TV (not so smart att all) I like to control my music on the PlayBar from the TV browser.

For sure I will use the Raspberry Pi IR functions.
/Palle


did the TV Browser work with this GUI?
Badge
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
Userlevel 2
did the TV Browser work with this GUI?

Yes for sure. It's a LG midrange smart TV launced this year 2013, I think it use some derivate of Chrome. At startup i looks real nice, but after a while some texts is overlayed but all functions works fine.
[edit] Checked and the scrollbars won't work, but the whole screen will scroll instead. Then Track, Artist, Album strings gets to long they will not do CR/LF instead they will move under the album picture and owerlaying the QUEUE text information.

I found if I don't display the "mini TV frame" in the smart TV browser the TV sound will automatically return then i quit the smart TV browser and start watching TV. Works perfect for me!
Badge
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!
Userlevel 2
Well my hats is off to you sir looking very good and As per the space thing I guess I was to blame will bang it more and let u know whats up but first blush and we are smiling Nice job
Userlevel 4
Badge +14
I'll see if I can fire up a virtual win 2012 and see whats going on. Give me a day or two.
Userlevel 2
OK so how would one create a preset to u group a group playing and stop all.....Thanks
Badge
ok that will be great, thanks
Userlevel 4
Badge +14
OK so how would one create a preset to u group a group playing and stop all.....Thanks

Ungroup all players? That's not possible with one preset today, you need to create one preset for each player.

If you just want to stop all of them, you can just send a pause signal for any player in the group (I assume you are talking about the HTTP API now)
Userlevel 4
Badge +14
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.
Userlevel 2
Yes and thanks that will work for now...
Badge
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
Userlevel 4
Badge +14
Yes for sure. It's a LG midrange smart TV launced this year 2013, I think it use some derivate of Chrome. At startup i looks real nice, but after a while some texts is overlayed but all functions works fine.
[edit] Checked and the scrollbars won't work, but the whole screen will scroll instead. Then Track, Artist, Album strings gets to long they will not do CR/LF instead they will move under the album picture and owerlaying the QUEUE text information.

I found if I don't display the "mini TV frame" in the smart TV browser the TV sound will automatically return then i quit the smart TV browser and start watching TV. Works perfect for me!


Yeah, I've heard that modern LG and Samsung is using a version of WebKit, but not sure which one. WebKit do however have some issues with my design because of the expected fixed window size. But for a TV, it would be better to create another UI which suits the format better, and which might be possible to control using the D-pad on the remote and similar. Unfortunately I don't have a smart-TV myself so I can't do any real testing. Next step is to try and create a mobile web UI which will be totally different than the official app, assuming that you can use the touch in an intuitive manner from a phone browser.
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.
New build of the web server seems to be working well.... Updated this afternoon, and just forced the replacement of the sonos-discovery....

Now onto the http-api.

Did a fresh git pull at the same time....

Now, when I load it... I'm getting this:

code:

binding SSDP to port 2594
scanning for players...
port in use 3500 trying new one
notification server listening on port 3501

module.js:485
throw err;
^
SyntaxError:[path]/node-sonos-http-api/presets.json: Unexpected string
at Object.parse (native)
at Object.Module._extensions..json (module.js:482:27)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at [path]/node-sonos-http-api/server.js:12:13
at Object.cb [as oncomplete] (fs.js:168:19)


I figure I'm screwing up the presets.json, but I haven't quite figured how.

I took your sample, and removed all references to your players, and replaced with mine....

code:

{
"all": {"players": [{ "roomName": "LittleRm", "volume": 23 },{ "roomName": "Living Room", "volume": 27 },{ "roomName": "Kitchen", "volume": 18 },{ "roomName": "Office", "volume": 22 },{ "roomName": "Master Bedroom", "volume": 17 },{ "roomName": "Rec Room", "volume": 0 }]},
"tv": {
"players": [{ "roomName": "Rec Room", "volume": 50 }],
"state": "stopped",
"uri": "x-rincon-stream:RINCON_0000000000001400"
},
"AcidJazz": {
"players": [{ "roomName": "Living Room", "volume": 27 },{ "roomName": "Kitchen", "volume": 18 },{ "roomName": "Office", "volume": 22 }],
"favorite": "Acid Jazz Radio"
}
"Thiev": {
"players": [{ "roomName": "Living Room", "volume": 27 },{ "roomName": "Kitchen", "volume": 18 },{ "roomName": "Office", "volume": 22 }],
"favorite": "Thievery Corporation Rdio Radio"
}
}


I'm going to go back a few pages in the thread, and try that "test your file" link you posted J, and see if there's anything it complains about....
Userlevel 4
Badge +14
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.
Userlevel 2

code:

{
"all": {"players": [{ "roomName": "LittleRm", "volume": 23 },{ "roomName": "Living Room", "volume": 27 },{ "roomName": "Kitchen", "volume": 18 },{ "roomName": "Office", "volume": 22 },{ "roomName": "Master Bedroom", "volume": 17 },{ "roomName": "Rec Room", "volume": 0 }]},
"tv": {
"players": [{ "roomName": "Rec Room", "volume": 50 }],
"state": "stopped",
"uri": "x-rincon-stream:RINCON_0000000000001400"
},
"AcidJazz": {
"players": [{ "roomName": "Living Room", "volume": 27 },{ "roomName": "Kitchen", "volume": 18 },{ "roomName": "Office", "volume": 22 }],
"favorite": "Acid Jazz Radio"
},
"Thiev": {
"players": [{ "roomName": "Living Room", "volume": 27 },{ "roomName": "Kitchen", "volume": 18 },{ "roomName": "Office", "volume": 22 }],
"favorite": "Thievery Corporation Rdio Radio"
}
}




Hi You have missed the "," after ""Acid Jazz Radio" } " I added it in the code above.
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.
Userlevel 4
Badge +14
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.
Userlevel 2
Ok been testing presets in httpsonos and I believe we have a bug if error in preset file misspellings etc not in syntax the server needs to be rebooted other wise it will fail to read the next request for preset I see no errors in the log .but will keep looking.
With a little guidance I would imagine I can get this working.
When loading http://localhost:8080/dashboard/#UUID_XXXXXXXXXXX where X is the UUID of one of my players the page loads blank.
In fact just straight http://localhost:8080/dashboard loads blank.

Really a way to specify player for the mobile version would be ideal.
Hi You have missed the "," after ""Acid Jazz Radio" } " I added it in the code above.

Thanks... I tried the "," after both new presets, didn't realize that you need to not have it after the last one.....

OK, so now the server is starting....

Connecting through a browser and using:

:5005/presets/Thiev/Play

Output on the screen:

code:

{ room: 'presets', action: 'AcidJazz', value: 'play' }
{ room: 'presets', action: 'Thiev', value: 'Play' }


But it's not doing anything to the players....

If I do the

code:

:5005/office/favorite/thievery corporation rdio radio


It was starting the stream.... with the current grouping. I was also able to stop it.

Thoughts?
I am trying to figure out of you can use this node.js to switch the sonos from the tv to pandora or from pandora back to the tv, do you know if that is possible?