Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group Control: Publishing and Playbackinfo #110

Closed
87insane opened this issue Jun 30, 2020 · 8 comments
Closed

Group Control: Publishing and Playbackinfo #110

87insane opened this issue Jun 30, 2020 · 8 comments

Comments

@87insane
Copy link

87insane commented Jun 30, 2020

Hello Stephan,

I'm trying to build a player for FHEM.
I came across the topic of groups.

Whenever a group consists of several players, there is a master. The problem is that the slaves no longer receive status updates and always think they are still playing music. You only get status updates from the slaves within a group if you e.g. the volume changes. But even then "PLAYING" is also broadcast in the payload. Even if no more music is played.
If the slave leaves the group, it is immediately correct again.

It would be good if slaves in a group would get the information from the master.

Attached a picture. In this you can clearly see what I mean. (I hope)
This is a graphical representation of payload.

Sorry for my english!
fhem_group_control

@svrooij
Copy link
Owner

svrooij commented Jun 30, 2020

Hi @87insane this is not a new issue, see #62

I don’t really have a solution for this issue, any good ideas will be accepted.
The status is just returned from the speaker, no modification on it. Actually a single child player is “playing” the stream of the main speaker (called coordinator).

Maybe you can display some other status on the player if the coordinatorUuid is different then the uuid, in the player status. Because if it has a coordinator UUID that isn’t itself, it is for sure grouped and not playing by itself.

@87insane
Copy link
Author

87insane commented Jul 1, 2020

Goedemorgen Stephan,

I am currently comparing "name" and "groupName". If name eq groupName, then NO group. If not then it's a group. The first word in the group name is always the master. e.g. Living room + 2 = group and living room is the master.

Is there such a comparison in your module? If so, one could provide the slaves / children within a group with a copy of the master data.

The playback status would suffice for me. But there may be people who want more, e.g. Track etc.

Of course, I can also convert the player and just refer to the master / coordinator. I use the group function very often and would like it to be "better". Is the idea above an option?

Greetings,
Kai

@svrooij
Copy link
Owner

svrooij commented Jul 1, 2020

The used sonos library knows if a player is a member player or a coordinator, so that part is easy.

But the events are a different thing, they are separated per service per speaker, then at speaker level the events from the RenderingControlService and the AVTransportService are also emitted as events for the speaker.

If you want the speaker to also emit events based on events from the coordinator, each speaker in a group would have to subscribe to the events from the coordinator once joined in the group. And those events would be duplicates of the events of the coordinator. The coordinator data is available at sonos/player_uuid if you would take the coordinatorUuid from the response of the player, not sure how that works in FHEM.

  1. Listen for all players, subscribe to: sonos/+.
  2. For each player you display the regular status, unless the coordinatorUuid != uuid.
  3. Then you take the data from sonos/coordinatorUuid.

Of even better

  1. Listen for all players, subscribe to: sonos/+.
  2. Use the speaker name and volume from the player status and the playback data from
    sonos/coordinatorUuid where you fill in the correct uuid that you got from the device data.
    Also for single players this is correct because the coordinatorUuid will be itself.

This is a pretty substantial change for which I have no time for at the moment. I would like to spend more time on Home Automation stuff, but time is somewhat limited right now. So if you want to give it a go, feel free to submit a PR 😉

I can imagine that it would also be possible to clear the track data, if it receives a coordinator update, that would be a much smaller change.

@viimD
Copy link

viimD commented Jan 30, 2021

I'm also struggling with this issue. I figured out how to start for example Radio 3FM on my speakers. I do this by sending this message to the coördinator speaker 'wittekast keuken' (sonos/wittekast-keuken/control):
{ "command": "setavtransporturi",
"input": "radio:s6707?sid=254&flags=32"}

This works fine, both the speaker 'wittekast keuken' and 'keuken' (which are in the same group), play 3FM. However, when I want to increase the volume of both speakers it does not work. I send the following message also to the coördinator speaker 'wittekast keuken' (sonos/wittekast-keuken/control):
{ "command": "volumeup",
"input": 5}

Now only the volume of the 'wittekast keuken' is raised by 5. The volume of the member 'keuken' remains unchanged. Do I miss something somewhere?

@svrooij
Copy link
Owner

svrooij commented Jan 31, 2021

@viimD you issue is unrelated to the above. Volume is per speaker, but some commands are automatically redirected to the group coordinator.

svrooij added a commit to svrooij/node-sonos-ts that referenced this issue Sep 24, 2021
svrooij added a commit that referenced this issue Sep 24, 2021
@github-actions
Copy link

🎉 This issue has been resolved in version 3.2.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@svrooij
Copy link
Owner

svrooij commented Sep 24, 2021

@87insane you had to wait for this one quite long. I've now added 2 extra transport states, GROUP_PLAYING and GROUP_STOPPED that are emitted for all players in the group. So if the player has one of these you should hide the track info and disable the controls. But you can still display whether or not it's playing music at the moment.

@svrooij svrooij closed this as completed Jan 8, 2022
@github-actions
Copy link

🎉 This issue has been resolved in version 3.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants