Sonos Announcements- automatically playing songs when paused

Posted on
Tue Jul 30, 2019 6:31 am
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Sonos Announcements- automatically playing songs when paused

Hi all,
Before i kludge a workaround...

Sonos works well for announcements, no problem there.

The problem is: if a zone player is already paused, then if an announcement is made, the zone player automatically plays.

Wife and mother-in-law: displeased “Baby Shark” comes on when the washing machine announcement plays.

Posted on
Tue Jul 30, 2019 6:59 am
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Sonos Announcements- automatically playing songs when pa

I used to see issues like this when the plugin would lose sync with the status of the speakers - basically it would think they were still playing, even when they were paused, and thus after the announcement, when it sets everything back the way it was before, it would set them to playing. I have announcements going all day long and haven't seen this issue myself, so I don't think its necessarily a bug in the code - maybe the plugin is having trouble tracking your sonos states? Intermittent connectivity issues?

I'm also just having the announcements played from the one main zone controller for the zone that contains most of my 1st floor speakers - are you selecting a number of sonos speakers to play the announcement on - maybe there is some issue there?


Sent from my iPad using Tapatalk

Posted on
Tue Jul 30, 2019 12:14 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: Sonos Announcements- automatically playing songs when pa

Thanks for your thoughts, Rapamatic. I really am not sure what’s happening. I have the Sonos plugin issue the speak command to the the Zone Player in my living room, which dictates what is played on the first floor of my house.

I tried a script to check the saved state of the ZP (stored in an Indigo variable), but it did not work, presumably from timing issues.

So- if you have music paused and Sonos does an announcement, the music does not automatically start playing afterwards???

FWIW- using Pandora, after an announcement it skips to the next song (Spotify keeps playing).

Posted on
Tue Jul 30, 2019 12:46 pm
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Sonos Announcements- automatically playing songs when pa

mundmc wrote:
So- if you have music paused and Sonos does an announcement, the music does not automatically start playing afterwards???

FWIW- using Pandora, after an announcement it skips to the next song (Spotify keeps playing).


That’s right. I’d say 95% of the time my system is paused when I play announcements and that has worked without issue for months.

I am mostly using Spotify or Apple Music, so maybe it’s something pandora-specific?


Sent from my iPhone using Tapatalk

Posted on
Wed Jul 31, 2019 10:26 am
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: Sonos Announcements- automatically playing songs when pa

Good theory!
The behaviors are as follows:
Spotify pause- announcement- resume playing
Pandora pause- announcement- next track plays

Now I will check if the behavior differs based on Spotify or Pandora as the source

Posted on
Mon Aug 05, 2019 8:39 pm
aldera offline
User avatar
Posts: 188
Joined: Aug 30, 2016
Location: Michigan, USA

Re: Sonos Announcements- automatically playing songs when pa

As an additional data point, I use Pandora and when it is paused and I make an announcement, Pandora begins playing again. I don't use Spotify. Also, I use the free version of Pandora. I have no idea if that would make any difference.

Ralph

Posted on
Tue Aug 06, 2019 3:13 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: Sonos Announcements- automatically playing songs when pa

aldera wrote:
As an additional data point, I use Pandora and when it is paused and I make an announcement, Pandora begins playing again. I don't use Spotify. Also, I use the free version of Pandora. I have no idea if that would make any difference.

Ralph


Very helpful and likely confirmatory data point!

Posted on
Thu Aug 22, 2019 11:38 am
elov offline
Posts: 20
Joined: Dec 27, 2016

Re: Sonos Announcements- automatically playing songs when pa

I have this issue sometimes as well.

I looked in Sonos.py for the restore state logic after the announcement.
I guess that the two actionDirect functions is necessary, but one might try adding a small self.plugin.sleep(.5) between or just remove the first Play action in the elif PAUSED section.

Code: Select all
                  # restore play state
                  self.plugin.debugLog("%s: Restore Play State: %s" % (state[0], state[5]))
                  if (state[5] == "PLAYING"):
                     self.actionDirect (PA(dev.id), "Play")
                  elif (state[5] == "PAUSED"):
                     self.actionDirect (PA(dev.id), "Play")
                     self.actionDirect (PA(dev.id), "Pause")
                  #else:
                  #   self.actionDirect (PA(dev.id), "Stop")

Posted on
Thu Aug 22, 2019 11:47 am
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: Sonos Announcements- automatically playing songs when pa

elov wrote:
I have this issue sometimes as well.

I looked in Sonos.py for the restore state logic after the announcement.
I guess that the two actionDirect functions is necessary, but one might try adding a small self.plugin.sleep(.5) between or just remove the first Play action in the elif PAUSED section.

Code: Select all
                  # restore play state
                  self.plugin.debugLog("%s: Restore Play State: %s" % (state[0], state[5]))
                  if (state[5] == "PLAYING"):
                     self.actionDirect (PA(dev.id), "Play")
                  elif (state[5] == "PAUSED"):
                     self.actionDirect (PA(dev.id), "Play")
                     self.actionDirect (PA(dev.id), "Pause")
                  #else:
                  #   self.actionDirect (PA(dev.id), "Stop")


Thank you! I will give it a go!

Posted on
Thu Aug 22, 2019 11:53 am
elov offline
Posts: 20
Joined: Dec 27, 2016

Re: Sonos Announcements- automatically playing songs when pa

What happens is that after the state restore the unit is in STOPPED state.
While stopped it cannot be paused, which explains the Play and immediate Pause code.
So adding a small self.plugin.sleep worked in my case.
Removing the Play action caused an UPNP Error: No Such Object.

Code: Select all
 Sonos Debug                     RINCON_949F3E72D75A01400: Restore Play State: PAUSED
   Sonos Debug                     Sonos Action: Play
   Sonos Debug                     zoneIP: 10.2.3.93, soapRoot: /MediaRenderer, soapBranch: /AVTransport, soapAction: Play
   Sonos                           ZonePlayer: Sonos Badrum, Play
Added the 0.5 sec delay here!
   Sonos Debug                     Sonos Action: Pause
   Sonos Debug                     zoneIP: 10.2.3.93, soapRoot: /MediaRenderer, soapBranch: /AVTransport, soapAction: Pause
   Sonos                           ZonePlayer: Sonos Badrum, Pause


Code: Select all
   Sonos Debug                     RINCON_949F3E72D75A01400: Restore Play State: PAUSED
   Sonos Debug                     Sonos Action: Pause
   Sonos Debug                     zoneIP: 10.2.3.93, soapRoot: /MediaRenderer, soapBranch: /AVTransport, soapAction: Pause
   Sonos Error                     UPNP Error: No Such Object
   Sonos Error                     Offending Command -> zoneIP: 10.2.3.93, soapRoot: /MediaRenderer, soapBranch: /AVTransport, soapAction: Pause
   Sonos Debug                     Error Response: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring>UPnPError</faultstring><detail><UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>701</errorCode></UPnPError></detail></s:Fault></s:Body></s:Envelope>
   Sonos                           ZonePlayer: Sonos Badrum, Pause

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests