Sonos - The Beginning

Posted on
Sat Feb 18, 2012 5:59 pm
nlagaros offline
Posts: 1646
Joined: Dec 20, 2010

Sonos - The Beginning

Don't get too excited - I don't code well and just started messing around with this.

So as to not start from scratch, I utilize the excellent SonosPy extensions developed by Mark Henkelis. You can find the open source here on github: https://github.com/henkelis/sonospy/wiki/Welcome-to-Sonospy.

Configuration for the plugin is simple - simply enter the ip address or dns resolvable hostname of the server running the SonosPy extension as well as the tcp socket accepting connections. The default in the package is 50101. When creating the device, the only configurable item is the name of the ZonePlayer.

I'll keep the plugin download page as current as possible with a package as I continue to build it out. The initial goal is to simply read current status of the controller. The Indigo plugin will poll the SonosPy server every second for an update of all ZonePlayers that are configured as devices.

Please post any issues or comments on the Indigo message boards and I will attend to them as quickly as possible. I've only put a couple of hours in to this, so it is very rough as indicated by the initial release version (0.1.0).

Link to download: https://vulture.lagaros.com/wiki/pages/a24599q3r/Sonos_ZonePlayer_Plugin.html

Posted on
Sat Feb 18, 2012 6:14 pm
HomeAutomationPlugins.com offline
Posts: 41
Joined: Feb 18, 2012

Re: Sonos - The Beginning

Superb! I'll test this and let you know any feedback!

If we can get Sonos working that'll be amazing!

Posted on
Sat Feb 18, 2012 6:26 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Sonos - The Beginning

Nice - wish I had a sonos to test with!

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Feb 18, 2012 7:02 pm
mat offline
Posts: 769
Joined: Nov 25, 2010
Location: Cambridgeshire - UK

Re: Sonos - The Beginning

Happy to test too, as I've been using Marks code for a year or so.

I have curl control of volume, play/pause and mute , but would be great to have full integration.

I'm really missing not being able to switch sources since the last but one sonos update though.

Mat

Late 2018 mini 10.14

Posted on
Sun Feb 19, 2012 6:27 am
nlagaros offline
Posts: 1646
Joined: Dec 20, 2010

Re: Sonos - The Beginning

Thanks mat and reading123 for helping to test this. If I wasn't clear in the terse description, you have to install the SonosPy extensions and start the sonospy_web daemon before this plugin will work. Mat - I think you already have this based on your past work.

I updated the plugin to include the following actions: PLAY/PAUSE, STOP, PREVIOUS, NEXT, MUTE/UNMUTE, and VOLUME.

I think the hard work begins now deciphering playlists, queues, and various sources (radio, music server).

Posted on
Sun Feb 19, 2012 7:31 am
mat offline
Posts: 769
Joined: Nov 25, 2010
Location: Cambridgeshire - UK

Re: Sonos - The Beginning

I use line-in allot. I think one problem that the latest Sonos software update created is that line in is no longer selectable from the sources menu. They have moved it to a higher level menu than marks software will traverse.

Plus the fact that I can only get version 3 Of sonospy to work on my mac. Has mark updated the latest version to be unix compatable again. Version 4 contained some code that wouldn't run?

Will try the plugin in an hour or so and report back.

Mat

Late 2018 mini 10.14

Posted on
Sun Feb 19, 2012 7:46 am
nlagaros offline
Posts: 1646
Joined: Dec 20, 2010

Re: Sonos - The Beginning

I'm running the very latest version of SonosPy - the unstable branch, last updated a couple of weeks ago. I'm not sure how to pull the version number.

I see your point with Line-In. I just did a query at root level and do not see Line-In as an available input. Will keep digging around. I didn't want to do direct SOAP calls, but will spend some time understanding how that could help (or not).

Posted on
Sun Feb 19, 2012 8:26 am
mat offline
Posts: 769
Joined: Nov 25, 2010
Location: Cambridgeshire - UK

Re: Sonos - The Beginning

