Python plugin: Sonos [old version]

Python and python framework

Moderator: leecollings

User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Python plugin: Sonos

Post by waaren »

[quote="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.

...


I have installed this plugin on my Synology 916+ in

/usr/local/domoticz/var/plugins/domoticz-sonos

and it's working
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
hpnisse
Posts: 2
Joined: Monday 17 April 2017 13:51
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python plugin: Sonos

Post by hpnisse »

waaren wrote: I have installed this plugin on my Synology 916+ in

/usr/local/domoticz/var/plugins/domoticz-sonos

and it's working
GuyTreepbush wrote:Your file permissions are wrong. Set permissions for plug-in.py file to 0777
Thanks to you both!!!

Changed the rights and owner of the files/folders, and moved everything to "domoticz/var/plugins/Sonos".
The volume and some on/off button appeared in devices.

Now I just have to figure it out how to use it like I want... is there any page that list all "commands" I can do?
Can I change input and groups by lua events?

Thanks again!!
mvzut
Posts: 443
Joined: Thursday 12 November 2015 10:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Python plugin: Sonos

Post by mvzut »

hpnisse wrote:
waaren wrote: I have installed this plugin on my Synology 916+ in

/usr/local/domoticz/var/plugins/domoticz-sonos

and it's working
GuyTreepbush wrote:Your file permissions are wrong. Set permissions for plug-in.py file to 0777
Thanks to you both!!!

Changed the rights and owner of the files/folders, and moved everything to "domoticz/var/plugins/Sonos".
The volume and some on/off button appeared in devices.

Now I just have to figure it out how to use it like I want... is there any page that list all "commands" I can do?
Can I change input and groups by lua events?

Thanks again!!
No you can't. Currently you can only play/pause them, change the volume, and see what's playing.
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
johan9610
Posts: 5
Joined: Thursday 11 June 2015 20:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python plugin: Sonos

Post by johan9610 »

Hello tester22.

Great pluginn if it should be working. I've copied the files to /domoticz/plugins/Sonos/...files...
Rebooted several times my r-pi, and checked by hardware and virtual switch but i cann't find the option to add a Sonos switch?
Do i miss something what isn't mensient on the internet?

Some screanshots of prints would be nice to see what i can get..
Keep up the good work, hopefull there will be an office plugin soon like Heos by Denon.

Update: There wasn't any version of Python installed, after that en rebooting again it does work. Very Cool.
Regards, Johan.

Synology NAS DS 713+ (Docker running Domoticz & MQTT), R-Pi2 with P1 Interface. 4xKUKA devices. 3 x Camera's.
Xiaomi MiHome Gateway. Sonoff Basic MQTT (Tasmota). AirconWithMe Wifi Airco module.
User avatar
leecollings
Posts: 167
Joined: Tuesday 30 June 2015 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

Re: Python plugin: Sonos

Post by leecollings »

Can someone please help me? I'm not getting much help from the plugin author, and despite trying everything that's been listed, I am not seeing 'Sonos' appear in my Hardware devices list.

Just to go through the basics...

I'm running Beta 3.7450
I have uploaded the plugin.py file in /plugins/sonos/
I have installed python3 and restarted the Pi

Still nothing shows up in the Hardware dropdown list.

Is there anything else I need to do?

UPDATE:
Even after running `sudo apt-get install python3-dev`, I'm still seeing the error in the log after restarting DM:
`PluginSystem: Failed dynamic library load, install the latest libpython3.x library that is available for your platform.`

How can I fix this? Is this what's stopping Sonos from appearing in the Hardware list?
Last edited by leecollings on Tuesday 16 May 2017 12:29, 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 »

leecollings wrote:Can someone please help me? I'm not getting much help from the plugin author, and despite trying everything that's been listed, I am not seeing 'Sonos' appear in my Hardware devices list.

Just to go through the basics...

I'm running Beta 3.7450
I have uploaded the plugin.py file in /plugins/sonos/
I have installed python3 and restarted the Pi

Still nothing shows up in the Hardware dropdown list.

Is there anything else I need to do?
Do you have any entry in your log displaying that the plugin system is loaded or that the plugin itself is loaded?
Does any other plugins work? What browser are you using?
User avatar
leecollings
Posts: 167
Joined: Tuesday 30 June 2015 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

Re: Python plugin: Sonos

Post by leecollings »

Even after running `sudo apt-get install python3-dev`, I'm still seeing the error in the log after restarting DM:
`PluginSystem: Failed dynamic library load, install the latest libpython3.x library that is available for your platform.`

How can I fix this? Is this what's stopping Sonos from appearing in the Hardware list?
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 »

leecollings wrote:Even after running `sudo apt-get install python3-dev`, I'm still seeing the error in the log after restarting DM:
`PluginSystem: Failed dynamic library load, install the latest libpython3.x library that is available for your platform.`

How can I fix this? Is this what's stopping Sonos from appearing in the Hardware list?
Since libpython isn't working that is what you need to fix.
Have you looked here: https://www.domoticz.com/wiki/Using_Python_plugins

You need both python3 and python3-dev.
User avatar
leecollings
Posts: 167
Joined: Tuesday 30 June 2015 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

Re: Python plugin: Sonos

Post by leecollings »

Something strange going on.

So I already have python3, and this is the latest version. (But I previously ran apt-get install python3-dev, and that installed).

So I seem to have both a production and dev version of python3 installed, but yet Domoticz still displays the message

2017-05-16 11:23:20.424 PluginSystem: Failed dynamic library load, install the latest libpython3.x library that is available for your platform.
User avatar
leecollings
Posts: 167
Joined: Tuesday 30 June 2015 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

Re: Python plugin: Sonos

Post by leecollings »

Installed them both, and restarted. Still seeing the error notice in the log.

No idea what's going on.
User avatar
leecollings
Posts: 167
Joined: Tuesday 30 June 2015 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

Re: Python plugin: Sonos

Post by leecollings »

Now after reading article1, I tried to install sudo apt-get install libpython3.4

But this then said Unable to locate. Unable to find by regex...

I find it hard to believe that some users have had this working fine without any issues... There's clearly an issue probably within Domoticz if it's reporting that I don't have python3, which I clearly do.
User avatar
leecollings
Posts: 167
Joined: Tuesday 30 June 2015 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

Re: Python plugin: Sonos

Post by leecollings »

Can anyone help me please? There must be something I'm missing out here.

Is there any way to force to re-install whatever required version of python is needed? I've been trying apt-get install python3.6.1 and libpython3.6.1 but it can't find those either.

This is really annoying!!
User avatar
leecollings
Posts: 167
Joined: Tuesday 30 June 2015 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

Re: Python plugin: Sonos

Post by leecollings »

Okay, so I managed to install Python 3.6.1 and that loads fine.

I can now see Sonos Players in the Hardware List, but when I click 'Add', literally nothing happens. Nothing in the log, Domoticz doesn't crash. It just does nothing.

Any where I can go from here?
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 »

leecollings wrote:Okay, so I managed to install Python 3.6.1 and that loads fine.

I can now see Sonos Players in the Hardware List, but when I click 'Add', literally nothing happens. Nothing in the log, Domoticz doesn't crash. It just does nothing.

Any where I can go from here?
What browser are you using. If you are using Chrome you should make an force reload. Due to cached JavaScript.
User avatar
leecollings
Posts: 167
Joined: Tuesday 30 June 2015 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

Re: Python plugin: Sonos

Post by leecollings »

Hmm I'll try a cache clear and maybe an entire rPi restart.

I'm running Safari on Mac OS X by the way
User avatar
leecollings
Posts: 167
Joined: Tuesday 30 June 2015 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

Re: Python plugin: Sonos

Post by leecollings »

Got them added now, and seems to be successfully pausing the speakers when turning the switches On and Off.

My ultimate goal is to have an Event where it will collect the state of all players, pause them, play an MP3 file, and then return them to their original state.

I don't suppose this feature is actually built into the plugin in an easy way is it? I was looking at the Http Node Sonos API that does this via the clip all function, but there's such a delay between firing the event and actually hearing any sound.

What would be the best way to get the speakers to play a locally hosted (on the Pi) MP3 file?
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 »

leecollings wrote:Got them added now, and seems to be successfully pausing the speakers when turning the switches On and Off.

My ultimate goal is to have an Event where it will collect the state of all players, pause them, play an MP3 file, and then return them to their original state.

I don't suppose this feature is actually built into the plugin in an easy way is it? I was looking at the Http Node Sonos API that does this via the clip all function, but there's such a delay between firing the event and actually hearing any sound.

What would be the best way to get the speakers to play a locally hosted (on the Pi) MP3 file?
Right now it is only possible to control playback and volume on the players.
To be able to use tts or an local MP3 file Domoticz need to expose an http endpoint that the Sonos players can load data from, it is not possible with the current version of the python framework.

Also there is no clean way in Domoticz to send an event to an device in Domoticz other than on/off/dim.

Hopefully this will be possible in the future.
User avatar
leecollings
Posts: 167
Joined: Tuesday 30 June 2015 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

Re: Python plugin: Sonos

Post by leecollings »

Ah, sorry I didn't see the post earlier about what you can and can't do.

Thanks for the heads up, this may not cut the mustard for what I'm after. But nonetheless, it's fantastic to see a nice native Domoticz plugin to use.

I'll head back to the other API and see if I can improve the delay on firing the events of that.

I would love to hear about any updates to this plugin though, if these features are planned to be added at some point?
rjblake
Posts: 142
Joined: Friday 21 October 2016 9:25
Target OS: NAS (Synology & others)
Domoticz version:
Location: Netherlands
Contact:

Re: Python plugin: Sonos

Post by rjblake »

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.
All working well on my side, but curious about the custom icons. They don't seem to be used at all, or is there something else I need to do to make use of them?
User avatar
leecollings
Posts: 167
Joined: Tuesday 30 June 2015 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

Re: Python plugin: Sonos

Post by leecollings »

G3rard wrote: Just place the code in a file called plugin.py and place it in the folder domoticz/plugin/sonos.
After a restart of Domoticz you can add your Sonos via the Hardware settings under Sonos Players.
After the past hour of removing and re-uploading the plugin files, clearing cache, restarting the Pi, and Allowing new sensors for 5 minutes, I still haven't been able to see 'Sonos Players' in the Hardware list.

There must be something more to adding this, as htese instructions don't seem to be working at all.

Can you give some advice or assistance please? Running v3.7613 Beta
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest