Functionality of old style media player groups - did something change?

Until very recently, this worked just fine:

action: notify.alexa_media
data:
  message: this is a test
  target: group.all_room_occupancy_echos
  data:
    type: announce
    method: all

The group.all_room_occupancy_echos entity is a nested group that is set dynamically using group.set service and contains the entity of every echo device that is located in an occupied room. Nothing about this process has changed and I can confirm is working properly. When a room becomes occupied or unoccupied, the group.set service is called and the group.all_room_occupancy_echos entity is created.

This has been working fine for years. Recently - within the past week or two - notify.alexa_media will not work where the target is a dynamically created nested group. There are no error messages in the automation trace logs. There are no errors in the system logs.

Directly targeting a singular media_player.echo_device works fine. I have also manually created a helper (the “new” style group) containing several echo media players and that works fine as well. An obvious solution would be to just start dynamically creating groups with the media_player domain instead of the group domain, but I have found no way to accomplish this as ‘group.set’ only creates groups with the group domain.

Trying to find a solution to this recent problem.

Fix:

action: notify.alexa_media
data:
  message: this is a test
  target: "{{ expand('group.all_room_occupancy_echos') | map(attribute='entity_id') | list }}"
  data:
    type: announce
    method: all

Instead of targeting the group directly, expanding the list of entity IDs in a template seems to have resolved this niche issue. If anyone knows the cause in the change to the group domain functionality please share, I would still like to understand better what happened.

There’s no reason to expand the whole state object, you can just use state_attr:

{{ state_attr('group.all_room_occupancy_echos','entity_id') }}

1 Like

group.all_room_occupancy_echos is a nested group with other groups contained as the entities (each room has it’s own group, if that makes sense). So in my scenario I would need to dig down past the initial group.all_room_occupancy_echos to the groups that hold the actual entities. I tried your suggestion but it looks like it just gives me the next grouping layer without getting down to the media_player entities.

1 Like

I think I must have missed the “nested” part from your original post… :man_facepalming:

I can’t say that I ever tried targeting a group entity for notify.alexa_media before, but it doesn’t seem to be working at all. Even simple groups of media_player entities. This might be a use case for a Template Media Player, if that was an option, but it’s probably a ways off.

Until then, one option would be to use Labels instead of groups. Franck has added label management actions in the Spook custom integration so you can build groupings via labels programmatically, like you are currently doing with group.set. You would still need to template the target since the action doesn’t fully support target objects.

action: notify.alexa_media
data:
  message: this is a test
  target: "{{ label_entities('all_room_occupancy_echos') }}"
  data:
    type: announce
    method: all
2 Likes

I probably could have made it easier to understand :laughing:. But yes, I have been targeting this nested group for years without any problems until now. Just an odd change in functionality. In any event, thanks for your input. Expanding the group seems like the easiest fix for now but I will take a look at your suggestions, it looks interesting. This post contains additional details about how I have this working if anyone is interested.

Just updated my AMP integration. While I don’t use the notify group functionality, I did spot this in the v5.15.1 release notes.

Depending on your AMP version, I suspect this is either the cause of your issue or the thing that fixes it.

2 Likes

Good find @ShadowFist, that looks like it is exactly the issue. Thank you. I have reported the issue here.

1 Like

I thought I was going crazy until I found this thread. I have used AMP for years and always used ‘target: group.echos’ which is all my echos excluding the kids room echos, so I can always announce against that group without waking the kids. Just stopped working a few days ago