home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.6k stars 29.92k forks source link

Amazon Polly not working #27520

Closed jcuccia closed 4 years ago

jcuccia commented 4 years ago

Home Assistant release with the issue: 0.100.1

Last working Home Assistant release (if known): 0.99.3

Operating environment (Hass.io/Docker/Windows/etc.): NUC/Ubuntu18.04/DockerCE

Integration: Amazon Polly https://www.home-assistant.io/integrations/amazon_polly/

Description of problem: tts.amazon_polly_say does not work. It logs errors.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

tts:
 - platform: amazon_polly
   aws_access_key_id: !secret aws_access_key_id 
   aws_secret_access_key: !secret aws_secret_access_key
   region_name: us-east-2
   text_type: ssml
   voice: Joanna  

Traceback (if applicable):

2019-10-11 13:13:06 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.139666141482768] Parameter validation failed:
Unknown parameter in input: "Engine", must be one of: LexiconNames, OutputFormat, SampleRate, SpeechMarkTypes, Text, TextType, VoiceId, LanguageCode
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 133, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1233, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1258, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 152, in async_say_handle
    p_type, message, cache=cache, language=language, options=options
  File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 326, in async_get_url
    engine, key, message, use_cache, language, options
  File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 337, in async_get_tts_audio
    extension, data = await provider.async_get_tts_audio(message, language, options)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/amazon_polly/tts.py", line 238, in get_tts_audio
    VoiceId=voice_id,
  File "/usr/local/lib/python3.7/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python3.7/site-packages/botocore/client.py", line 634, in _make_api_call
    api_params, operation_model, context=request_context)
  File "/usr/local/lib/python3.7/site-packages/botocore/client.py", line 682, in _convert_to_request_dict
    api_params, operation_model)
  File "/usr/local/lib/python3.7/site-packages/botocore/validate.py", line 297, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Unknown parameter in input: "Engine", must be one of: LexiconNames, OutputFormat, SampleRate, SpeechMarkTypes, Text, TextType, VoiceId, LanguageCode

Additional information: I tried with engine: neural in the tts: config section, but that did not make any difference. I have reverted to version 0.99.3 and the Polly integration is working again.

pums12 commented 4 years ago

Having exactly the same problem here.

`tts:

probot-home-assistant[bot] commented 4 years ago

Hey there @robbiet480, mind taking a look at this issue as its been labeled with a integration (amazon_polly) you are listed as a codeowner for? Thanks!

Coch commented 4 years ago

Error message appears in 0.100.1 regardless of whether you have 'engine' defined in your configuration or not...I get the exact same error with it defined as 'engine: neural' and with that line commented out.

(Appreciating this has been said - I guess this is my way of saying 'me too')

jcuccia commented 4 years ago

@bbrendon did the last update to this component, adding neural engine support. It worked before that.

Brendon, if you're listening, can you please take a look?

jcuccia commented 4 years ago

This is the same issue as reported in https://github.com/home-assistant/home-assistant/issues/27418

Can the issues be combined?

bbrendon commented 4 years ago

I can't test your issue because of secrets but these are the supported regions. Are you using one of them?

US East (N. Virginia): us-east-1 US West (Oregon): us-west-2 EU (Ireland): eu-west-1

Also @pums12 Nicole is not a supported voice for Neural.

Coch commented 4 years ago

Have tried by hard coding to us-east-1 with the same result.

Though it’s no longer working even without neural...

Coch commented 4 years ago

And yes, this appears to be the same as 27418...though arguably if Polly isn’t working at all, it’s hard to tell if neural is working too ;)

pums12 commented 4 years ago

@bbrendon thanks, I added the "engine: neural" line whilst trying to get it working again.

Prior to the upgrade to 0.100.1, my working configuration was:

I have also just tried:

but am still getting the same error "Unknown parameter in input: "Engine", must be one of: LexiconNames, OutputFormat, SampleRate, SpeechMarkTypes, Text, TextType, VoiceId, LanguageCode"

pums12 commented 4 years ago

@Coch I have changed back to the standard engine so should be working ok with Nicole but am still getting the same error.

bbrendon commented 4 years ago

See the other issue on this for details. The problem is figured out. Solution unknown.

pums12 commented 4 years ago

As a temporary solution, I have added amazon_polly as a custom component and edited tts.py replacing:

resp = self.client.synthesize_speech( Engine=self.config[CONF_ENGINE], OutputFormat=self.config[CONF_OUTPUT_FORMAT], SampleRate=self.config[CONF_SAMPLE_RATE], Text=message, TextType=self.config[CONF_TEXT_TYPE], VoiceId=voice_id, )

with: resp = self.client.synthesize_speech( OutputFormat=self.config[CONF_OUTPUT_FORMAT], SampleRate=self.config[CONF_SAMPLE_RATE], Text=message, TextType=self.config[CONF_TEXT_TYPE], VoiceId=voice_id, )

This gets it working again but only when using the 'standard' engine.

llluis commented 4 years ago

Same issue here. Using pt-br voice.

- platform: amazon_polly
  aws_access_key_id: !secret
  aws_secret_access_key: !secret
  voice: "Vitoria"
  cache: true
  engine: 'standard'

My config didn't have "engine" before. I added now to try to solve the issue but, no change.

jcuccia commented 4 years ago

Closing this duplicate issue. See https://github.com/home-assistant/home-assistant/issues/27418 for updates.