I don’t believe we can get entities by integration so you’d need “sonos” in the name of the entity and do something like this:
media_entites = self.get_state("media_player")
sonos_entities = [x for x in media_entities.keys() if "sonos" in x.lower()]
alternatively, get_state() on a domain will return a dict of entities with attributes associated with the entity so you can filter for sonos based on a unique attribute if one is available.
media_entities = self.get_state("media_player")
sonos_entities = [x for x, y in media_entities.items() if y["attributes"]["some_unique_attr"] == "some value"]
Thank you - that gives me access to the media players in App Daemon which is where I was stuck.
As you say identifying the ones I want is now the challenge.
The only way I can find is using [‘attributes’][‘supported_features’] which I suspect isn’t reliable.