kalkih / mini-media-player

Minimalistic media card for Home Assistant Lovelace UI
MIT License
1.51k stars 206 forks source link

Added support for the new default grouping functionality #525

Closed micha91 closed 3 years ago

micha91 commented 3 years ago

HA has defined a new service schema for join and unjoin in the media_player component. Future (official) integrations will use these services instead of implementing join/unjoin in their domain. To enable using these base services, the platform has to be set to media_player in the cards config, so that it offers full backward compatibility.

This was already requested in #519 and will also be needed in the future for other integrations (such as the rewritten official musiccast integration).

sprocket-9 commented 3 years ago

The default for MMP is that platforms do support the concept of a speaker group master and will use this.group[0] (this.attr.group_members[0] in media_players case) as the master entity.

For a custom integration that wants to use the base media_player.join/unjoin services that does not support the group master concept, if this.attr.group_members[0] doesn't match the entity for the card, the card stops working as expected.

One platform already overrides this https://github.com/kalkih/mini-media-player/blob/master/src/model.js#L213 setting but to allow platforms using these new services to work with MMP without modification, the supportsMaster() check would be better as a card yaml configuration option like supports_group_master: bool .

micha91 commented 3 years ago

The default for MMP is that platforms do support the concept of a speaker group master and will use this.group[0] (this.attr.group_members[0] in media_players case) as the master entity.

For a custom integration that wants to use the base media_player.join/unjoin services that does not support the group master concept, if this.attr.group_members[0] doesn't match the entity for the card, the card stops working as expected.

One platform already overrides this https://github.com/kalkih/mini-media-player/blob/master/src/model.js#L213 setting but to allow platforms using these new services to work with MMP without modification, the supportsMaster() check would be better as a card yaml configuration option like supports_group_master: bool .

Good point, didn't think about that - I implemented it, but as I do not have any system that does not support masters, I can not check, whether it works as expected. But from what I can see, there is no difference between the devices of a group anymore when I set supports_master: true in the speaker group section, so we should be all good.

kalkih commented 3 years ago

Thanks, that's great. Good idea with the configurable supports_master config as well!