[APP][Pro] Sonos (LocalAPI)

@xiutit

I think there is a limitation on the number of settings within a certain time, which may be a Sonos thing. Sometimes the switches are synced within a second, and sometimes they indeed take a few minutes (same switches).

Repeat and shuffle settings possible issue not reproducible anymore in v1.6.0

App versie is ineens 1.3 en speakers werken niet meer op APP.

Opnieuw installeren verandert niets.

This topic should stay in English.

v1.3.0 is the Live version. To install v1.6.0 you have to use this link (add /test at the end of the live app):

It seems that when the artist name contains a hyphen (-) the artist name is split across the artist and track tags. See below the example of artist ‘Di-Rect’. Not sure whether this also applies when other special characters are used.

Hi @xiutit !

Slight warning up front: I’m really not sure how difficult this is to implement, so please don’t hate me for suggesting it :sweat_smile: .

In trying to migrate to your app I came to the (admittedly very late) realisation that I’m missing a crucial feature from the older Homey app: group states for every speaker! See:

I am using this to dynamically determine pre-set “states” of where Sonos is playing exactly. For example: when the kids are asleep Sonos can only play downstairs, and a bunch of flows are adjusted based on that specific grouped state.

Just to give you a sense of what this (sorry, it’s a mess) looks like in advanced flow, see:

The groups I’m trying to determine trough the above flow currently are:

  • Downstairs
  • Downstairs + upstairs
  • Downstairs + outside
  • Downstairs + upstairs + outside

I asked ChatGPT and he’s sure there is a way to read speaker grouped states in Home Assistant also, so I’m hopeful it’s at the very least “technically” possible:

Only thing I’m wondering is: what would be the best way to implement this? The older Homey app is a bit weird in that it does not show exactly what each speaker is grouped with, just that it is grouped with an amount of speakers (which makes me have to jump trough some hoops flow-wise). Home Assistant apparently show EXACTLY which speakers are grouped to which speaker.

I’m just spewing out random ideas right now so bear with me but: in an ideal world your app could have some sort of “group function”, where you could predetermine groups based on what speakers should be in it (in the settings or something?), so that whenever the speakers are grouped in a certain way, a tag on the speakers (“grouped to Downstairs” for example?) would turn to “Yes”. This might be totally overkill but I’m just trying to think about the most user-friendly way to go about this.

At the very least an implementation in line with the older Homey Sonos app would be needed for me to switch fully to your app :nerd_face: .

I’d love to hear your feedback on this!

That’s because those stations don’t provide separate artist and track information :sweat_smile:
I’m currently splitting them by a hyphen, but I hadn’t considered this edge case yet.

This information should be available, so I should be able to expose this as a sensor. I will look into this :slight_smile:

3 Likes

Hi xiutit,
I just stumbled across your app and was delighted to find it.
I’m in the process of migrating my apps to the Homey Home Server (SHS).
I’ve had a Sonos API server running on Debian for a while now.
It’s the same Debian server where the Homey SHS is installed.
My old Sonos API is running at: http://192.168.115.29:5005/
Homey SHS is running at: http://192.168.115.29:4859/
Will there be any problems if I install your Sonos app on the SHS?
Currently, the Sonos AFlows are still running with a link on port 5005.
Or would it be better to install your app only after I’ve also migrated the old AFlows to the SHS?
Cheers

It should work just fine, but we’ve seen that Sonos speakers can get a bit “overwhelmed” when multiple apps are sending commands and requesting data at the same time.

Ideally you’d end up using just one app, but for testing purposes this shouldn’t cause any issues.

Is it possible to remove the toggle selection and instead have a single panel with four buttons? I’d like it to look similar to the screen with two buttons, but showing four buttons and no selection box.

1 Like

Okay,
when the time comes, I’ll stop the old API service.
I miss the playlist feature. :wink:

In v1.7.0 I have added a sensor that shows the group members. Can you try it out?

Play (Playlist) is added in v1.7.0

3 Likes

Oh, you’re fast! :+1:t2: :wink:

Nothing big but if two speakers are group only the main will be detected by the discovery API.

Wow, nice!

First impressions: way more usable for my flows than the older Homey Sonos app, that’s for sure, thank you! I’m still building flows with it so I’ll let you know if I come across any issues.

One thing that I already see now is that I’m missing a trigger, like you added for audio output format:

Would be super handy for Sonos group related flows to be able to use a “Groepsleden gewijzigd” trigger (if at all possible to implement) to verify instantly if the speaker grouping has changed.

Thanks again for the very fast updates!

I would like to come back to this topic again. node-sonos should be able to handle grouping for S1 and S2, but you can’t mix them. Would it be possible to implement grouping for S1 devices as well?

Is it possible to make dropdowns like the Sonos cards “Play Favorite” and “Play Playlist” dynamic, so that the list name is provided as a tag?

Case: I’d like to use the Sonos app to select one of dozens of lists to play. The list name is provided via a webhook.

is this possible @xiutit ?

Thank you :raising_hands:

The speaker_playing capability reacts differently on the Sonos Playbar than on the Era 100.
In Homey Development Tools:

  • Playbar: set speaker_playing from true to false; after 1 second of play, it returns to false.
  • Era 100: works as expected.

This does work for the Playbar in the official Sonos app.

Similar experience with the “play favorite” and “play playlist” cards. Has anyone had a similar experience with the Playbar, which is a bit older device, but doesn’t react the same as a newer Sonos device? How to solve (except “use the official app”)?

Not sure whether I understand you correctly. I assume you are talking about this capability:

I also have ‘older’ Sonos speakers. When I start playing music on my system that includes the Playbar (via flowcard, speaker widget or the device tile) the value changes from false to true and v.v. when I pause playback.

If I use the SET button in Developer Tools, and set it to false then playback pauses (and remains paused). If i then set it to true, then my Playbar starts playing again.

I did note that, at least for radio stations, when I start playback the value changes to true, it then loads the steam, the value changes briefly to false and when the stream actually starts playing it changes back to true again.

Yes, that’s what I mean. Thanks for testing.

How to reproduce: Use the Sonos (LocalAPI) Play Favorite card in the advanced flow and start/execute this card. If Sonos was already playing another favorite, the new favorite will be loaded on the Playbar but not played. If Sonos wasn’t playing yet, the new favorite will be applied and played.
Pausing works fine (in Developer Tools, as a card, and in the app player interface (under album art), but restarting playback afterward is impossible.