Invalid_format: expected a dictionary for dictionary

Hello,
I ran a notification framework for a while that pushed TTS text to alexa_mediaplayer integration.

Beside version upgrades for Appdaemon, mediaplayer and HA I have not changed the code in a while. Unfortunately Alexa lost the voice :wink:

WARNING HASS: Error with websocket result: invalid_format: expected a dictionary for dictionary value @ data['target']. Got ['media_player.buro', 'media_player.buro']

I can still enforce TTS by executing action in developer tools of HA:

action: notify.alexa_media
data:
  message: Das ist ein Test, hört ihr das?
  target:
    - media_player.buro
    - media_player.cassian
  data:
    type: announce
    method: speak

And for best of my knowledge target is an array …

Therefore my test code is using array as well

import appdaemon.plugins.hass.hassapi as hass
class Tester(hass.Hass):
  def initialize(self):
    #define a data dict to enforce notofication bell sound
    self.alexa_service_data = {
            "type": "announce",
            "method": "speak"}
    #define an array with two alexas
    self.my_target =["media_player.buro", "media_player.buro"]  
    #call the service similar to what the developer tools do:
    self.call_service("notify/alexa_media", message='Test', target= self.my_target , data = self.alexa_service_data)       
                  

I have no idea what goes wrong and I still think array is correct data type.
I guess it is not alexa media player because the developer tools can execute the action.
I am more or less sure my python is correct and worked before with same parameter setting…

the home Assistant Event log is not logging the service_call as it is aborted to early…

Any ideas? How shall i push a dict where everything points to an arry eben the docu:
Alexa Media player

Regards Marc

self.my_target ={'entity_id':["media_player.buro", "media_player.buro"]}

if you use my_target elsewhere, this would probably be more safe

import appdaemon.plugins.hass.hassapi as hass
class Tester(hass.Hass):
  def initialize(self):
    #define a data dict to enforce notofication bell sound
    self.alexa_service_data = {
            "type": "announce",
            "method": "speak"}
    #define an array with two alexas
    self.my_target =["media_player.buro", "media_player.buro"]  
    #call the service similar to what the developer tools do:
    self.call_service("notify/alexa_media", message='Test', target= {'entity_id': self.my_target} , data = self.alexa_service_data) 

HI,
thx for having a look but I fear its not working.

WARNING HASS: Error with websocket result: invalid_format: extra keys not allowed @ data['entity_id']

well, it looks like appdeamon decided to make their own call_service func

import appdaemon.plugins.hass.hassapi as hass
class Tester(hass.Hass):
  def initialize(self):
    #define a data dict to enforce notofication bell sound
    self.alexa_service_data = {
            "type": "announce",
            "method": "speak"}
    #define an array with two alexas
    self.my_target =["media_player.buro", "media_player.buro"]  
    #call the service similar to what the developer tools do:
    self.call_service("notify/alexa_media", message='Test', entity_id=self.my_target , data = self.alexa_service_data)
WARNING HASS: Error with websocket result: invalid_format: extra keys not allowed @ data['entity_id']

What makes sense as the developer UI yaml looks like this and wants target…

action: notify.alexa_media
data:
  message: Das ist ein Test, hört ihr das?
  target:
    - media_player.buro
    - media_player.cassian
  data:
    type: announce
    method: speak

I reverted to the older appdaemon version and tried the test code: runs.
I think it is a bug so I opened a ticket in github

https://github.com/hassio-addons/addon-appdaemon/issues/391

then that means target would go inside data as a dict.

self.call_service("notify/alexa_media", data={'message': 'Test', 'target':self.my_target , 'data': self.alexa_service_data})

Because this

data:
  message: Das ist ein Test, hört ihr das?
  target:
    - media_player.buro
    - media_player.cassian
  data:
    type: announce
    method: speak

is your service data, not

  data:
    type: announce
    method: speak