Page 8 of 9

Re: Python plugin: Sonos

Posted: Thursday 01 June 2017 17:01
by mivo
leecollings wrote:Can you give some advice or assistance please? Running v3.7613 Beta
Hi,

if you are using prebuilt beta binary tarballs, they are compiled without Python suport - from v3.7602 hash f39f21d.

viewtopic.php?f=6&t=17778#p136671

Re: Python plugin: Sonos

Posted: Thursday 01 June 2017 17:10
by leecollings
Sorry not sure what to do here, do I need to run that command in terminal after SSHing into the Pi? BEcause when I do I get the message:

Code: Select all

CMake Error: The source directory "/home/pi" does not appear to contain CMakeLists.txt

Re: Python plugin: Sonos

Posted: Thursday 01 June 2017 17:16
by G3rard
There were some huge changes in the Python framework in the last beta releases. I believe the plugins are currently not working in the latest version, but I guess it will be fixed soon.

Re: Python plugin: Sonos

Posted: Wednesday 07 June 2017 7:53
by elgringo
To make the plugin support work again (the new python plugin framework)

Compile Domoticz locally on your system
For a raspberry: http://www.domoticz.com/wiki/Installing ... spberry_PI

Compiling it locally enables the python plugin support

Re: Python plugin: Sonos

Posted: Saturday 10 June 2017 10:27
by bdormael
G3rard wrote:There were some huge changes in the Python framework in the last beta releases. I believe the plugins are currently not working in the latest version, but I guess it will be fixed soon.
Any chance on an update so it works again with the newest beta of Domoticz ?

Re: Python plugin: Sonos

Posted: Sunday 11 June 2017 22:44
by mvzut
bdormael wrote:
G3rard wrote:There were some huge changes in the Python framework in the last beta releases. I believe the plugins are currently not working in the latest version, but I guess it will be fixed soon.
Any chance on an update so it works again with the newest beta of Domoticz ?
Yes that would be great! I am using the plugin to swithc my receiver, and this stopped working after the recent updates.\

I have been looking into the code myself a bit. I'm not an experienced programmer, but I think I understand just enough to see that the connection part has to be rewritten. It is now using a custom sendMessage function, which uses a http.client.HTTPConnection method to connect to the Sonos players. This should probably be changed into something like

Code: Select all

self.SonosConn = Domoticz.Connection(Name="Sonos", Transport="TCP/IP", Protocol="JSON", Address=Parameters["Address"])
self.SonosConn.connect()
self.SonosConn.Send(...)
When I have time I may give it a go, but success not guaranteed.

Tester 22, are you still using the plugin yourself? Would you consider making rhe necessary changes?

Re: Python plugin: Sonos

Posted: Thursday 15 June 2017 18:45
by tester22
mvzut wrote:
bdormael wrote:
G3rard wrote:There were some huge changes in the Python framework in the last beta releases. I believe the plugins are currently not working in the latest version, but I guess it will be fixed soon.
Any chance on an update so it works again with the newest beta of Domoticz ?
Yes that would be great! I am using the plugin to swithc my receiver, and this stopped working after the recent updates.\

I have been looking into the code myself a bit. I'm not an experienced programmer, but I think I understand just enough to see that the connection part has to be rewritten. It is now using a custom sendMessage function, which uses a http.client.HTTPConnection method to connect to the Sonos players. This should probably be changed into something like

Code: Select all

self.SonosConn = Domoticz.Connection(Name="Sonos", Transport="TCP/IP", Protocol="JSON", Address=Parameters["Address"])
self.SonosConn.connect()
self.SonosConn.Send(...)
When I have time I may give it a go, but success not guaranteed.

Tester 22, are you still using the plugin yourself? Would you consider making rhe necessary changes?
I had an look at this today and it requires quite some work to get this back working.
This was one of the first plugins written and there have been some added functionality to the framework since this was built that would be good to implement.

I am note sure when this can be done but will have an look this weekend.

Apart from that domoticz beta seems a bit unstable since it is crashing once every hour even if no plugins are installed.

Python plugin: Sonos

