Alexa Mediaplayer action and Appdaemon

Hello,
I am using the integration “Alexa Mediaplayer” and in HA Automations it is used like this in Yaml:

> action: notify.alexa_media
> metadata: {}
> data:
>   data:
>     type: announce
>   target:
>     - media_player.wohnzimmer
>     - media_player.buro
>     - media_player.cassian
>   message: "Spülmaschine ist gelaufen "

I can imagine something like this in python

self.call_service(service = "notify.alexa_media", message="Spülmaschine ist gelaufen")

But how to specify the array of targets? A named parameter with array? targets=[a, b, c] ???
How to set the type that is oddly nested under a 2nd data:?
How to deal with the nested data in general?

In HA I can easily copy/paste or use the UI without a deeper understanding but in python I should understand it.
Unfortunately the documentation on call_service() is close to “it exists, guess the rest” while my understanding on HA services is also not sooo advanced.

Any ideas where I can find more information?

Regards Marc

I found out python likes / and behaves more like a path to a service.

self.call_service("notify/alexa_media", message="das ist ein test für service", target="Cassian")

That works ans Alexa talks… that is enough to playaround how to feed in additional options,

HI,
just to avoid that another guy has to reverse engineer this with felt million of tests…
Here a small app that can announce/tts text to alexa and set a volume for the echos.

It took ages to find out that one service expects “target” while the other uses “entity_id” as named variable but both consume an array of strings like media_player.xyz

class HelloWorld(hass.Hass):

  def initialize(self):
    self.data_s = {
    "type": "announce",
    "method": "speak"}

    
    self.target_s =  ["media_player.buro", "media_player.cassian"]
    

 
  def call_out(self, my_text):
   self.call_service("media_player/volume_set", entity_id = self.target_s, volume_level = 0.5)
   self.call_service("notify/alexa_media", message=my_text, target=self.target_s, data = self.data_s)
   self.log("alexa done")