Add and remove media player from group

Is there a way to add or remove a media_player from a group ?

Yes

1 Like

so I want to use an if else in a script. so when an input boolean is on, I want to add a mediaplayer to a group, if off I want it removed…
but it looks like I cannot check in the script if the mediaplayer is already in the group…

Yes you can. Look at the attributes of the grouped media player. I made a group to test. It is called media_player.mgroup. it’s attributes are

entity_id:
  - media_player.bedroom
  - media_player.kitchen
friendly_name: Mgroup
supported_features: 2160575

As you can see the members are shown as a list.

ok, I will check it tonight

this is really cool !

1 Like