Python plugin: Sonos [old version]

Python and python framework

Moderator: leecollings

Post Reply
tester22
Posts: 49
Joined: Tuesday 20 December 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Sweden
Contact:

Re: Python plugin: Sonos

Post by tester22 »

HomeAutomation wrote:
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 timer pluging however. :idea: ?
Timer plugin?
Create an dummy switch and conenct it to blocky.
Define the Sonos to start playing directly and stop after x minutes.
HomeAutomation
Posts: 9
Joined: Saturday 28 February 2015 19:52
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6838
Location: The Netherlands
Contact:

Re: Python plugin: Sonos

Post by HomeAutomation »

tester22 wrote:
HomeAutomation wrote:
mvzut wrote: 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 timer pluging however. :idea: ?
Timer plugin?
Create an dummy switch and conenct it to blocky.
Define the Sonos to start playing directly and stop after x minutes.
Sorry, I ment an Alarm Clock.
Currently I use the "Time = " function in Blocky to start for instance the WakeUp script.
Scenes however can't be reached with myAnroid tablet.
Even though, I prefer a plugin in which it's possible to fill in a time (clock) value.

Jan
dhanjel
Posts: 102
Joined: Tuesday 05 August 2014 22:16
Target OS: Linux
Domoticz version: 3.5146
Location: Sweden
Contact:

Re: Python plugin: Sonos

Post by dhanjel »

It would be nice to be able to set the media source (Sonos favourite for instance), if possible.

I currently use a nodejs middle tier for doing that, and it would be nice to get rid of external dependencies.

I use it to automatically play some lounge music in the bathroom when there is motion :)
tester22
Posts: 49
Joined: Tuesday 20 December 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Sweden
Contact:

Re: Python plugin: Sonos

Post by tester22 »

RayAmsterdam wrote:TTS would be great!
OK, this is super Alpha (pre Beta) but the latest version on Github supports TTS:
https://github.com/tester22/Domoticz-Sonos
bdormael
Posts: 82
Joined: Saturday 13 December 2014 21:20
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Sonos

Post by bdormael »

tester22 wrote:
RayAmsterdam wrote:TTS would be great!
OK, this is super Alpha (pre Beta) but the latest version on Github supports TTS:
https://github.com/tester22/Domoticz-Sonos
It's definitly super alpha, when replacing the previous plugin file with the new one, Domoticz won't start anymore.
Going back to the previous plugin file, all works fine.
tester22
Posts: 49
Joined: Tuesday 20 December 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Sweden
Contact:

Re: Python plugin: Sonos

Post by tester22 »

bdormael wrote:
tester22 wrote:
RayAmsterdam wrote:TTS would be great!
OK, this is super Alpha (pre Beta) but the latest version on Github supports TTS:
https://github.com/tester22/Domoticz-Sonos
It's definitly super alpha, when replacing the previous plugin file with the new one, Domoticz won't start anymore.
Going back to the previous plugin file, all works fine.
Strange, did you copy all the files including the zip files to the plugin folder?
bdormael
Posts: 82
Joined: Saturday 13 December 2014 21:20
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Sonos

Post by bdormael »

tester22 wrote:
bdormael wrote:
tester22 wrote:
OK, this is super Alpha (pre Beta) but the latest version on Github supports TTS:
https://github.com/tester22/Domoticz-Sonos
It's definitly super alpha, when replacing the previous plugin file with the new one, Domoticz won't start anymore.
Going back to the previous plugin file, all works fine.
Strange, did you copy all the files including the zip files to the plugin folder?
Yes, the zip file is there as well, unfortunatly since domoticz does not start, I don't have any logging available either.
Is there any way I can add extra logging ?
tester22
Posts: 49
Joined: Tuesday 20 December 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Sweden
Contact:

Re: Python plugin: Sonos

Post by tester22 »

bdormael wrote:
tester22 wrote:
bdormael wrote:
It's definitly super alpha, when replacing the previous plugin file with the new one, Domoticz won't start anymore.
Going back to the previous plugin file, all works fine.
Strange, did you copy all the files including the zip files to the plugin folder?
Yes, the zip file is there as well, unfortunatly since domoticz does not start, I don't have any logging available either.
Is there any way I can add extra logging ?
Try this version: https://github.com/tester22/Domoticz-So ... /plugin.py
I introduced custom icons about an week ago and maybe thats what causing it.
bdormael
Posts: 82
Joined: Saturday 13 December 2014 21:20
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Sonos

Post by bdormael »

