Page 4 of 9

Re: Python plugin: Sonos

Posted: Friday 17 February 2017 12:22
by DomoRies
mvzut wrote:
DomoRies wrote:Nice plugin, but what do you need to fill in at ip-adres in Domoticz? Now it's for default 127.0.0.1
You must fill in the IP address of the Sonos player you want to add. Easiest way to find this is via the Sonos app, under Settings > About my Sonos System.
Thanks! It's working great now!

Re: Python plugin: Sonos

Posted: Monday 20 February 2017 10:51
by mvzut
The plugin is giving errors like these since the last few beta updates:

Code: Select all

2017-02-19 22:30:02.957 Error: (Sonos Laura) 'onNotification' failed 'TypeError':'onNotification() takes 1 positional argument but 7 were given'.
Some searching revealed that the onNotification implementation in the Python plugin framework was changed recently:
http://www.domoticz.com/forum/viewtopic.php?t=16151

I now changed these lines in the Sonos plugin.py (lines 194-196)

Code: Select all

def onNotification(Data):
    Domoticz.Log("Notification: " + str(Data))
    return
into

Code: Select all

def onNotification(name, subject, text, status, priority, sound, image_file):
    Domoticz.Log("Notification: " + str(name) + ", subject: " + str(subject) + ", text: " + str(text) + ", status: " + str(status))
    return
No idea what info from the 7 arguments I should copy to the log, I copied the first 4 for now.

@tester22, maybe you can change this in the GitHub repository?

Re: Python plugin: Sonos

Posted: Monday 20 February 2017 10:55
by tester22
mvzut wrote:The plugin is giving errors like these since the last few beta updates:

Code: Select all

2017-02-19 22:30:02.957 Error: (Sonos Laura) 'onNotification' failed 'TypeError':'onNotification() takes 1 positional argument but 7 were given'.
Some searching revealed that the onNotification implementation in the Python plugin framework was changed recently:
http://www.domoticz.com/forum/viewtopic.php?t=16151

I now changed these lines in the Sonos plugin.py (lines 194-196)

Code: Select all

def onNotification(Data):
    Domoticz.Log("Notification: " + str(Data))
    return
into

Code: Select all

def onNotification(name, subject, text, status, priority, sound, image_file):
    Domoticz.Log("Notification: " + str(name) + ", subject: " + str(subject) + ", text: " + str(text) + ", status: " + str(status))
    return
No idea what info from the 7 arguments I should copy to the log, I copied the first 4 for now.

@Tester22, maybe you can change this in the GitHub repository?
Done

Re: Python plugin: Sonos

Posted: Monday 20 February 2017 18:23
by l00pz
Anyone else having a problem with the Volume Switch of the Sonos Plugin with the latest Beta and Plugin? Or is there something wrong with my configuration :D

Re: Python plugin: Sonos

Posted: Thursday 02 March 2017 6:36
by Pino112
l00pz wrote:Anyone else having a problem with the Volume Switch of the Sonos Plugin with the latest Beta and Plugin? Or is there something wrong with my configuration :D
It doesnt updates the Sonos volume indeed

Also I miss the timer functionality to switch off my Play 1 automatically. Is that not possible with switch type media player?

Re: Python plugin: Sonos

Posted: Thursday 02 March 2017 6:42
by tester22
Pino112 wrote:
l00pz wrote:Anyone else having a problem with the Volume Switch of the Sonos Plugin with the latest Beta and Plugin? Or is there something wrong with my configuration :D
It doesnt updates the Sonos volume indeed

Also I miss the timer functionality to switch off my Play 1 automatically. Is that not possible with switch type media player?
Strange. Volume is working on my play5 players and on my Sonos connect. Could you enable debug and add the log output to this thread.

Not sure what automatic shutdown means. As soon as the plugin detects that the player is stopped it will change status to off.

Re: Python plugin: Sonos

Posted: Thursday 02 March 2017 9:56
by Pino112
tester22 wrote:
Pino112 wrote:
l00pz wrote:Anyone else having a problem with the Volume Switch of the Sonos Plugin with the latest Beta and Plugin? Or is there something wrong with my configuration :D
It doesnt updates the Sonos volume indeed

