Page 2 of 4

Re: Python plugin: Sonos [new version]

Posted: Sunday 17 September 2017 12:32
by mvzut
Hi G3erard,

Thanks for all your effort, this new implementation works great for me!
One thing annoyed me though:
If you stop playback, either via the plugin or via another controller, it actually pauses. There's nothing you can do about that, that is just how Sonos is designed. However, in the paused state, the plugin keeps flooding the log with "Paused" messages, every update interval (which is 5 seconds in my case). The log page of the Sonos state device is also many pages long, almost completely filled with "Paused" states. This makes the Domoticz database unnecessarily large.
I also start a timer after I stop (pause) my Sonos Connect, which switches off the amplifier after a few minutes. But this timer was restarted every 5 seconds, because the paused state was constantly updated.

I now created a workaround, by changing a few lines in your Python code starting from line 392:

Code: Select all

#                if CurrentTransportState  == 'PAUSED_PLAYBACK':
#                    self.playerState = 2
#                    self.mediaDescription = 'Paused'
#                    UpdateDevice(1, 1, self.mediaDescription)
                if CurrentTransportState  == 'STOPPED' or CurrentTransportState  == 'PAUSED_PLAYBACK':
In this way I make the plugin treats the PAUSED state as if it was the STOPPED state (I think...). Maybe it's not a very elegant solution, but it works for me. It would obviously be nicer if the paused state is only updated once. I'll see if I can figure out how to achieve this, but if you have a good idea for this please feel free to help me (us) out!

Re: Python plugin: Sonos [new version]

Posted: Monday 18 September 2017 22:45
by G3rard
Hi @mvzut,
Thanks for your post! I have fixed the Paused issue in the new v0.91 release which is on Github.
https://github.com/gerard33/sonos
Just tested it and it now works as it should :)

Re: Python plugin: Sonos [new version]

Posted: Friday 22 September 2017 22:18
by josimd
installed the python plugin on my Synology NAS, but received error after starting the script....anyone? Thanks!!

admin@iXXXX_NAS:/volume1/appstore/domoticz/plugins/sonos$ python plugin.py
Traceback (most recent call last):
File "plugin.py", line 41, in <module>
import Domoticz
ImportError: No module named Domoticz

Re: Python plugin: Sonos [new version]

Posted: Saturday 23 September 2017 0:33
by G3rard
josimd wrote: Friday 22 September 2017 22:18 installed the python plugin on my Synology NAS, but received error after starting the script....anyone? Thanks!!

admin@iXXXX_NAS:/volume1/appstore/domoticz/plugins/sonos$ python plugin.py
Traceback (most recent call last):
File "plugin.py", line 41, in <module>
import Domoticz
ImportError: No module named Domoticz
Are you starting the script from the command line? That won't work, it needs to be enabled in Domoticz.
Check the Github page for the instructions.

Re: Python plugin: Sonos [new version]

Posted: Saturday 23 September 2017 20:06
by josimd
G3rard wrote: Saturday 23 September 2017 0:33
josimd wrote: Friday 22 September 2017 22:18 installed the python plugin on my Synology NAS, but received error after starting the script....anyone? Thanks!!

admin@iXXXX_NAS:/volume1/appstore/domoticz/plugins/sonos$ python plugin.py
Traceback (most recent call last):
File "plugin.py", line 41, in <module>
import Domoticz
ImportError: No module named Domoticz
Are you starting the script from the command line? That won't work, it needs to be enabled in Domoticz.
Check the Github page for the instructions.
Hi Gerard, just checked it, I have domoticz running on a Synology NAS, Python 3 package is installed, also the domoticz version has the Python plugin included... but still no Sonos in the hardware tab... hope you can direct me in the right way ;-)

Re: Python plugin: Sonos [new version]