I think I made the version numbers up thinking about it. Mark used to email out update before he put it on GitHub, and I just numbered them myself.

Ok. Plugin installed.

Initial runs produced an error.

My tested zone name has a space in it "TV Room", which was causing errors in retrieving the data. When I renamed the zone name in edit device settings, to "TV%20Room" it worked a dream. All data returned from zone.

Three zones configured and working.

With three zones added, data disappears from the "states:" when the plugin starts to rescans the zones. With three zones, this means the dataset is empty for almost the same time as it is populated.

It looks like the states only need updating when they change?!?

How are you instigating play/pause etc. I've not opened up the py yet too look?

Great work. I'm looking forward to testing as much as you like.

Ps - just had a crash. Not sure if it's sonospy or the plugin. I'm still getting zp percent and zp position, but all other data is missing.....I'll investigate

Mat

Thanks for sharing!

Late 2018 mini 10.14

Posted on
Sun Feb 19, 2012 8:34 am
mat offline
Posts: 769
Joined: Nov 25, 2010
Location: Cambridgeshire - UK

Re: Sonos - The Beginning

A restart of sonospy resolved only seeing time and % above.

Looks like its the web server not responding. Im presuming thats where your getting the data from?

It just happened again. You might want to try slowing the polling down for testing? Could it be the speed it's trying to check the list of zone, rather than the 1 second pause before rescanning?


Refreshing of data remains as above.

You have put a big grin on my face :D

UPDATE

ok, it's not crashing - it's when the web server responds with a "NOCHANGE" message. This stops the rescanning.

Late 2018 mini 10.14

Posted on
Sun Feb 19, 2012 9:04 am
terrydew offline
Posts: 258
Joined: Jun 10, 2011

Re: Sonos - The Beginning

This is great. :D Sonos is the plugin I need to make announcements. I would like to connect the indigo server audio to the line in on a zone player (dedicated if need be). It would require the temporary reconfiguration of the zones to ALL, play the announcement then return to the earlier zone config and resume playing. Will this be possible with the plugin?

Thank you for the effort. I wish I could code to help but I will test a lot.

Posted on
Sun Feb 19, 2012 9:27 am
mat offline
Posts: 769
Joined: Nov 25, 2010
Location: Cambridgeshire - UK

Re: Sonos - The Beginning

Terrydew

That's what I was doing pre-plugins with sonospy and curl calls, but sonos have moved the line-in selection from the menu list in the latest version of the sonos software.

Hopefully it can be found, so the answer at some point will I hope be yes.

Mat

Late 2018 mini 10.14

Posted on
Sun Feb 19, 2012 10:04 am
HomeAutomationPlugins.com offline
Posts: 41
Joined: Feb 18, 2012

Re: Sonos - The Beginning

Likewise - announcements as described above is exactly what I would love to achieve!

Posted on
Sun Feb 19, 2012 10:33 am
nlagaros offline
Posts: 1646
Joined: Dec 20, 2010

Re: Sonos - The Beginning

mat -

I clear all states for the device if the ZP_CLASS changes. For example, if I switch from a music server source to a radio source, many of the fields become irrelevant so to keep things consistent, I clear out the old. What types of sources do you have and how is the ZP_CLASS state changing as you operate your equipment. That will help me figure out what is off. I think the CLASS state may be too granular and I should look at the TYPE state.

Posted on
Sun Feb 19, 2012 10:42 am
nlagaros offline
Posts: 1646
Joined: Dec 20, 2010

Re: Sonos - The Beginning

I think I found the flaw that is causing the frequent clearing. Some updates come with no change and I am looking to compare ZP_CLASS on each message. Will post an update in a bit.

Posted on
Sun Feb 19, 2012 10:49 am
nlagaros offline
Posts: 1646
Joined: Dec 20, 2010

Re: Sonos - The Beginning

Version 0.2.1 has been posted. Two quick fixes:

  • Handles Zone Player name with spaces
  • Corrected logic that clears states on source class change

Who is online

Users browsing this forum: No registered users and 4 guests

cron