Also I miss the timer functionality to switch off my Play 1 automatically. Is that not possible with switch type media player?
Strange. Volume is working on my play5 players and on my Sonos connect. Could you enable debug and add the log output to this thread.

Not sure what automatic shutdown means. As soon as the plugin detects that the player is stopped it will change status to off.
I updated to the latest beta version and it works now. Thanks.

Re: Python plugin: Sonos

Posted: Saturday 04 March 2017 0:24
by HomeAutomation
Not be able to add Sonos Player in Hardware

When selecting the Sonos pluging from the Pulldown box and pressing "Add" it's not updated in the hardware overview.
What can be wrong?

***** 2017-03-03 Problem caused by browser Chrome (Versie 56.0.2924.87)

When trying to add the pluging with my Android tablet all worked well.
Difference is that in Chrome the fields for filling in the IP adres etc. were not visible

In Edge there's also no problem to add the plugin in the hardware

......



Domoticz V3.6838 (c)2012-2017 GizMoCuz Build Hash: 895a33a
Startup Path: /home/pi/domoticz/
PluginSystem: Started, Python version '3.4.2'.

Jan

Re: Python plugin: Sonos

Posted: Saturday 04 March 2017 9:11
by mvzut
HomeAutomation wrote:Not be able to add Sonos Player in Hardware

When selecting the Sonos pluging from the Pulldown box and pressing "Add" it's not updated in the hardware overview.
What can be wrong?

Domoticz V3.6838 (c)2012-2017 GizMoCuz Build Hash: 895a33a
Startup Path: /home/pi/domoticz/
PluginSystem: Started, Python version '3.4.2'.

Jan
Did you fill in the IP address of your Sonos?

Re: Python plugin: Sonos

Posted: Saturday 04 March 2017 9:20
by HomeAutomation
mvzut wrote:
HomeAutomation wrote:Not be able to add Sonos Player in Hardware

When selecting the Sonos pluging from the Pulldown box and pressing "Add" it's not updated in the hardware overview.
What can be wrong?

Domoticz V3.6838 (c)2012-2017 GizMoCuz Build Hash: 895a33a
Startup Path: /home/pi/domoticz/
PluginSystem: Started, Python version '3.4.2'.

Jan
Did you fill in the IP address of your Sonos?

