below is the latest SONOS plugin. I decided to create a new topic so i can keep the latest version at the top and hopefully make it easier to find and download.
Update: 5/6/2016 - Fixed Play Favorite Playlist action, added events for Album, title, Sourece, and Cover Art URL.
You can also un-comment lines 763 and 764 and it'll download the cover are jpg and store it at the location specified:
Code: Select all
albumartloc = "C:\\SONOS_Covers\\" #make sure to include dual \\ and include it at the end.
Code: Select all
#picfileloc = albumartloc + uuid + ".jpg" #2/3/2016 uncomment to save cover art to the albumartloc #urllib.urlretrieve(albumarturl, picfileloc) #2/3/2016 uncomment to save cover art to the albumartloc
Update: 5/4/2014 - I've been working on a handful of bugs and adding a few commands. Big changes is that the search at the beginning should be more robust and be better at finding SONOS ZPs no matter the network. See below for more details. Also, if you have multiple active network cards, you can now open the _init_.py file and enter the IP address of the interface that you want the plugin to use. If you have only one active interface, the plugin will use it.
Update: 4/11/2014 - I've been testing the plugin against the latest SONOS beta app and the addition of the Google Play Music addition. When you Cast music from the Google Play Music app to SONOS, the notification actions can't restart the music as it does with all other music sources. More testing will be done to see if there is a way to fix this.
Complete control of SONOS system
Accurately controls Zone Players even when grouped
gets instant events from SONOS (no polling)
automatically finds your SONOS system (better as of 0.9)
Commands are stored and sent based on the MAC not IP (IP of ZP can change and command will still work)
Supports all Zone Players including the Playbar.
accurately knows when a zone player is playing or not even when grouped (great for automatically turn on and off a receiver connected to a Connect)
as of version 0.8:
Play, Pause, Stop, Next, Previous, Relative Volume, Set Volume, Mute On, Mute Off, Play Mode, Start Favorite Playlist/Station
MuteAllOn, MuteAllOff, SetCrossfade, SetSleepTimer, PlayTrackURI, PlayLineIn, UnGroup
NotificationTrackURI (local track or located on the web)
NotificationGoogleTTS (note: google restricts this to a max of 100 characters)
NotificationWeather (BETA at the moment, uses googleTTS)
as of version 0.9:
Change ZP Name (great when sharing one Connect between two rooms and having EG route the audio to the specific room)
Group Relative Volume, Group Set Volume, Group Mute Off, Group Mute On
Select TV source on Playbars
New Zone Player added to network:
Generic Add: SONOS.ZonePlayerAdded u"<ip>-<uuid>"
Unique Add based on UUID of ZP: SONOS.ADDED.<uuid> u"<ip>"
Zone Player removed from network. (note this can take up to 30 minutes for the plugin to realize the ZP has been removed)
Generic Delete: SONOS.ZonePlayerDeleted u"<ip>-<uuid>"
Unique Delete based on UUID of ZP: SONOS.DELETED.<uuid> u"<ip>"
Zone Player Playing
Zone Player Stopped/Paused
event for volume adjustments (could be used to control max volume of a zone)
Weather information when running the NotificationWeather action
(new) event when errors occur (can be used to trigger a notification of some kind, in my case I have it email me)
Note: i'm currently receiving MetaData information for all currently playing music but I am not doing anything with it other than storing it in the plugin.
as of version 0.9.5:
events for Title, Artist, Source, and Cover URL changes.
1) If you only have 1 zone player, the plugin might not automatically update the IP address if it changes or if you add another zone
3) the weather notification is beta and still under development. This action will be updated.
5) If a notification is triggered before a previous notification has completed, the new notification will over write the previous notification and not allow the music to be restored putting SONOS into an unknown state.
6) If the plugin is restarted while still running (like when opening the configuration window and changing the debug value, then pressing ok) this will cause it to crash (work around is to stop the plugin first, then make changes, then restart
9) When you Cast music from the Google Play Music app to SONOS, the notification actions can't restart the music as it does with all other music sources. More testing will be done to see if there is a way to fix this. (there is no problem when streaming google play music from within the SONOS app.
10) occasionally you might receive an error from the asyncore.py file, this will cause all other plugins that use this modules to also stop working. EG has to be restarted. Cause is still unknown.
2) occasionally you might receive an error from the asyncore.py file. Currently the reason for this is unknown. If this happens, EG needs to be restarted. Currently this has not happened on my own PC in the latest revision but I have also not done anything to fix this specific problem, so if anyone sees this let me know. (update 3/17/2014) this has been fixed and the next release will have the solution. (update 5/4/2014) this still occurs occasionally, added issue number 10.
4) If you have a playbar and have any other ZP grouped as a surround speaker or subwoofer, the grouptopology is handled incorrectly which causes errors with other actions like startplaylist.This will be fixed in the next release.
7) searching for sonos can use the wrong network interface if there are multiple active interfaces. problem will be fixed in next release. (addressed in version 0.9, can manually enter ip address by editing _init_.py file for the plugin)
Line In currently doesn't seem to work when selecting the PlayBar input (looking into issue with the help of others) version 0.9 fixes this with a new action specific for TV input on playbars.
11) MSEARCH that is the UPNP network search only searched on the standard broadcast address but not 255.255.255.255, version 0.9 addresses this and now should be fixed.
12) Events for ZPs being removed or added were not working as expected (in some cases not triggering at all). This was fixed in version 0.9 see details above
How to use notifications:
Refer to image below to see how notification actions need to be configured. 1) All notifications should start with NotificationStart
this notification allows you to select which ZPs the notification goes to, set the volume, and decide if you want to over ride the current mute state of the ZP. This action also stores the current ZP music state.
2) Send the actual notification using one of the notification actions (GoogleTTS, LineIn, TrackURI, or Weather)
if using LineIn, then you'll need another action after this one to play the notification through the selected ZP's Line In (in most cases this could be your PC connected to Line-In and you use the Speech plugin to have the PC handle TTS)
3) All notification should end with NotificationRestore
here music is restored to the state before the notifications were started. This is also where you place the delay in which the plugin will wait to restore the music. The delay is based on the time it takes to play your notification.
General Overview on how the notifications work:
Notification will be sent only to the ZPs that are selected unless a selected ZP is part of a group, then the whole group will receive the notification regardless if the other ZPs in the group are selected or not.
Also, the current group topology will not be affected. This also means that if multiple Zps are playing the notification and the ZPs are not grouped, they will not be synced, but in testing this doesn't seem to be a problem.
The restore action has a time you enter to delay the ZPs to restore to the previous state. To get this time you'll have to play your notification and see how long it takes and then set the restore time. Note that Google TTS can take time to buffer in the SONOS players at times so the length of time needed might not be consistent. As of right now there is no way to know when the TTS stream is finished playing.
NOTE: The NotificationWeather Action is still under development to make it easier and fully adjustable to use. Currently it will allow you to set your location, grab the current weather and uses GoogleTTS to announce the current weather conditions over SONOS (currently only English is supported). The plan is to allow you to decide what you want said like the forecast or current conditions. Also, you'll be able to decide if you want to use GoogleTTS or the Speech Plugin to announce the weather.
NOTE: that I have tested all notifications but have not extensively tested them in all scenarios so please be aware that there could be issues.
Instructions on using plugin:
NOTE: if you have multiple active network cards, please manually add your IP address of the adapter you want to use to the _init_.py file around line 52:
Code: Select all
localip = ""
2) Create a folder in C:\Program Files (x86)\EventGhost\plugins called 'Sonos'.
3) place the __init__.py file into the SONOS folder
4) On the EG menu bar, click add plugin, from the list select SONOS.
5) Set the debug level in the configuration window (normal is 0).
6) select a SONOS action that was automatically added to your tree and open the config. window to select the ZP and the options for the action.
Please let me know what you guys think and of course let me know if you find any issues.
Feel free to send me request for added features or commands as well.
The latest version can be found here:
https://github.com/techoguy/Full-SONOS- ... EventGhost
=== Older Versions not in GitHub =====================================================
there as an error in version 0.9 so it has been replaced with 0.9.1.
Latest Version 0.9.1: version 0.8: