Go Back   Sonos Forums > The Unsupported Area

Reply
 
Thread Tools Display Modes
  #11  
Old Mar 28th, 2013, 06:39 AM
jishi jishi is offline
Member
 
Join Date: Nov 2010
Location: Stockholm, Sweden
Posts: 1,126
Default

Finally pushed the web controller to a public repository:

https://github.com/jishi/node-sonos-web-controller

Nothing is actually working (except for zone discovery), but if you want to try it out to get a feeling on how it will behave in the browser, please feel free to do so. You will also be able to follow my commit logs

If you want to help out, give me a shout. The main reason for me doing this, is because I want to expose a working controller for all my co-workers. Being behind firewalls and on different nets, it would simplify it a lot if I could just expose a web-based controller for everyone to use. It could also be useful for controlling a system remotely.
Reply With Quote
  #12  
Old Apr 3rd, 2013, 04:21 AM
robertboca robertboca is offline
Member
 
Join Date: Apr 2010
Posts: 51
Default

Looking really good.....will try it out thnak you for sharing..

Regards

Robert
Reply With Quote
  #13  
Old Apr 4th, 2013, 04:15 AM
jishi jishi is offline
Member
 
Join Date: Nov 2010
Location: Stockholm, Sweden
Posts: 1,126
Default

I managed to map one of my airmouse volume buttons to control a specific player with my raspberry pi without any problems.

It read out the events on /dev/input/event0 (the keyboard) and maps the appropriate keycode to invoke the setVolume() method, this was with approx 20 lines of js.

It works if run as a daemon as well, I started node.js from a ssh session and controlled it with a USB attached keyboard. Main problem is that the Airmouse operates in the 2.4 GHz span so it seems to drop about 5% of the keystrokes... it's a crappy china-keyboard as well, so that might explain it.
Reply With Quote
  #14  
Old May 2nd, 2013, 01:32 PM
dipole dipole is offline
Member
 
Join Date: Apr 2013
Posts: 3
Default

Thanks and keep up the good work. I would love to see a quick how to of how to get this working with a RasPI.
Reply With Quote
  #15  
Old May 7th, 2013, 02:43 AM
jishi jishi is offline
Member
 
Join Date: Nov 2010
Location: Stockholm, Sweden
Posts: 1,126
Default

Quote:
Originally Posted by dipole View Post
Thanks and keep up the good work. I would love to see a quick how to of how to get this working with a RasPI.
I'll try and write something up. Is it node.js installation and how to start a node app that you are interested in?
Reply With Quote
  #16  
Old Jul 1st, 2013, 11:46 AM
steelrat steelrat is offline
Member
 
Join Date: Mar 2012
Location: Toronto, Ontario
Posts: 413
Default

Hey J.... just to let you know... with a little work and a little frustration on my part, I got both the http-api, and the latest build of the web controller working on a ubuntu 12.10, vm.

For everybody else.... after installing node on the ubuntu (there were a few guides out there).... I had to npm install: the node-static, and the socket.io.... manually. Oh and copy over the working copy of the sonos-discovery folder from the http-api directory I made. In the http-api, I had to do an npm install as well to get the dependencies. Maybe it was how I downloaded out of git.... but they were both basically crashing or not fully working without all the dependencies. The errors on screen were descriptive enough to know it was missing something. It took me a while to figure out "how" to get them though. <G>

Either way, it's working... even as a published web site through ISA Server.

One question though... is it possible to start as a service, vs hogging a terminal session? Need to figure that one out for the older perl site too....

Can't wait for the finished product.... Well done....
Reply With Quote
  #17  
Old Jul 2nd, 2013, 05:00 AM
jishi jishi is offline
Member
 
Join Date: Nov 2010
Location: Stockholm, Sweden
Posts: 1,126
Default

Glad it worked out for you. It's strange that you would need to npm install all libs separately. The package.json file is supposed to keep track of the dependencies for you, making a "npm install" invoke from the same folder to trigger a dependency-check and download stuff that is missing globally. That was my experience when I tested it out, will have to check it out again.

Haven't had much time to work on it, but another guy has forked the project and is pushing minor improvements to it.

Regarding running it as a service, it is doable but requires some manual setup. It's easier on linux afaik, but it's possible on Windows as well.
Reply With Quote
  #18  
Old Jul 2nd, 2013, 07:46 AM
steelrat steelrat is offline
Member
 
Join Date: Mar 2012
Location: Toronto, Ontario
Posts: 413
Default

Yeah, I noticed some of the directories I downloaded had the package.json, but some didn't. As I say, maybe it was how I was getting the files out of git. Maybe it missed something.

If you have the time to send across some suggestions for ubuntu service that would be great. If not.... I'll just have to spend a little more time google'in'. <G>

I noticed the fork, and got that one too... so I was trying both. I'll have to monitor and see what gets uploaded eventually. <G>
Reply With Quote
  #19  
Old Jul 2nd, 2013, 08:58 AM
jishi jishi is offline
Member
 
Join Date: Nov 2010
Location: Stockholm, Sweden
Posts: 1,126
Default

Quote:
Originally Posted by steelrat View Post
Yeah, I noticed some of the directories I downloaded had the package.json, but some didn't. As I say, maybe it was how I was getting the files out of git. Maybe it missed something.

If you have the time to send across some suggestions for ubuntu service that would be great. If not.... I'll just have to spend a little more time google'in'. <G>

I noticed the fork, and got that one too... so I was trying both. I'll have to monitor and see what gets uploaded eventually. <G>
I haven't set it up myself, but the approaches that I like the most is either:

https://github.com/indexzero/daemon.node
or https://github.com/nodejitsu/forever

Forever might be simple enough to combine with an init.d script which would give you the same approach to start/stop the node app as regular services. Here is an article about that: http://ejeklint.se/node-js-and-forever-and-init-d/
Reply With Quote
  #20  
Old Sep 13th, 2013, 01:54 PM
jishi jishi is offline
Member
 
Join Date: Nov 2010
Location: Stockholm, Sweden
Posts: 1,126
Default

Okay, finally got some time to work in this and I got around to implement support for presets.

A preset in this sense is a group of players with a predefined volume. This means that you can, by supplying a valid js object, send a signal to the players to group themselves, set the preferred volume and start playing whats in the queue.

A preset looks like this:

Code:
{ 
  "players": [
    { "roomName": "room1", "volume": 15}, 
    {"roomName": "room2", "volume": 25}
  ]
}
The first player in the group will be assigned to coordinator role.

Next step will be to implement some playback options, like random, gapless, a favorite queue etc. It would also be of interest to keep track of which track it was actually playing last time, in order to resume where it left of.

Check it out here: https://github.com/jishi/node-sonos-http-api
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 06:11 PM.