No, I did not, because these fields were not visible :( .
I normaly work with Chrome. When I tried it on my Android tablet and later in Edge these fields were visble and it all worked well.

Jan

Re: Python plugin: Sonos

Posted: Saturday 04 March 2017 12:48
by HomeAutomation
How to control Sonos by LUA script

Does anybody have a example how to control the Sonos plugin with a LUA script?

Jan

Re: Python plugin: Sonos

Posted: Saturday 04 March 2017 13:39
by mvzut
HomeAutomation wrote:How to control Sonos by LUA script

Does anybody have a example how to control the Sonos plugin with a LUA script?

Jan
It's just as if you are controlling a lamp: You can use LUA on/off commands (commandArray['<status device name>'] = 'On') to start/pause a player with the current playlist, and you can use the volume device as if it was a dimmer (using e.g. commandArray['<volume device name>']= 'Set Level 30').
As far as I know the plugin can't be used to e.g. skip to the next song or to start a particular playlist. The virtual remote doesn't work (yet).

Re: Python plugin: Sonos

Posted: Saturday 04 March 2017 14:03
by HomeAutomation
mvzut wrote:
HomeAutomation wrote:How to control Sonos by LUA script

Does anybody have a example how to control the Sonos plugin with a LUA script?

Jan
It's just as if you are controlling a lamp: You can use LUA on/off commands (commandArray['<status device name>'] = 'On') to start/pause a player with the current playlist, and you can use the volume device as if it was a dimmer (using e.g. commandArray['<volume device name>']= 'Set Level 30').
As far as I know the plugin can't be used to e.g. skip to the next song or to start a particular playlist. The virtual remote doesn't work (yet).
Is it really that simple? :o
Thanks, I'll give it a try.

Jan

Re: Python plugin: Sonos

Posted: Saturday 04 March 2017 14:16
by tester22
mvzut wrote:
HomeAutomation wrote:Jan
As far as I know the plugin can't be used to e.g. skip to the next song or to start a particular playlist. The virtual remote doesn't work (yet).
Does anyone want features like skip track? My idea have been to use this for automation for example switch on the amplifier when Sonos connect is starting. I have used the Sonos app for everything else.

The only remaining feature I am planning is TTS as soon as the plugin have support for providing an url that Sonos players can conect to so they can download data.

Python plugin: Sonos

Posted: Saturday 04 March 2017 16:46
by mvzut
tester22 wrote:
mvzut wrote:
HomeAutomation wrote:Jan
As far as I know the plugin can't be used to e.g. skip to the next song or to start a particular playlist. The virtual remote doesn't work (yet).
Does anyone want features like skip track? My idea have been to use this for automation for example switch on the amplifier when Sonos connect is starting. I have used the Sonos app for everything else.

The only remaining feature I am planning is TTS as soon as the plugin have support for providing an url that Sonos players can conect to so they can download data.
Skipping tracks etc. is not needed for my purposes. I also primarily use the plugin to activate a Harmony scene (switching on my amp) when my Sonos Connect starts playing. What could be interesting is the ability to start a specific playlist or favourite or radio station. That would enable me to couple e.g. a radio station to a button on my wall mounted tablet running Imperihome, without the need to start the Sonos app.

Re: Python plugin: Sonos

Posted: Saturday 04 March 2017 17:31
by tester22
mvzut wrote:
tester22 wrote:
mvzut wrote: As far as I know the plugin can't be used to e.g. skip to the next song or to start a particular playlist. The virtual remote doesn't work (yet).
Does anyone want features like skip track? My idea have been to use this for automation for example switch on the amplifier when Sonos connect is starting. I have used the Sonos app for everything else.

The only remaining feature I am planning is TTS as soon as the plugin have support for providing an url that Sonos players can conect to so they can download data.
Skipping tracks etc. is not needed for my purposes. I also primarily use the plugin to activate a Harmony scene (switching on my amp) when my Sonos Connect starts playing. What could be interesting is the ability to start a specific playlist or favourite or radio station. That would enable me to couple e.g. a radio station to a button on my wall mounted tablet running Imperihome, without the need to start the Sonos app.
How should that be implemented on in the ui?
A combo button that the user can add Sonos uri (separated by comma) to under preferences or an notification type that can be triggered by scripts?

Re: Python plugin: Sonos

Posted: Saturday 04 March 2017 19:23
by RayAmsterdam
TTS would be great!

Re: Python plugin: Sonos

Posted: Saturday 04 March 2017 20:38
by HomeAutomation
RayAmsterdam wrote:TTS would be great!
I agree.
Just bought my first Sonos Play 1 and allready experience a lot of opportunities for my HomeAutomation 8-)

Jan

Re: Python plugin: Sonos

Posted: Saturday 04 March 2017 23:19
by tester22
HomeAutomation wrote:
RayAmsterdam wrote:TTS would be great!
I agree.
Just bought my first Sonos Play 1 and allready experience a lot of opportunities for my HomeAutomation 8-)

Jan
Yes, but the options I have seen so far requires the script to download the file and than expose it over http so Sonos can download it and that is not currently possible.
Also my plan was to use tha asynchronous built in communication layer (haven't been able to get it working thou) and then it is harder to actually know when the player is done playing the message.

Re: Python plugin: Sonos

Posted: Sunday 05 March 2017 13:47
by HomeAutomation
mvzut wrote:
HomeAutomation wrote:How to control Sonos by LUA script

Does anybody have a example how to control the Sonos plugin with a LUA script?

Jan
It's just as if you are controlling a lamp: You can use LUA on/off commands (commandArray['<status device name>'] = 'On') to start/pause a player with the current playlist, and you can use the volume device as if it was a dimmer (using e.g. commandArray['<volume device name>']= 'Set Level 30').
As far as I know the plugin can't be used to e.g. skip to the next song or to start a particular playlist. The virtual remote doesn't work (yet).
Works perfect.
Integreated Sonos in my WakeUp alarm.
Now, based on one time setting, I'm able to control my bedroom light (WakeUp), central heating and Sonos.
Still looking for a Alarm clock pluging however. :idea: ?