Thanks for all your effort, this new implementation works great for me!
One thing annoyed me though:
If you stop playback, either via the plugin or via another controller, it actually pauses. There's nothing you can do about that, that is just how Sonos is designed. However, in the paused state, the plugin keeps flooding the log with "Paused" messages, every update interval (which is 5 seconds in my case). The log page of the Sonos state device is also many pages long, almost completely filled with "Paused" states. This makes the Domoticz database unnecessarily large.
I also start a timer after I stop (pause) my Sonos Connect, which switches off the amplifier after a few minutes. But this timer was restarted every 5 seconds, because the paused state was constantly updated.
I now created a workaround, by changing a few lines in your Python code starting from line 392:
Code: Select all
# if CurrentTransportState == 'PAUSED_PLAYBACK': # self.playerState = 2 # self.mediaDescription = 'Paused' # UpdateDevice(1, 1, self.mediaDescription) if CurrentTransportState == 'STOPPED' or CurrentTransportState == 'PAUSED_PLAYBACK':