Posted: Thursday 15 June 2017 20:14
by mvzut
tester22 wrote:I had an look at this today and it requires quite some work to get this back working.
This was one of the first plugins written and there have been some added functionality to the framework since this was built that would be good to implement.

I am note sure when this can be done but will have an look this weekend.

Apart from that domoticz beta seems a bit unstable since it is crashing once every hour even if no plugins are installed.
Would be great if you can have a look! I'm sure you'll make quite a few people happy if you can get it back to work. Thanks for your help!

By the way, I don't experience the instability issues you are mentioning?! Maybe you can try disabling some hardware to see if one of those is causing the problem.

Re: Python plugin: Sonos

Posted: Thursday 15 June 2017 20:22
by tester22
mvzut wrote:
tester22 wrote:I had an look at this today and it requires quite some work to get this back working.
This was one of the first plugins written and there have been some added functionality to the framework since this was built that would be good to implement.

I am note sure when this can be done but will have an look this weekend.

Apart from that domoticz beta seems a bit unstable since it is crashing once every hour even if no plugins are installed.
Would be great if you can have a look! I'm sure you'll make quite a few people happy if you can get it back to work. Thanks for your help!

By the way, I don't experience the instability issues you are mentioning?! Maybe you can try disabling some hardware to see if one of those is causing the problem.
Ok, actually had some time today so I have pushed an version to github.
Unfortuanly this version can't read the state of the players (the xml parsing is whats causing the plugin to segfault) but it is possible to controle players.

BUT it won't be possible to get player state with this version!

Python plugin: Sonos

Posted: Thursday 15 June 2017 20:28
by mvzut
tester22 wrote:
mvzut wrote:
tester22 wrote:I had an look at this today and it requires quite some work to get this back working.
This was one of the first plugins written and there have been some added functionality to the framework since this was built that would be good to implement.

I am note sure when this can be done but will have an look this weekend.

Apart from that domoticz beta seems a bit unstable since it is crashing once every hour even if no plugins are installed.
Would be great if you can have a look! I'm sure you'll make quite a few people happy if you can get it back to work. Thanks for your help!

By the way, I don't experience the instability issues you are mentioning?! Maybe you can try disabling some hardware to see if one of those is causing the problem.
Ok, actually had some time today so I have pushed an version to github.
Unfortuanly this version can't read the state of the players (the xml parsing is whats causing the plugin to segfault) but it is possible to controle players.

BUT it won't be possible to get player state with this version!
Great! I'll give it a go tonight. Unfortunately, I do also need the possibility to read the state. I was using this to switch an amplifier on and off for my Sonos Connect. I hope you find a solution to the segfault issue...

UPDATE: The new version works! Indeed only for controlling.

Re: Python plugin: Sonos

Posted: Thursday 15 June 2017 21:46
by tester22
mvzut wrote:
tester22 wrote:
mvzut wrote:
Would be great if you can have a look! I'm sure you'll make quite a few people happy if you can get it back to work. Thanks for your help!

By the way, I don't experience the instability issues you are mentioning?! Maybe you can try disabling some hardware to see if one of those is causing the problem.
Ok, actually had some time today so I have pushed an version to github.
Unfortuanly this version can't read the state of the players (the xml parsing is whats causing the plugin to segfault) but it is possible to controle players.

BUT it won't be possible to get player state with this version!
Great! I'll give it a go tonight. Unfortunately, I do also need the possibility to read the state. I was using this to switch an amplifier on and off for my Sonos Connect. I hope you find a solution to the segfault issue...

UPDATE: The new version works! Indeed only for controlling.
Managed to get the built in xml parser to work.
Currently only player state and title.

Volume and mute is not loaded nor radio stations.

Re: Python plugin: Sonos

Posted: Thursday 15 June 2017 22:45
by mvzut
tester22 wrote:Managed to get the built in xml parser to work.
Currently only player state and title.

Volume and mute is not loaded nor radio stations.
Works, thanks! You say that (only) radio stations are not shown, but when I play something from a streaming service like Spotify it also doesn't show the title.