Posted: Saturday 23 September 2017 20:37
by florisi
I have the same issue.
Installed on a Synology.
No errors, and in the plugin directory there was created a Sonos-dir with plugin.py and a couple of zip-files.
Rebooted the Synology bu still no Sonos hardware.

Re: Python plugin: Sonos [new version]

Posted: Sunday 24 September 2017 10:50
by niclasc
Cant find Sonos Players under hardware. I have python3 and python3-dev installed and have restarted Domoticz

Re: Python plugin: Sonos [new version]

Posted: Thursday 28 September 2017 19:04
by rathmannm
Hi,

it's great to see the plugin continues to be developed. I have an issue however - if I stream from Spotify directly to Sonos it shows up as "Grouped" even though it is technically not. This means none of the controls work. I understand grouping control as such is not supported but any chance to address this bug?

Thanks,
Manuel

Re: Python plugin: Sonos [new version]

Posted: Saturday 30 September 2017 21:43
by josimd
josimd wrote: Saturday 23 September 2017 20:06
G3rard wrote: Saturday 23 September 2017 0:33
josimd wrote: Friday 22 September 2017 22:18 installed the python plugin on my Synology NAS, but received error after starting the script....anyone? Thanks!!

admin@iXXXX_NAS:/volume1/appstore/domoticz/plugins/sonos$ python plugin.py
Traceback (most recent call last):
File "plugin.py", line 41, in <module>
import Domoticz
ImportError: No module named Domoticz
Are you starting the script from the command line? That won't work, it needs to be enabled in Domoticz.
Check the Github page for the instructions.
Hi Gerard, just checked it, I have domoticz running on a Synology NAS, Python 3 package is installed, also the domoticz version has the Python plugin included... but still no Sonos in the hardware tab... hope you can direct me in the right way ;-)
Anyone solved this issue?

Re: Python plugin: Sonos [new version]

Posted: Sunday 08 October 2017 18:05
by josimd
josimd wrote: Saturday 30 September 2017 21:43
josimd wrote: Saturday 23 September 2017 20:06
G3rard wrote: Saturday 23 September 2017 0:33
Are you starting the script from the command line? That won't work, it needs to be enabled in Domoticz.
Check the Github page for the instructions.
Hi Gerard, just checked it, I have domoticz running on a Synology NAS, Python 3 package is installed, also the domoticz version has the Python plugin included... but still no Sonos in the hardware tab... hope you can direct me in the right way ;-)
Anyone solved this issue?
Issue resolved, installed the wrong domoticz version, updated with the python plugin... works like a charm... :D

Re: Python plugin: Sonos [new version]

Posted: Friday 27 October 2017 17:13
by vgr2
Hi, plugin is working with my new Sonos one, but how can I get my Radio favorites from Sonos?

Re: Python plugin: Sonos [new version]

Posted: Sunday 19 November 2017 9:26
by Mdieli
For some reason, I can't get the plugin visable from the drop-down in the Hardware menu.

System: RPi 3
Domoticz: V3.8742
Python3: 3.5.3
Installed in the "~/domoticz/plugins/sonos" folder.
Restarted Domoticz from the commandline but the plugin is nowhere to be found.
Also, no errors are shown in the Domoticz log.

The funny thing is, I reinstalled the Pi a week or 2 ago, and on the previous installation, it worked like a charm.

EDIT: /Facepalm.... I forget to install python3-dev...
For future persons with similar issues: "sudo apt-get install python3-dev" and afterwards restart Domoticz.

Python plugin: Sonos [new version]

Posted: Tuesday 21 November 2017 8:02
by mvzut
Plugin works great, using it for a few months now. I just started to use the notification system as well, this is working perfectly too.

I had one problem with notifications though: I have programmed a lot of generic notifications in LUA scripts (using the commandArray['SendNotification'] command). This gave errors, since these notifications are normally sent to all notification systems, and the Sonos notification system doesn't know what to do with a simple text notification.

