Does anyone have a working example of a TTS with Amazon Polly? The component page just shows the setup of the component but not how to send to a speaker. I have Google TTS working fine but using the service tts.amazon_polly_say doesn’t seem to work. Not sure what I’m supposed to use.
Specify a media_player
entity. Your media_player
must support the play_media
function.
This is what I have and it is not working. Works fine with Google TTS
script:
test_announce:
sequence:
- service: media_player.sonos_snapshot
data_template:
entity_id: "media_player.living_room"
- service: tts.amazon_polly_say
data_template:
entity_id: "media_player.living_room"
message: 'Hello World'
- delay: '00:00:{{ states.media_player.living_room.attributes.media_duration | int }}'
- service: media_player.sonos_restore
data_template:
entity_id: "media_player.living_room"
Are you able to play the file produced by Polly, in general?
No, not sure how to even do it.
Check to see if files are being created in the cache directory. Any reason you are switching from google to Polly?
Figured it out. Didn’t have quotes around my secret keys. The reason I wanted to switch was the voice sounds much more realistic imo.
Hey, my config works with google_say, but when I tried switching to Polly I get the following error, any idea’s?
2017-07-28 10:35:33 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
result = coro.throw(exc)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/core.py", line 1023, in _event_to_service_call
yield from service_handler.func(service_call)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/tts/__init__.py", line 140, in async_say_handle
options=options
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/tts/__init__.py", line 310, in async_get_url
engine, key, message, use_cache, language, options)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/tts/__init__.py", line 324, in async_get_tts_audio
message, language, options)
File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
raise self._exception
File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/tts/amazon_polly.py", line 177, in get_tts_audio
VoiceId=voice_id
File "/srv/homeassistant/lib/python3.4/site-packages/botocore/client.py", line 251, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/srv/homeassistant/lib/python3.4/site-packages/botocore/client.py", line 537, in _make_api_call
raise ClientError(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidSsmlException) when calling the SynthesizeSpeech operation: Invalid SSML request
You have SSML set. You need to remove that from the config. Otherwise you need to wrap ALL text in tags.
Invalid SSML request
Nailed it!, thanks.
Are you using Lexicons with Polly, I would like to soften up the voice a little, any idea how I would implement that?
I started using it but then ditched it… it wa too much work for too little payoff for me. But SSML is the way to go if you want to start messing with inflection and speed.
looking at that now.
Is “lang xml:lang=“en-US”” the same as the default Joanna voice?
Not Sure but I use the default Joanna voice. She sounds the closest to the Alexa Voice.
Thanks, I think I will stick with that for now, can’t figure out where or how to implement the SSML Tags.
That is the region name to change the voice see this:
For messing with SSML I use the AWS site and documentation
http://docs.aws.amazon.com/polly/latest/dg/supported-ssml.html
That way I can play with how it will sound prior to getting it into HA.
Not trying to change voice per say, but make it a little more subtle.
Thanks.
Been reading since, but still not sure where/how to implement it.
When I add the tags to my automation message, the tags get spoken as well.
Thanks.
Did you turn ssml back on in configuration?