tester22 wrote:
bdormael wrote:
tester22 wrote:
Strange, did you copy all the files including the zip files to the plugin folder?
Yes, the zip file is there as well, unfortunatly since domoticz does not start, I don't have any logging available either.
Is there any way I can add extra logging ?
Try this version: https://github.com/tester22/Domoticz-So ... /plugin.py
I introduced custom icons about an week ago and maybe thats what causing it.
Tried the new file, still crashing Domoticz I'm afraid
tester22
Posts: 49
Joined: Tuesday 20 December 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Sweden
Contact:

Re: Python plugin: Sonos

Post by tester22 »

bdormael wrote:
tester22 wrote:
bdormael wrote:
Yes, the zip file is there as well, unfortunatly since domoticz does not start, I don't have any logging available either.
Is there any way I can add extra logging ?
Try this version: https://github.com/tester22/Domoticz-So ... /plugin.py
I introduced custom icons about an week ago and maybe thats what causing it.
Tried the new file, still crashing Domoticz I'm afraid
Are you on the latest Domoticz Beta? Icons were introduced a couple of weeks ago.
Or switch to this version, without icons: https://github.com/tester22/Domoticz-So ... /plugin.py
bdormael
Posts: 82
Joined: Saturday 13 December 2014 21:20
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Sonos

Post by bdormael »

tester22 wrote:
bdormael wrote:
tester22 wrote:
Try this version: https://github.com/tester22/Domoticz-So ... /plugin.py
I introduced custom icons about an week ago and maybe thats what causing it.
Tried the new file, still crashing Domoticz I'm afraid
Are you on the latest Domoticz Beta? Icons were introduced a couple of weeks ago.
Or switch to this version, without icons: https://github.com/tester22/Domoticz-So ... /plugin.py
The version I'm on is 6683, tried it with the file without icons, now it's working fine again :-)

I'm wondering now how I can test TTS, as I don't see any difference
tester22
Posts: 49
Joined: Tuesday 20 December 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Sweden
Contact:

Re: Python plugin: Sonos

Post by tester22 »

bdormael wrote:
tester22 wrote:
bdormael wrote:
Tried the new file, still crashing Domoticz I'm afraid
Are you on the latest Domoticz Beta? Icons were introduced a couple of weeks ago.
Or switch to this version, without icons: https://github.com/tester22/Domoticz-So ... /plugin.py
The version I'm on is 6683, tried it with the file without icons, now it's working fine again :-)

I'm wondering now how I can test TTS, as I don't see any difference
Your need the latest version of the plugin, I think it is fexed now. Was an broken zip file.
So update to latest version here: https://github.com/tester22/Domoticz-Sonos
bdormael
Posts: 82
Joined: Saturday 13 December 2014 21:20
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Sonos

Post by bdormael »

tester22 wrote:
bdormael wrote:
tester22 wrote:
Are you on the latest Domoticz Beta? Icons were introduced a couple of weeks ago.
Or switch to this version, without icons: https://github.com/tester22/Domoticz-So ... /plugin.py
The version I'm on is 6683, tried it with the file without icons, now it's working fine again :-)

I'm wondering now how I can test TTS, as I don't see any difference
Your need the latest version of the plugin, I think it is fexed now. Was an broken zip file.
So update to latest version here: https://github.com/tester22/Domoticz-Sonos
Newest version installed, crashing directly:
2017-03-08 14:22:54.664 (Sonos Eetkamer) Initialized version 1.0, author 'tester22'
2017-03-08 14:22:54.719 Error: Domoticz received fatal signal 11 !...
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz() [0x1be334]
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz(_Z14signal_handleri+0x58) [0x1be3ec]
2017-03-08 14:22:54.732 Error: /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer_v2+0) [0x76add180]
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz(_ZNSs6assignERKSs+0x98) [0x6a7e70]
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz(_ZN7Plugins11CImage_initEPNS_6CImageEP7_objectS3_+0x21c) [0x46a5f8]
tester22
Posts: 49
Joined: Tuesday 20 December 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Sweden
Contact:

Re: Python plugin: Sonos

Post by tester22 »

bdormael wrote:
tester22 wrote:
bdormael wrote:
The version I'm on is 6683, tried it with the file without icons, now it's working fine again :-)

I'm wondering now how I can test TTS, as I don't see any difference
Your need the latest version of the plugin, I think it is fexed now. Was an broken zip file.
So update to latest version here: https://github.com/tester22/Domoticz-Sonos
Newest version installed, crashing directly:
2017-03-08 14:22:54.664 (Sonos Eetkamer) Initialized version 1.0, author 'tester22'
2017-03-08 14:22:54.719 Error: Domoticz received fatal signal 11 !...
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz() [0x1be334]
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz(_Z14signal_handleri+0x58) [0x1be3ec]
2017-03-08 14:22:54.732 Error: /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer_v2+0) [0x76add180]
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz(_ZNSs6assignERKSs+0x98) [0x6a7e70]
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz(_ZN7Plugins11CImage_initEPNS_6CImageEP7_objectS3_+0x21c) [0x46a5f8]
Ok that seems clear. Have removed the custom icons and will report this.
Try the latest commit on github.
bdormael
Posts: 82
Joined: Saturday 13 December 2014 21:20
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Sonos

Post by bdormael »

tester22 wrote:
bdormael wrote:
tester22 wrote:
Your need the latest version of the plugin, I think it is fexed now. Was an broken zip file.
So update to latest version here: https://github.com/tester22/Domoticz-Sonos
Newest version installed, crashing directly:
2017-03-08 14:22:54.664 (Sonos Eetkamer) Initialized version 1.0, author 'tester22'
2017-03-08 14:22:54.719 Error: Domoticz received fatal signal 11 !...
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz() [0x1be334]
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz(_Z14signal_handleri+0x58) [0x1be3ec]
2017-03-08 14:22:54.732 Error: /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer_v2+0) [0x76add180]
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz(_ZNSs6assignERKSs+0x98) [0x6a7e70]
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz(_ZN7Plugins11CImage_initEPNS_6CImageEP7_objectS3_+0x21c) [0x46a5f8]
Ok that seems clear. Have removed the custom icons and will report this.
Try the latest commit on github.
Thx, all working again.
Now I have the voice fields, so I have added my key and language for each of my devices, but what do I need to do now to test it ?
(how can I send a line of text to a certain device ?)
RayAmsterdam
Posts: 115
Joined: Sunday 11 January 2015 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Sonos

Post by RayAmsterdam »

bdormael wrote: Now I have the voice fields, so I have added my key and language for each of my devices, but what do I need to do now to test it ?
(how can I send a line of text to a certain device ?)
I've got the same question. Another question: Does it restore to the same state as before playing the tts?
RayAmsterdam
Posts: 115
Joined: Sunday 11 January 2015 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Sonos

Post by RayAmsterdam »

RayAmsterdam wrote: Now I have the voice fields, so I have added my key and language for each of my devices, but what do I need to do now to test it ?
(how can I send a line of text to a certain device ?)
I've got the same question. Another question: Does it restore to the same state as before playing the tts?
Already found out by experience it speaks out the notifications and keeps repeating it. No restoring of the previous setting unfortunately.
Last edited by RayAmsterdam on Friday 10 March 2017 17:48, edited 1 time in total.
tester22
Posts: 49
Joined: Tuesday 20 December 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Sweden
Contact:

Re: Python plugin: Sonos

Post by tester22 »

RayAmsterdam wrote:
bdormael wrote: Now I have the voice fields, so I have added my key and language for each of my devices, but what do I need to do now to test it ?
(how can I send a line of text to a certain device ?)
I've got the same question. Another question: Does it restore to the same state as before playing the tts?
Right now it does not resume state. But I think I will reverse this since I have found an problem without any possible solution. If the players load data straight from Voicerss it interprets is as radio, hence it repeats the message indefinitely. Node-Sonos have solved that by downloading the data and expose it using an internal http server. This is not posdible ewith the current Domoticz python framework and all workaround includes adding additional components and that is something I want to avoid.
RayAmsterdam
Posts: 115
Joined: Sunday 11 January 2015 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Sonos

Post by RayAmsterdam »

tester22 wrote: Right now it does not resume state. But I think I will reverse this since I have found an problem without any possible solution. If the players load data straight from Voicerss it interprets is as radio, hence it repeats the message indefinitely. Node-Sonos have solved that by downloading the data and expose it using an internal http server. This is not posdible ewith the current Domoticz python framework and all workaround includes adding additional components and that is something I want to avoid.
:-(
Heursqem
Posts: 18
Joined: Sunday 20 March 2016 14:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Sonos

Post by Heursqem »

dhanjel wrote:It would be nice to be able to set the media source (Sonos favourite for instance), if possible.

I currently use a nodejs middle tier for doing that, and it would be nice to get rid of external dependencies.

I use it to automatically play some lounge music in the bathroom when there is motion :)
Is it (already) possible to do this with core plugin? Would be really great feauture.

Cheers
Heursqem
Post Reply

Who is online

Users browsing this forum: madpatrick and 1 guest