Page 6 of 9
Re: Python plugin: Sonos
Posted: Saturday 18 March 2017 15:00
by HomeAutomation
tester22 wrote: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.
@tester22, how's live going?
After your last reply about the issue with TTS, it's quiet in this topic.
As a user of your plugin I'm curious about your plans with the pluging. In other words: What's in the pipeline for the next 2 months?
With regards,
Jan
Re: Python plugin: Sonos
Posted: Sunday 19 March 2017 18:21
by Heursqem
I have the plugin working, great!!!
This is what I would love to achieve
#1 - Someone pushes my doorbell
#2 - I capture the current state of my sonos player (medium, song, volume etc) and save this for later
#3 - I play my own sound through the sonos player (ding-dong)
#4 - I go back to to captured/saved state and listen to original music again
Would all of this be possible with this sonos plugin?
Re: Python plugin: Sonos
Posted: Tuesday 21 March 2017 14:23
by pvdhelm
can't find the sonos controller.
I'm on the latest beta version of domotics
placed the files in the /domoticz/plugins/Sonos directory.
restarted the server.
in hardware i can't find Sonos.
what goes wrong here??
Python plugin: Sonos
Posted: Tuesday 21 March 2017 18:33
by mvzut
pvdhelm wrote:can't find the sonos controller.
I'm on the latest beta version of domotics
placed the files in the /domoticz/plugins/Sonos directory.
restarted the server.
in hardware i can't find Sonos.
what goes wrong here??
Do you have Python installed?
Re: Python plugin: Sonos
Posted: Tuesday 21 March 2017 22:54
by pvdhelm
yep python is installed.
got it working now but server crashes every 30 minutes. Now try a fresh installation of the server and sonos plugin.
tomorrow i let you know if this works
tnx
Re: Python plugin: Sonos
Posted: Friday 24 March 2017 20:44
by tester22
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
How would you suggest that it is displayed in the ui in an generic way?
Re: Python plugin: Sonos
Posted: Friday 24 March 2017 20:50
by tester22
Heursqem wrote: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
Not possible right now. Tecnically it is not so advanced but I have no idea on how to create the gui for it.
Re: Python plugin: Sonos
Posted: Friday 24 March 2017 20:54
by tester22
HomeAutomation wrote:tester22 wrote:RayAmsterdam wrote:
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.
@tester22, how's live going?
After your last reply about the issue with TTS, it's quiet in this topic.
As a user of your plugin I'm curious about your plans with the pluging. In other words: What's in the pipeline for the next 2 months?
With regards,
Jan
Right not I think the plugin is more or less feature complete. Sonos players does not work well with the TTS services I have seen so far unless the tts file is downloaded and exposed with a webserver, that is something the the current python framework doesn't allow therefor TTS isn't possible right now.
Also this would require the calls to be made syncronos and the idea behind the python framework was that communication should be asyncronos.
Re: Python plugin: Sonos
Posted: Friday 24 March 2017 20:57
by tester22
Heursqem wrote:I have the plugin working, great!!!
This is what I would love to achieve
#1 - Someone pushes my doorbell
#2 - I capture the current state of my sonos player (medium, song, volume etc) and save this for later
#3 - I play my own sound through the sonos player (ding-dong)
#4 - I go back to to captured/saved state and listen to original music again
Would all of this be possible with this sonos plugin?
This would require the calls to be made syncronos and the idea behind the python framework was that communication should be asyncronos.
But maybe it would be possible to implement anyway. The audio to be played would need to be saved in an local music library and it would need special naming but might be possible tom implement. Will think about it.
Re: Python plugin: Sonos
Posted: Saturday 25 March 2017 23:34
by G3rard
tester22 wrote:
This would require the calls to be made syncronos and the idea behind the python framework was that communication should be asyncronos.
But maybe it would be possible to implement anyway. The audio to be played would need to be saved in an local music library and it would need special naming but might be possible tom implement. Will think about it.
Currently I am using PHP code for this, see
https://github.com/gerard33/sonos/blob/ ... s.php#L379.
Maybe that can be of any use.
tester22 wrote: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
How would you suggest that it is displayed in the ui in an generic way?
You can use the selector switch for this. It's used in Denon
plugin of Dnpwwo.
In that plugin it's possible to change the name of the value in the selector switch, and it can be mapped in the hardware page, so you know which value to send.
See the screenshot below.
- marantz.png (50.51 KiB) Viewed 3223 times
Re: Python plugin: Sonos
Posted: Sunday 26 March 2017 9:54
by tester22
G3rard wrote:tester22 wrote:
This would require the calls to be made syncronos and the idea behind the python framework was that communication should be asyncronos.
But maybe it would be possible to implement anyway. The audio to be played would need to be saved in an local music library and it would need special naming but might be possible tom implement. Will think about it.
Currently I am using PHP code for this, see
https://github.com/gerard33/sonos/blob/ ... s.php#L379.
Maybe that can be of any use.
tester22 wrote: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
How would you suggest that it is displayed in the ui in an generic way?
You can use the selector switch for this. It's used in Denon
plugin of Dnpwwo.
In that plugin it's possible to change the name of the value in the selector switch, and it can be mapped in the hardware page, so you know which value to send.
See the screenshot below.
marantz.png
If I am reading your code right you are saving the file locally here before sending it to the sonos players:
https://github.com/gerard33/sonos/blob/ ... s.php#L420
This is where I get stuck since the python framework does not support exposing the url's where the Sonos players can read data.
Regaring the selector switch. That is ofcourse possible but to have what all users suggest one user would like to have "Search and play the first found album by artist X", another one wan't to have line in and so on.
One possible solution would be that I Populate the dropdown with all the Sonos favorites that are defined. That way it would be an generic solution even that all the creterias above won't be possible to have.
Re: Python plugin: Sonos
Posted: Monday 27 March 2017 21:59
by G3rard
tester22 wrote:
If I am reading your code right you are saving the file locally here before sending it to the sonos players:
https://github.com/gerard33/sonos/blob/ ... s.php#L420
This is where I get stuck since the python framework does not support exposing the url's where the Sonos players can read data.
Regaring the selector switch. That is ofcourse possible but to have what all users suggest one user would like to have "Search and play the first found album by artist X", another one wan't to have line in and so on.
One possible solution would be that I Populate the dropdown with all the Sonos favorites that are defined. That way it would be an generic solution even that all the creterias above won't be possible to have.
The PHP is indeed saving the file locally. It first checks if the file is already there, if not then it will be downloaded.
Can't the files be downloaded in the a subfolder of the plugin directory? I also store the files in a subfolder of the PHP files and play it from there.
For the selector switch I think it is a good option to get the Sonos favorites. I think the selector switch can only handle 10 values (at least when using via Domoticz GUI), so that is something to take into consideration.
Re: Python plugin: Sonos
Posted: Monday 27 March 2017 22:06
by tester22
G3rard wrote:tester22 wrote:
If I am reading your code right you are saving the file locally here before sending it to the sonos players:
https://github.com/gerard33/sonos/blob/ ... s.php#L420
This is where I get stuck since the python framework does not support exposing the url's where the Sonos players can read data.
Regaring the selector switch. That is ofcourse possible but to have what all users suggest one user would like to have "Search and play the first found album by artist X", another one wan't to have line in and so on.
One possible solution would be that I Populate the dropdown with all the Sonos favorites that are defined. That way it would be an generic solution even that all the creterias above won't be possible to have.
The PHP is indeed saving the file locally. It first checks if the file is already there, if not then it will be downloaded.
Can't the files be downloaded in the a subfolder of the plugin directory? I also store the files in a subfolder of the PHP files and play it from there.
For the selector switch I think it is a good option to get the Sonos favorites. I think the selector switch can only handle 10 values (at least when using via Domoticz GUI), so that is something to take into consideration.
No it is currently not possible to expose files with the python framework. I know this is considered and when it is possible I will try if it would work for this purpose.
Re: Python plugin: Sonos
Posted: Thursday 30 March 2017 16:28
by Dynamic
I am trying to get this plugin running, but I'm stuck.
I get this error in the Domoticz log:
Code: Select all
2017-03-30 16:22:06.543 PluginSystem: Failed dynamic library load, install the latest libpython3.x library that is available for your platform.
I tried to install libpython on my raspberry, but he can't find the package?
Re: Python plugin: Sonos
Posted: Thursday 30 March 2017 21:49
by swevm
Dynamic wrote:I am trying to get this plugin running, but I'm stuck.
I get this error in the Domoticz log:
Code: Select all
2017-03-30 16:22:06.543 PluginSystem: Failed dynamic library load, install the latest libpython3.x library that is available for your platform.
I tried to install libpython on my raspberry, but he can't find the package?
Did you follow
https://www.domoticz.com/wiki/Using_Python_plugins
Page that outline prerequisites and install method for Python?
Re: Python plugin: Sonos
Posted: Friday 31 March 2017 10:43
by Dynamic
I did now, but I'm now stuck with 'change CMakeLists.txt'. I can't find how to do this? I tried to search for that file & tried to google it, but can't find it anywhere. If someone could help me out, that would be really appreciated!
Re: Python plugin: Sonos
Posted: Friday 31 March 2017 12:20
by swevm
Dynamic wrote:
I did now, but I'm now stuck with 'change CMakeLists.txt'. I can't find how to do this? I tried to search for that file & tried to google it, but can't find it anywhere. If someone could help me out, that would be really appreciated!
What platform are you installing on. RPi? What OS are you using?
I never had to edit any files to get Python runtime to install.
Neither should you have to do that to install a plugin (unless the plugin depend on stuff you need to compile before it can be installed) as it's as simple as copying plugin.py to correct plugins folder and restart Domiticz so that it get picked up by Domoticz.
Re: Python plugin: Sonos
Posted: Friday 31 March 2017 17:20
by Dynamic
I'm getting somewhere. I can see this in my logfile:
Code: Select all
2017-03-31 17:16:13.345 PluginSystem: Started, Python version '3.5.2'.
2017-03-31 17:16:15.760 PluginSystem: Entering work loop.
So, i created this directory: /domoticz/plugins/sonos/
I created the file plugin.py, added the code from Github.
chmod the file to 755.
issued sudo service domoticz.sh restart
Went to domoticz / hardware. Added sonos. But now I get this error:
Code: Select all
2017-03-31 17:31:49.316 Error: (Sonos) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/sonos/:/usr/local/lib/python35.zip:/usr/local/lib/python3.5/:/usr/local/lib/python3.5/plat-linux:/usr/local/lib/python3.5/lib-dynload'.
2017-03-31 17:31:49.316 Error: (Sonos) Module Import failed, exception: 'IndentationError'
2017-03-31 17:31:49.317 Error: (Sonos) Import detail: File: /home/pi/domoticz/plugins/sonos/plugin.py, Line: -1234606240, offset: 275
2017-03-31 17:31:49.317 Error: (Sonos) Error Line 'return False
Re: Python plugin: Sonos
Posted: Monday 17 April 2017 14:35
by hpnisse
Hey!
I have a Synology DS1515+ NAS with DSM version 6.1-15047.
And I have installed
Domoticz Beta v3.7320 by jumbotroll, that should support Python Plugin Beta.
The problem is that when I add plugins,
Sonos, the Domoticz installation can't find it.
The logs from Domoticz startup is:
- Spoiler: show
- 2017-04-17 14:14:34.832 Domoticz V3.7320 (c)2012-2017 GizMoCuz
2017-04-17 14:14:34.832 Build Hash: 61a03b6-modified, Date: 2017-04-13 13:28:23
2017-04-17 14:14:34.832 Startup Path: /usr/local/domoticz/
2017-04-17 14:14:34.993 EventSystem: reset all events...
2017-04-17 14:14:35.055 PluginSystem: Started, Python version '3.5.1'.
...
2017-04-17 14:14:37.498 PluginSystem: Entering work loop.
...
The startup seems to do something with plugin support , but I canĀ“t find the Sonos plugin in "Hardware" - "Type" list.
The plugin files is in right folder I think?!
.../domoticz/plugins/Sonos/
- Spoiler: show
- sonos nas.PNG (18.69 KiB) Viewed 2862 times
Any ideas?
Thanks!
Re: Python plugin: Sonos
Posted: Monday 17 April 2017 20:40
by GuyTreepbush
Your file permissions are wrong. Set permissions for plug-in.py file to 0777