The answer turned out to be pretty simple, see viewtopic.php?p=116009#p116009
Since one of the recent beta versions, it is possible to indicate which notification systems to use in LUA. This solved it for me. Maybe others with similar problems can be helped with this information too.

Re: Python plugin: Sonos [new version]

Posted: Wednesday 06 December 2017 19:26
by BakSeeDaa
Hi all!

Since I bought a couple of Sonos One I've been experimenting with a Node-js project based on the great Node.js work node-sonos-http-api. I get all player state changes and tracks information pushed into Domoticz and it's updating lighting fast.There is no need for making Domoticz constantly pulling for any data changes. I also use it also for speaking TTS messages in different languages.

Initially I experienced some problems with that Domoticz sent multiple TTS messages and state request changes in a very short time and some of them were never carried out resulting in unpredictable results. I solved that with a task spooler so that every command is executed one by one. I don't know how this plugin has addressed such a scenario.

I sent a pm to @G3rard about if using based on the great Node.js work node-sonos-http-api would be an interesting approach for this Sonos Python Plugin but I haven't had any reply until now.

So to summarize, I've created yet another Sonos Integration project for Domoticz and maybe it doesn't introduce anything new that isn't already available. In such a case there would be no idea for me to share the work. :D

Cheers

Re: Python plugin: Sonos [new version]

Posted: Friday 15 December 2017 20:20
by Kurtsejr
It does not work for me, sorry - cant fint Sonos in the drop-down menu

System: RPi 3
Domoticz: V3.8789
Installed in the "~/domoticz/plugins/sonos" folder.
Restarted Domoticz from the commandline
no errors in the Domoticz log.
And I do have the python3-dev installed too
the plugin.py are owned by user pi, but has "755" rights

Any idear?

br Kurt

Re: Python plugin: Sonos [new version]

Posted: Saturday 16 December 2017 15:09
by hvoordes
Hello,

I'm having the same problem. None of the plugins is shown in the pull down under hardware.

System: Synlogy DS216j
Domoticz: 3.8770

Where can I find the path for the plugins in the source code? Just to check if I placed the plugins in the right location.
Current location: /usr/local/domoticz/plugins

btw: Trying to get the Sonos plugin visible under hardware.

Re: Python plugin: Sonos [new version]

Posted: Sunday 17 December 2017 15:40
by Kurtsejr
Hi all

Still not working for me
According to https://www.domoticz.com/wiki/Using_Python_plugins
It should be possible to fint this in the logfile (setup/log):

PluginSystem: Started, Python version '3.x.y'

But I can't fint this, for me this means that Domoticz does not know my Python needs - is there a setup posibility that I need to set?

/Kurt

Re: Python plugin: Sonos [new version]

Posted: Saturday 30 December 2017 17:50
by Kurtsejr
SOLVED !!!!!!
We need to enable EventSystem in the setup menu.

Then it all works :oops:

Re: Python plugin: Sonos [new version]

Posted: Wednesday 03 January 2018 9:00
by Rodio
Hi,

This plugin works great, great work THX, but .......... ;)
I found a weird type of behaviour.
I've changed the setting of SononsKeuken/Slaapkamer of the Refresh radio list from false to true.
This works, but look at the screenshots.
The 2 newly created devices will (after a restart of domoticz) be the last IDX devices.
They started there journey as IDX 15 and 16 and have now IDX 163 and 164 :roll:

For me it's not a problem, but found it a bit weird.

Using RPI3, jessie, Domoticz 3.8153, SonosPlugin 0,91, python2.7.9

R

Re: Python plugin: Sonos [new version]

Posted: Saturday 06 January 2018 1:16
by G3rard
@Rodio, thanks for your post.
That indeed happens when you have set 'Refresh radio list:' to True in the Hardware settings.
Then with every restart of the plugin the old devices will be deleted and new ones will be created with the updated radio stations.

So if you set this to False no new devices will be made after a restart.

I have made it like this because that's the only way the list with radio stations can be updated.