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
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
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)
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)