[Sonos] just forgets it's playing

I’m running homey version 5.0.2 and 6.0.9 of the Sonos app. I believe those are the latest.

I have created a virtual radio device based on the virtual devices app. I’m turning this on based on motion in my living. It sends a Sonos favorite (TuneIn Radio) to the Sonos Beam connected to the TV. This works great.

I have added some exceptions in the ‘and’ column. I don’t want the radio turning on when the TV is turned on or when something else is playing on the Beam, like for example Spotify. Again, this works. To be clear, I only want the virtual radio turning on when nothing else is happening on my beam or TV.

For the flow please see: Gedeelde Flow | Homey

Now as I mentioned, it works and works well, but after a while, and I cant really tell you guys the time frame, sometimes after half an hour, sometimes after an hour it just forgets something is playing.
My wife puts on her spotify playlist during cleaning and complains about it. After investigating the card ‘sonos is not playing’ just doesn’t work anymore.

So when testing I’m playing spotify on the beam. Directly after putting on the play list I run the test button with the mentioned flow. Then it doesn’t execute the flow because of the ‘is not playing’ sonos card.
After let’s say half an hour I repeat my steps, but even though it is still playing from the spotify list, it executes the flow because it just ignores the ‘is not playing’.

Anyone else experiences the same behavior?

As i remember i had the same experience. I was not able to get the flow working correctly because the app forgets when sonos is playing or not. I solved it by adding a smart plug on my playbar. With a flow it tests if my playbar is on or off.

After i deleted the Sonos app and started using the Sonos api on my server I didn’t check if the status playing on or off works better as with the Sonos app. But the Sonos api works far better as the Sonos app for me…

Right, that’s a good option too. Which api command do you use to check if it is playing or not?

That probably would be http://IP:5005/woonkamer/state

That shows:

{"volume":12,"mute":false,"equalizer":{"bass":0,"treble":0,"loudness":true,"speechEnhancement":false,"nightMode":false},"currentTrack":{"artist":"Rolf Sanchez","title":"Ven Ven","album":"Ven Ven","albumArtUri":"https://i.scdn.co/image/ab67616d0000b2731c3d8892f6977a48ba44fe13","duration":151,"uri":"x-sonos-spotify:spotify:track:4RhyJbkk0pEKMmrq8fqZUN?sid=9&flags=0&sn=1","trackUri":"x-sonos-spotify:spotify:track:4RhyJbkk0pEKMmrq8fqZUN?sid=9&flags=0&sn=1","type":"track","stationName":"","absoluteAlbumArtUri":"https://i.scdn.co/image/ab67616d0000b2731c3d8892f6977a48ba44fe13"},"nextTrack":{"artist":"Artistic Raw","title":"Komen & Gaan","album":"Komen & Gaan","duration":0},"trackNo":1,"elapsedTime":83,"elapsedTimeFormatted":"00:01:23","playbackState":"PLAYING","playMode":{"repeat":"none","shuffle":true,"crossfade":false},"sub":{"gain":3,"crossover":0,"polarity":1,"enabled":true}}

"playbackState":"PLAYING"

How do I extract this? I’d assume http get flow card, but how to only check for playbackstate?

Yourlocalip:5005/woonkamer/state
And ofcourse in your case use playbackstate

1 Like

I don’t have that with the ‘and’ column:

What do I have to enter? You have three fields, this one has more.

these are the options on the ‘and’ field:

I use it at the then part and store it into a better Logic variable. After that you can use it for your AND part

You have to check if this works ok, because i still use the smartplug which does the trick perfect for me, and as bonus a repeater on that position.

The thing is , I want to check fi the player is playing at that moment. Have to think about it a little bit more I guess.

I’m aleady using a powerplug. And that works really well for my TV but not for the beam. I have my beam plugged in together with a sub and two Play:1 speakers. (the wii and ps5 are on there too) and in standby with not playing anything they consume 42 watt. With spotify turned on it consumes 43. I think this is too small a margin.

I only have a plug for the playbar. It works with less then 7Watt(= off) and > 8 Watt= on. I also have the sub, two Play3 and one Play1 in the same group. But the Playbar is leading in the group. So therefore a plug for the playbar

Maybe that’s an option if I cannot get this working. Thanks a lot for your help!

:+1:

If u wanna check if the speaker is playing:

If u wanna check if the speaker is NOT playing:
Invert the card. :wink:

1 Like

Did you tried the logic card with „is playing“ / „is not playing“ in the „And…“ section instead of the build in feature of the Sonos App?

Maybe you can make a small flow which is checking the state of the „is/is not playing tag“. If the tag changes from „is“ to „is not“, or the other way“, let inform you via voice, timeline, push notification.

If these tags originate from the sonos app i’d guess they would have the same issue. I now have @Rocodamelshekima solution running. I’m gonna test for a while with this to see if it is actually the sonos app or maybe the speakers reporting something else.

Yes, it´s the same. The logic card with the tag is also buggy. I contacted Athom.

1 Like

@Martijn_Hoogenbosch, Athoms answer: The bug is known and will be fixed in the next release.

Oh great! The http query to my http-api works great too, but solving it with a native app is great!

I assume they mean with a next release of the Sonos app, right?

Yes, release of the Sonos app. But I have to correct myself a little bit: “they hope it will be fixed”.

1 Like