Media_player entity doesn't turn off when calling service "homeassistant.turn_off" on group

Hello all,

I’ve grouped my switches, lights and media_player in groups which represent rooms. When I call the service homeassistant.turn_off on a group which includes lights and a media_player, the lights are turned off but the media_player isn’t.

I would’ve expected that the media_player is turned off too. When I call the service on the media_player directly it works.

Is there a reason why calling homeassistant.turn_off on a group doesn’t call turn_off on all included entities?

What media player is it? homeassistant.turn_off attempts to call any domains turn_off service on the entity in question, if the service doesn’t exist, it will fail. I would wager that this is an issue with the specific media_player you have integrated. If that’s the case, you’d need to raise an issue with the media player to properly register for the service or have it be included with the supported features.

In the meantime, just make a script.

Hi petro,

thank you for your answer! After checking the configuration file again, I found the error. It was a typo :frowning:. The media_player is from the “Logitech Squeezebox” integration and the player is called “Küche” (‘kitchen’ in english). I thought the entity is named “media_player.kueche”, which is how “Küche” is spelled when you can’t use umlauts. But the entity is called “media_player.kuche”, that’s why it didn’t work.

Sorry for wasting your time, but maybe you could help me with another question:

When the media_player is “on” (and is playing music), the state of the group is still “off”. Is there a way to configure the group that its state is “on” when the media_player’s state is “on”?

Look at your group config.
A group can either be “on” when all devices are “on” or it can be “on” when at least one device is “on”. This is set in the group definition.

My groups are using the default behaviour currently. But it only works with light or switch entities, not with media_player.

I just saw in the developer tools that the state is “playing” and not “on” when the media_player is playing something. Maybe this is the culprint?

Yes, that’s the “issue”. It will only show “on”, if at least one device of the group is in state “on”, but as you noticed, media_players don’t have a state “on”.

Strange all my media players, Alexa, TVs etc all have an on and off state

Ok, strange, don’t they show “playing” or “idle” in Developer Tools -> States? Probably it depends on the media_player integration.

I checked my “kodi” and “Logitech Squeezebox” media_player entities and they are either off, idle or playing.

No, groups will only do this with specific domains. Media_player is not one of those domains.

You should investigate template switches. They will give you what you desire but you’ll need to learn templating.

Thank you Petro, I will check template switches.