Re: Python plugin: Sonos

Posted: Thursday 15 June 2017 23:08
by ben53252642
I think this plugin should be built into Domoticz as available hardware just like OpenZWave.

Python plugin: Sonos

Posted: Thursday 15 June 2017 23:47
by mvzut
mvzut wrote:
tester22 wrote:Managed to get the built in xml parser to work.
Currently only player state and title.

Volume and mute is not loaded nor radio stations.
Works, thanks! You say that (only) radio stations are not shown, but when I play something from a streaming service like Spotify it also doesn't show the title.
Hmmm, looks like I was too optimistic, Domoticz froze after a few minutes. Can't seem to get it running stable. Is it working reliable at your side?

Re: Python plugin: Sonos

Posted: Friday 16 June 2017 6:59
by tester22
mvzut wrote:
mvzut wrote:
tester22 wrote:Managed to get the built in xml parser to work.
Currently only player state and title.

Volume and mute is not loaded nor radio stations.
Works, thanks! You say that (only) radio stations are not shown, but when I play something from a streaming service like Spotify it also doesn't show the title.
Hmmm, looks like I was too optimistic, Domoticz froze after a few minutes. Can't seem to get it running stable. Is it working reliable at your side?
For me the beta have been crashing every 2 hours.
But that's unrelated to any plugins.

Re: Python plugin: Sonos

Posted: Friday 23 June 2017 15:11
by rathmannm
Hi,

I am still having an issue with the plugin which prevents Domoticz from startin. I am running the latest beta 3.8005 and updated the Sonos plugin from Github but this is what I get in the log:

2017-06-23 13:23:10.912 Error: Domoticz received fatal signal 11 !...
2017-06-23 13:23:10.913 Error: Domoticz received fatal signal 11 while backtracing !...
....
2017-06-23 13:23:10.920 Error: /home/pi/domoticz/domoticz() [0x1ccd84]
2017-06-23 13:23:10.920 Error: /home/pi/domoticz/domoticz(_Z14signal_handleri+0x58) [0x1cce3c]
2017-06-23 13:23:10.920 Error: /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer_v2+0) [0x76a8f180]

Any idea on how to rectify this or do I have to wait for the plugin to be updated?

Cheers,
Manuel

Re: Python plugin: Sonos

Posted: Friday 23 June 2017 15:24
by tester22
rathmannm wrote:Hi,

I am still having an issue with the plugin which prevents Domoticz from startin. I am running the latest beta 3.8005 and updated the Sonos plugin from Github but this is what I get in the log:

2017-06-23 13:23:10.912 Error: Domoticz received fatal signal 11 !...
2017-06-23 13:23:10.913 Error: Domoticz received fatal signal 11 while backtracing !...
....
2017-06-23 13:23:10.920 Error: /home/pi/domoticz/domoticz() [0x1ccd84]
2017-06-23 13:23:10.920 Error: /home/pi/domoticz/domoticz(_Z14signal_handleri+0x58) [0x1cce3c]
2017-06-23 13:23:10.920 Error: /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer_v2+0) [0x76a8f180]

Any idea on how to rectify this or do I have to wait for the plugin to be updated?

Cheers,
Manuel
To be honnest I have no idea how to solve it.
Maybe @Dnpwwo knows what's causing it.
https://github.com/tester22/Domoticz-Sonos

Re: Python plugin: Sonos

Posted: Saturday 24 June 2017 3:02
by Dnpwwo
@rathmannm,

If the crash is at start up can you post the whole start up log.

Also can you check the domoticz/scripts/python folder and make sure you don't have any files starting 'script_' that don't end in 'demo.py'.

Re: Python plugin: Sonos

Posted: Saturday 24 June 2017 11:19
by rathmannm
Hi,

thanks for getting back to me. I've checked the folder and there are no scripts ending with *.demo.py. Here is the full log:

2017-06-24 08:44:23.763 Incoming connection from: 192.168.0.2
2017-06-24 08:44:25.694 EventSystem: reset all events...
2017-06-24 08:44:25.695 EventSystem: reset all device statuses...
2017-06-24 08:44:25.842 Python EventSystem: Module not found - Trying to initialize.
2017-06-24 08:44:25.844 Python EventSystem: Initalizing event module.
2017-06-24 08:44:25.845 EventSystem: Started
2017-06-24 08:44:26.183 PluginSystem: Entering work loop.
2017-06-24 08:44:26.194 OpenZWave: using config in: /home/pi/domoticz/Config/
2017-06-24 08:44:26.210 OpenZWave: Starting...
2017-06-24 08:44:26.211 OpenZWave: Version: 1.4-2501-g5af6780-dirty
2017-06-24 08:44:26.347 Error: (Sonos) failed to load 'plugin.py', Python Path used was ':/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload'.
2017-06-24 08:44:26.347 Error: (Sonos Livingroom) Module Import failed, exception: 'ImportError'
2017-06-24 08:44:26.348 Error: (Sonos Livingroom) Module Import failed: ' Name: plugin'
2017-06-24 08:44:26.510 OpenZWave: Driver Ready
2017-06-24 08:44:26.525 Error: (Sonos) failed to load 'plugin.py', Python Path used was ':/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload'.
2017-06-24 08:44:26.526 Error: (Sonos Kitchen) Module Import failed, exception: 'ImportError'
2017-06-24 08:44:26.526 Error: (Sonos Kitchen) Module Import failed: ' Name: plugin'
2017-06-24 08:44:26.528 OpenZWave: Value_Added: Node: 2 (0x02), CommandClass: SWITCH BINARY, Label: Switch, Instance: 1
2017-06-24 08:44:26.530 OpenZWave: Value_Added: Node: 2 (0x02), CommandClass: SWITCH MULTILEVEL, Label: Level, Instance: 1
2017-06-24 08:44:26.531 OpenZWave: Value_Added: Node: 2 (0x02), CommandClass: SWITCH MULTILEVEL, Label: Bright, Instance: 1
2017-06-24 08:44:26.531 OpenZWave: Value_Added: Node: 2 (0x02), CommandClass: SWITCH MULTILEVEL, Label: Dim, Instance: 1
2017-06-24 08:44:26.532 OpenZWave: Value_Added: Node: 2 (0x02), CommandClass: METER, Label: Energy, Instance: 1
2017-06-24 08:44:26.532 OpenZWave: Value_Added: Node: 2 (0x02), CommandClass: METER, Label: Power, Instance: 1
2017-06-24 08:44:26.532 OpenZWave: Value_Added: Node: 2 (0x02), CommandClass: METER, Label: Voltage, Instance: 1
2017-06-24 08:44:26.533 OpenZWave: Value_Added: Node: 2 (0x02), CommandClass: METER, Label: Current, Instance: 1
2017-06-24 08:44:26.533 OpenZWave: Value_Added: Node: 2 (0x02), CommandClass: COLOR, Label: Color, Instance: 1
2017-06-24 08:44:26.535 OpenZWave: Value_Added: Node: 2 (0x02), CommandClass: COLOR, Label: Color Index, Instance: 1
2017-06-24 08:44:26.536 OpenZWave: Value_Added: Node: 2 (0x02), CommandClass: CLOCK, Label: Day, Instance: 1
2017-06-24 08:44:26.536 OpenZWave: Value_Added: Node: 2 (0x02), CommandClass: CLOCK, Label: Hour, Instance: 1
2017-06-24 08:44:26.537 OpenZWave: Value_Added: Node: 2 (0x02), CommandClass: CLOCK, Label: Minute, Instance: 1
2017-06-24 08:44:26.537 OpenZWave: NodeID: 2 (0x02), Thermostat Clock: Friday 02:50
2017-06-24 08:44:26.539 (Aeontec Zwave USB) General/Thermostat Clock (Thermostat Clock)
2017-06-24 08:44:26.541 OpenZWave: Value_Added: Node: 3 (0x03), CommandClass: METER, Label: Energy, Instance: 1
2017-06-24 08:44:26.542 OpenZWave: Value_Added: Node: 3 (0x03), CommandClass: BATTERY, Label: Battery Level, Instance: 1
2017-06-24 08:44:26.544 OpenZWave: Value_Added: Node: 4 (0x04), CommandClass: SWITCH MULTILEVEL, Label: Level, Instance: 1
2017-06-24 08:44:26.546 OpenZWave: Value_Added: Node: 4 (0x04), CommandClass: SWITCH MULTILEVEL, Label: Bright, Instance: 1
2017-06-24 08:44:26.546 OpenZWave: Value_Added: Node: 4 (0x04), CommandClass: SWITCH MULTILEVEL, Label: Dim, Instance: 1
2017-06-24 08:44:26.549 OpenZWave: Value_Added: Node: 5 (0x05), CommandClass: SENSOR BINARY, Label: Sensor, Instance: 0
2017-06-24 08:44:26.550 OpenZWave: Value_Added: Node: 5 (0x05), CommandClass: SENSOR MULTILEVEL, Label: Temperature, Instance: 1
2017-06-24 08:44:26.550 OpenZWave: Value_Added: Node: 5 (0x05), CommandClass: SENSOR MULTILEVEL, Label: General, Instance: 2
2017-06-24 08:44:26.551 OpenZWave: Value_Added: Node: 5 (0x05), CommandClass: SENSOR MULTILEVEL, Label: Luminance, Instance: 3
2017-06-24 08:44:26.551 OpenZWave: Value_Added: Node: 5 (0x05), CommandClass: SENSOR MULTILEVEL, Label: Direction, Instance: 7
2017-06-24 08:44:26.552 OpenZWave: Value_Added: Unhandled Label: Direction, Unit:
2017-06-24 08:44:26.552 OpenZWave: Value_Added: Node: 5 (0x05), CommandClass: SENSOR MULTILEVEL, Label: Tank Capacity, Instance: 19
2017-06-24 08:44:26.553 OpenZWave: Value_Added: Node: 5 (0x05), CommandClass: BATTERY, Label: Battery Level, Instance: 1
2017-06-24 08:44:26.554 OpenZWave: Value_Added: Node: 5 (0x05), CommandClass: SENSOR ALARM, Label: General, Instance: 1
2017-06-24 08:44:26.556 OpenZWave: Value_Added: Node: 9 (0x09), CommandClass: SWITCH BINARY, Label: Switch, Instance: 1
2017-06-24 08:44:26.559 OpenZWave: Value_Added: Node: 10 (0x0a), CommandClass: SWITCH MULTILEVEL, Label: Level, Instance: 1
2017-06-24 08:44:26.560 OpenZWave: Value_Added: Node: 10 (0x0a), CommandClass: SWITCH MULTILEVEL, Label: Bright, Instance: 1
2017-06-24 08:44:26.560 OpenZWave: Value_Added: Node: 10 (0x0a), CommandClass: SWITCH MULTILEVEL, Label: Dim, Instance: 1
2017-06-24 08:44:26.563 OpenZWave: Value_Added: Node: 11 (0x0b), CommandClass: SWITCH MULTILEVEL, Label: Level, Instance: 1
2017-06-24 08:44:26.564 OpenZWave: Value_Added: Node: 11 (0x0b), CommandClass: SWITCH MULTILEVEL, Label: Bright, Instance: 1
2017-06-24 08:44:26.565 OpenZWave: Value_Added: Node: 11 (0x0b), CommandClass: SWITCH MULTILEVEL, Label: Dim, Instance: 1
2017-06-24 08:44:26.565 OpenZWave: Value_Added: Node: 11 (0x0b), CommandClass: INDICATOR, Label: Indicator, Instance: 1
2017-06-24 08:44:26.565 OpenZWave: Unhandled class: 0x87 (INDICATOR), NodeID: 11 (0x0b), Index: 0, Instance: 1
2017-06-24 08:44:26.567 OpenZWave: Value_Added: Node: 12 (0x0c), CommandClass: SENSOR BINARY, Label: Sensor, Instance: 0
2017-06-24 08:44:26.568 OpenZWave: Value_Added: Node: 12 (0x0c), CommandClass: BATTERY, Label: Battery Level, Instance: 1
2017-06-24 08:44:26.570 OpenZWave: Value_Added: Node: 13 (0x0d), CommandClass: SWITCH BINARY, Label: Switch, Instance: 1
2017-06-24 08:44:26.571 OpenZWave: Value_Added: Node: 13 (0x0d), CommandClass: SENSOR MULTILEVEL, Label: Temperature, Instance: 1
2017-06-24 08:44:26.571 OpenZWave: Value_Added: Node: 13 (0x0d), CommandClass: SENSOR MULTILEVEL, Label: Luminance, Instance: 3
2017-06-24 08:44:26.572 OpenZWave: Value_Added: Node: 13 (0x0d), CommandClass: SENSOR MULTILEVEL, Label: Dew Point, Instance: 11
2017-06-24 08:44:26.572 OpenZWave: Value_Added: Node: 13 (0x0d), CommandClass: THERMOSTAT MODE, Label: Mode, Instance: 1
2017-06-24 08:44:26.575 OpenZWave: Value_Added: Node: 13 (0x0d), CommandClass: THERMOSTAT SETPOINT, Label: Heating 1, Instance: 1
2017-06-24 08:44:26.576 OpenZWave: Value_Added: Node: 13 (0x0d), CommandClass: BATTERY, Label: Battery Level, Instance: 1
2017-06-24 08:44:26.579 Error: Domoticz received fatal signal 11 !...
2017-06-24 08:44:26.579 Error: Domoticz received fatal signal 11 while backtracing !...
2017-06-24 08:44:26.580 OpenZWave: Value_Added: Node: 14 (0x0e), CommandClass: SENSOR BINARY, Label: Sensor, Instance: 0
2017-06-24 08:44:26.581 OpenZWave: Value_Added: Node: 14 (0x0e), CommandClass: SENSOR BINARY, Label: Sensor, Instance: 2
2017-06-24 08:44:26.582 OpenZWave: Value_Added: Node: 14 (0x0e), CommandClass: SENSOR BINARY, Label: Sensor, Instance: 3
2017-06-24 08:44:26.582 OpenZWave: Value_Added: Node: 14 (0x0e), CommandClass: SENSOR BINARY, Label: Sensor, Instance: 4
2017-06-24 08:44:26.583 OpenZWave: Value_Added: Node: 14 (0x0e), CommandClass: SENSOR BINARY, Label: Sensor, Instance: 5
2017-06-24 08:44:26.586 Error: /home/pi/domoticz/domoticz() [0x1ccd84]
2017-06-24 08:44:26.586 Error: /home/pi/domoticz/domoticz(_Z14signal_handleri+0x58) [0x1cce3c]
2017-06-24 08:44:26.586 Error: /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer_v2+0) [0x76a6a180]

Cheers,
Manuel

Re: Python plugin: Sonos

Posted: Tuesday 27 June 2017 12:16
by Dnpwwo
@rathmannm,

I'm not sure this is a Python plugin issue because the log shows that the plugin is not loaded.

Code: Select all

2017-06-24 08:44:26.347 Error: (Sonos) failed to load 'plugin.py', Python Path used was ':/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload'.
2017-06-24 08:44:26.347 Error: (Sonos Livingroom) Module Import failed, exception: 'ImportError'
2017-06-24 08:44:26.348 Error: (Sonos Livingroom) Module Import failed: ' Name: plugin'
2017-06-24 08:44:26.525 Error: (Sonos) failed to load 'plugin.py', Python Path used was ':/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload'.
2017-06-24 08:44:26.526 Error: (Sonos Kitchen) Module Import failed, exception: 'ImportError'
2017-06-24 08:44:26.526 Error: (Sonos Kitchen) Module Import failed: ' Name: plugin'
but if you post the exact plugin.py file I can try and 'not load it' as well to see if I can reproduce the issue. I haven't seen import failure cause stability issues previously though.

You could try removing the '_pycache_' folder in the Sonos plugins folder if you have one. I have had issues when upgrading a plugin where Python got a little confused.