Home AMX User Forum AMX General Discussion
Options

Sonos without Duet

1) Why was the thread deleted? It probably should have been split - there were like 3 different metadiscussions going on - but why deleted?

2) I'll try to get event registration stuff working this week / weekend to get unsolicited feedback (and also add now playing feedback) and upload an updated module. Then a bit of a delay before I work on grouping and browsing.

Has anyone tried the previous version? Any problems? Any successes?

Edit: Module can be found here: http://www.truecontrol.org/files/AMX_Sonos_0_0_1.zip

NOTE - the module supports auto-detection of players, basic one-way transport, volume (with fb), mute (with fb), led light (with fb), setting an input for line-in. I'll be doing more to improve it.
Full source, readme for commands and loader demo is included - you will have to send commands manually and parse feedback until I create a UI module. Please report bugs, and feel free to submit patches.

Comments

  • Options
    the8thstthe8thst Posts: 470
    I have no clue why the other thread was deleted.

    I am going to try to do some testing this week. I have 2 connects and 1 connect amp on the office network (plus a ton of other crap), so it should be a good stress test environment.
  • Options
    truetrue Posts: 307
    Alright, I have eventing mostly working, which means unsolicited feedback and no need to poll. Just need to write the parser. Far better than the get_ commands currently used. Very busy this weekend but I'll try to get something uploaded.

    EDIT: Have volume and mute feedback being updated in trunk. Feedback for vol, mute, loudness, bass, treble, output fixed is subscribed / unsolicited. Other feedback is still solicited or unavailable until I complete the rest of the subscribes.
    I hope to complete the rest of the subscribes for currently programmed stuff and also add now playing unsolicited feedback for the next version.

    Has anyone tried this yet?

    EDIT 2: The feedback parsing was really rushed just to get something out...I'm working on it now and it should be improved. EDIT 3: Have a tag name function and tag attribute function, should be way easier to read and now I can get now-playing metadata =)
  • Options
    nielsynielsy Posts: 32
    Good Job!
    Want to test it, but have no Sonos system at home (yet)... ;)

    Have a nice weekend!
  • Options
    Sonos Module

    I tried your module and I'm facing issue when I send_command to the virtual device. Your module discover well my sonos player but answer the player is not found when I sent the command to the vdv.
    Maybe I didn't format well the expression I tried 'Salon vol 60' and '"Salon" vol 60' but none worked. Any idea ?
    By the way for what I could see, you already have done an amazing job in few times, I really hope that you could finish it.
    I attached a print screen if you are interested.
    true.png 217.5K
  • Options
    truetrue Posts: 307
    Lanussinio wrote: »
    I tried your module and I'm facing issue when I send_command to the virtual device. Your module discover well my sonos player but answer the player is not found when I sent the command to the vdv.
    Maybe I didn't format well the expression I tried 'Salon vol 60' and '"Salon" vol 60' but none worked. Any idea ?
    By the way for what I could see, you already have done an amazing job in few times, I really hope that you could finish it.
    I attached a print screen if you are interested.

    You don't have "String Expressions" checked so it is sending literal single quotes. Either check "String Expressions" or remove the single quotes. You can see this as the name of the player it is seeing is literally 'Salon

    Double-quotes are only required around the name of the player if the player has spaces in the name.
  • Options
    truetrue Posts: 307
    Revision 6 in trunk/ now has eventing in place for all sorts of things, and next I can work on now-playing feedback. Use 'msg on' on the NI's telnet console to see debug output of all the crap that I am receiving but haven't parsed yet.

    readme.txt has been updated and will be kept up-to-date with currently working unsolicited feedback.
    Currently working feedback:
    
    - volume <level 0..100>
    - mute <on/off>
    - output_fixed <on/off>
    
    - loudness <level 0..1>
    - bass <level -10..10>
    - treble <level -10..10>
    
    - line_in_name <text name of analog audio line-in from device>
    - line_in_level <level 0..12>
    - line_in_present <on/off>
    

    I'll try to keep future update logs to a minimum. My next update post will likely be for the next release, which will have now-playing feedback and probably a way to get a list of the Sonos units so that they can be dynamically selected by UIs. Maybe even a simple UI functionality test (I don't have any spare panels to develop with though).
  • Options
    Sorry I was too pressed to test your module and didn't check that , it works fine now. Can't wait to test more feature. Very nice job True !
  • Options
    truetrue Posts: 307
    Version 0.0.2

    Didn't take long, did it =)

    Here's 0.0.2. Supports some basic now-playing feedback and playback status for the Radio and Pandora components. Also, all feedback supported is now unsolicited and will update no matter what device actually operates the Sonos.

    As usual, see readme.txt for usage and the feedback / command reference.
  • Options
    the8thstthe8thst Posts: 470
    I finally had a few minutes to test this out, and so far so good.

    I am testing on a busy office network with 2 Connects and 1 Connect Amp. The module grabbed the 3 Sonos devices right away, and the communication (volume, now playing, etc) seems to be really fast. Awesome work.

    I think, as I have time, I am going to work on browsing favorites and selecting a favorite to start playing as my first priority. Second will probably be looking at getting the now playing for more services working.

    Let me know if you are working on the same things so we don't double up efforts on the same functions. Send me a message on skype (petew__) if you want to work on this in a more realtime avenue.

    Thanks for the hard work.
  • Options
    nielsynielsy Posts: 32
    I've also had the time to test it... Nice work!
    Radio feedback is working good and fast and also the volume fb/control

    Not yet feedback from the music of the NAS, hopefully soon ;)

    Great work! wondering where an update comes down...

    Regards,
    Niels
  • Options
    the8thstthe8thst Posts: 470
    I've been too busy to find the time to do any more work on this, but you are more than welcome to develop it further.

    I have seen a couple posts on another forum about a new iPad app to control Sonos that may work as a stop gap.
    https://itunes.apple.com/us/app/id579984303?mt=8
    http://sonopad.com/

    It has full control over a Sonos system and adds a few features for integrators using the URI structure. You can specify a zone, add a return to TPC button, select a music service, etc all from AMX or TPC. It basically has the integration features of KScape's iPad app.
  • Options
    mpullinmpullin Posts: 949
    the8thst wrote: »
    I've been too busy to find the time to do any more work on this, but you are more than welcome to develop it further.
    Unrelated: is your username supposed to be pronounced "the atheist" or "the eighth-ist"?
  • Options
    the8thstthe8thst Posts: 470
    mpullin wrote: »
    Unrelated: is your username supposed to be pronounced "the atheist" or "the eighth-ist"?

    It's actually the street from the house I grew up in: The 8th Street. There isn't a profound meaning behind it, and I've had the handle far too many years to make it worth changing.
  • Options
    truetrue Posts: 307
    Been busy...

    I have been doing more standalone Sonos systems and not much AMX (lots of cheaper RTI and really low end URC lately) and also developing my own integration hardware products so I haven't had much time to work on this either. Doesn't help that I am rushed on every job where I do write code. :(

    I'd really like to find time...I will try :)

    Re: Sonopad, maybe that will work for some customers, thanks for bringing that up.
  • Options
    a_riot42a_riot42 Posts: 1,624
    true wrote: »
    I have been doing more standalone Sonos systems and not much AMX (lots of cheaper RTI and really low end URC lately) and also developing my own integration hardware products so I haven't had much time to work on this either. Doesn't help that I am rushed on every job where I do write code. :(

    I'd really like to find time...I will try :)

    Re: Sonopad, maybe that will work for some customers, thanks for bringing that up.

    I thought this was a couple weeks work for you and it'd be done. Remember how trivial you insisted it would be? I was looking forward to implementing your module with 32 players, 21 touch panels and all features implemented :(
    Paul
  • Options
    truetrue Posts: 307
    Really?
    a_riot42 wrote: »
    I thought this was a couple weeks work for you and it'd be done. Remember how trivial you insisted it would be? I was looking forward to implementing your module with 32 players, 21 touch panels and all features implemented :(
    Paul

    Yes, I spent a day and a half on it. As I said in the other thread already, I was quite busy but had some time. I no longer have that time.

    At this point it pretty much is trivial - look at and parse feedback for the different source types. Adding browsing will take a little more work, but should be handled by a UI module so each panel can do its own thing. The fun part is done, it's mostly just the tedium that needs done now.

    This will already pretty much do the first two (try it), just not the last one.
  • Options
    a_riot42a_riot42 Posts: 1,624
    true wrote: »
    At this point it pretty much is trivial - look at and parse feedback for the different source types.

    I guess you didn't get too far into it. Parsing XML packets of over 1MB in Netlinx isn't really trivial with a running system if you don't want to hog the processor. It gets tricky considering an array can't be any larger than 16k. That was the most interesting part for me. I found the basic comm stuff the trivial part, and parsing huge XML/SOAP packets, implementing cover art despite a Netlinx send_command 200 character limitation, and replicating the Sonos controller UI the fun part.
    Paul
  • Options
    AMX Sonos Integration

    We have released an AMX module for our Sire for Sonos unit. This is a hardware based solution with an AMX module enabling you to perform full control and feedback for up to 32 Sonos zones.

    See http://www.sirecontrol.com for more information.
  • Options
    Hi True,

    Thanks for the great module. You documentation needs updating. For all the send_commands you have stated

    send_command vdev, '"Living Room" mute on'

    instead it should be
    send_command sonos_vdev, '"Living Room" mute on'

    P.S: Much better then the RTI Sonos module
  • Options
    One other question. I am new to Netlinx programming. I have mapped all the buttons and created SEND_COMMANDS and got that all working. I was wondering how do i parse feedback for nowplaying, etc.
  • Options
    truetrue Posts: 307
    Re: "vdev" it's just referring to use the virtual device rather than any IP device. You can call it whatever you want. If it helps readability I can change this.

    I've worked on the module a bit, to improve reliability with a large number of Sonos (Sonoses?), with the instability mostly caused by unnecessary feedback polling. AMX seems to keep up with normal activity with 20 sonos but doesn't like a ton of connections; IP on Netlinx is expensive and some polling assumptions are incorrect. I've been extraordinarily busy with all extra time going to other hardware and firmware projects, but I'll commit an updated version eventually...

    Before spending a lot of effort working on this (grouping/ungrouping, services, etc), I am considering making some interface software on a platform that can easily deal with many IP connections, such as just a simple PC or Raspberry Pi application. In practice with some tests it looks like a native AMX solution would still work acceptably but writing an AMX module doesn't help for other platforms and the overall experience may be better handling this outside of AMX.

    Re: processing feedback, I will have a UI module at some point that can be used directly or as a reference. For now, for basic feedback, you can manually parse or use something like explode_quoted from string.axi (included with the module) to parse. Something like this:
    #include 'string.axi'
    
    define_variable
    constant char sonos_rooms[2][20] = {
      'Living Room',
      'Master Bed'
    }
    volatile integer sonos_mute[2]
    
    define_event
    data_event[sonos_vdev] {
      string: {
        local_var fb[4][64]
    
        explode_quoted(' ', data.text, fb, 4, '"')
        switch (fb[2]) {
          case 'mute': {
            if (fb[3] == 'on') {
              // do what you need to
            } else {
              // tip: compare fb[1] with sonos_rooms[n]
            }
          }
        }
      }
    }
    

    I think 0.0.2 wasn't sending a whole lot for now playing feedback, can't remember...

    Re: RTI, I would have started work on one, but their terms for the SDK are ridiculous and the platform is very limiting. The most important idea I had for a driver since I first did an iPad on RTI (a local flag type thing) was done by someone and it works well, so I am less interested in writing for their platform now. Still, it would be nice having some basic control (source select, transports, volume) that didn't cost anything extra or require registration like the current modules do.
  • Options
    Will this work with the NX controllers? My goal is to recall a favorite that is saved on Sonos. Is it possible?
    -Emmett
Sign In or Register to comment.