I have this radio add on, but when I try it says that text to speech isn’t available. Is there a fix?
I just tried sending something to my alexa. It said the media player alexa tts service is needed. What is that and where do I get it?
Via the UI (the Text to speech.) does not work. You have to call the service. Read up a few posts or the top post to see how to do that. It’s pretty easy once you do it the first time.
Did anything change recently? I still get the captcha, but it never shows the alexa media player after I enter it (used to work last week).
This is excellent. In the UK, without MFA though. Good job @keatontaylor
Took a few mins to setup but I’ve simply done this:
- Download alexa.py from https://github.com/keatontaylor/custom_components/blob/master/media_player/alexa.py
- I’m using HA on an Orange Pi in a virtual environment, so created the folders custom_components/media_player under home/homeassistant/.homeassistant and copied the file there (using 0.9.1)
- Added the code to my configuration.yaml file (no quotes used for secret values in my secrets.yaml file):
media_player:
- platform: alexa
email: !secret amazon_username
password: !secret amazon_password
url: “amazon.co.uk”
- Created an entry in my automations.yaml file as follows:
- service: media_player.alexa_tts
data_template:
entity_id: media_player.echo_dot
message: “Hello World”
Works great!
Awesome. This is going to be fun.
I’ve noticed, as I think others have mentioned, that unless the echo’s are playing something as HA starts up, they will not be able to be controlled from HA (at least from the media player card)
Is it possible to send a mp3 file as TTS?
Via the UI, the services tab, choose media_player.alexa_tts
:
No.1. This works:
{“entity_id”:“media_player.batman”,“message”:"Hello motherfucka’ "}
No.2. This does not work:
{“entity_id”:“media_player.batman”,“message”:“The outside temperature is {{states (‘sensor.dark_sky_apparent_temperature’) }} degrees”}
… in case No.2 Alexa just reads out loud: … " - The outside temperature is states sensor dark sky apparent temperature degrees "…
… in case No.2 you have to put that in a script and call that script, then it will tell you the value of the temperature.
… at least for me, that’s how it stands for now.
Hi
Can someone help me get this working? I have this error when I restart HA after following the instructions above;
Log Details (ERROR)
Sun Aug 19 2018 20:00:53 GMT+1200 (New Zealand Standard Time)
Testing configuration at /config
ERROR:homeassistant.scripts.check_config:BURB
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/scripts/check_config.py", line 207, in check
res['components'] = check_ha_config_file(hass)
File "/usr/local/lib/python3.6/site-packages/homeassistant/scripts/check_config.py", line 372, in check_ha_config_file
platform = loader.get_platform(hass, domain, p_name)
File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 58, in get_platform
return get_component(hass, PLATFORM_FORMAT.format(domain, platform))
File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 86, in get_component
module = importlib.import_module(path)
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 674, in exec_module
File "<frozen importlib._bootstrap_external>", line 781, in get_code
File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/config/custom_components/media_player/alexa.py", line 93
if failed_login:
^
IndentationError: unexpected indent
Fatal error while loading config: unexpected indent (alexa.py, line 93)
Failed config
General Errors:
- unexpected indent (alexa.py, line 93)
Successful config (partial)
This looks like the file was downloaded incorrectly from github. Did you copy and paste it or did you save the raw file? I would try to save the raw file from github.
Thanks alandtse,
I thought that I copied the raw file, how ever I have just copied it again and now I’m getting a different error message;
Log Details (ERROR)
Mon Aug 20 2018 19:35:01 GMT+1200 (New Zealand Standard Time)
Error while setting up platform alexa
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 346, in _get_idna_encoded_host
host = idna.encode(host, uts46=True).decode('utf-8')
File "/usr/local/lib/python3.6/site-packages/idna/core.py", line 361, in encode
s = alabel(label)
File "/usr/local/lib/python3.6/site-packages/idna/core.py", line 284, in alabel
check_label(label)
File "/usr/local/lib/python3.6/site-packages/idna/core.py", line 261, in check_label
raise InvalidCodepoint('Codepoint {0} at position {1} of {2} not allowed'.format(_unot(cp_value), pos+1, repr(label)))
idna.core.InvalidCodepoint: Codepoint U+201C at position 1 of '“alexa' not allowed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 394, in prepare_url
host = self._get_idna_encoded_host(host)
File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 348, in _get_idna_encoded_host
raise UnicodeError
UnicodeError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
return fut.result()
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/media_player/alexa.py", line 115, in setup_platform
login = AlexaLogin(url, email, password, hass)
File "/config/custom_components/media_player/alexa.py", line 571, in __init__
self.login(cookies=cookies)
File "/config/custom_components/media_player/alexa.py", line 670, in login
resp = self._session.get(site)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 525, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 498, in request
prep = self.prepare_request(req)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 441, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 309, in prepare
self.prepare_url(url, params)
File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 396, in prepare_url
raise InvalidURL('URL has an invalid label.')
requests.exceptions.InvalidURL: URL has an invalid label.
I am running Hassio and I originally downloaded the add-on (which I don’t believe I need anymore) , so I tried to delete it, but for some reason it won’t delete, could this be related?
Also, I am adding the file through Samba, and using Xcode as the editor, I get this message when saving, could this be my problem?
Can you try just using your browser’s “Save as” function when you’re at the raw file and then copying alexa.py where you need it? It looks like the file is getting mangled by trying to paste it in the editor.
Hi alandtse,
I have tried that and I’m getting the same issue, could it be the add-on? And if so, how can I remove it if the uninstall isn’t working? It works for the rest of the add-ons.
I installed and HA is not showing any Echo devices. I had an issue at first with using quotes in the configuration.yaml file but read the thread and took them out as someone said. Now the module seems to load but the log is saying “taking too long (60 seconds), continuing boot sequence”. And I have no Echos that show up I can’t seem to find any other logs that may be helpful (like the mention of /tmp/alexa).
I am running HA from docker.
EDIT: I should have mentioned I am new to HA (a week into it) coming from Vera (for 10 years). So that may be why I don’t know where logs are or how to troubleshoot this further. I am not familiar with the HA startup sequence.
So I’ve got the Echo/Alexa interface working with ‘text to speak’ (that is SOOO KOOL!). By the way, the upgrade to 0.76.1 didn’t break it.
Have my twitter API developer codes in hand. Now I want to play with creating a script to monitor for a certain individual’s twitter posting to trigger Alexa to make a certain verbal announcement. Anyone willing to give this newbie on HA a hand?
No, I don’t think its the add-on. The new error is complaining because you have a unicode quotation mark in your url config. If you remove the quotation marks does that change anything for you?
@RandyA:
In your config directory you should see a home-assistant.log. To debug a custom_component you’ll need to edit the Logger component to change logging for at least the alexa component to Debug. See here (you can ignore the rest of the post as the debug mode code is by default in now).
Thanks alandtse,
I’m assuming that you mean the " either side of the url in the configuration.yaml file. I have removed them and this is now the error.
Log Details (ERROR)
Tue Aug 21 2018 19:32:09 GMT+1200 (New Zealand Standard Time)
Error while setting up platform alexa
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 171, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py", line 56, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/local/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name does not resolve
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 343, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 849, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 314, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 180, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x6fe2e9d0>: Failed to establish a new connection: [Errno -2] Name does not resolve
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 445, in send
timeout=timeout
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='alexa.alexa.amazon.com', port=443): Max retries exceeded with url: /api/devices-v2/device (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x6fe2e9d0>: Failed to establish a new connection: [Errno -2] Name does not resolve',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
return fut.result()
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/media_player/alexa.py", line 115, in setup_platform
login = AlexaLogin(url, email, password, hass)
File "/config/custom_components/media_player/alexa.py", line 571, in __init__
self.login(cookies=cookies)
File "/config/custom_components/media_player/alexa.py", line 670, in login
resp = self._session.get(site)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 525, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 512, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 622, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 513, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='alexa.alexa.amazon.com', port=443): Max retries exceeded with url: /api/devices-v2/device (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x6fe2e9d0>: Failed to establish a new connection: [Errno -2] Name does not resolve',))
@SMARTMEDIA Would you like to share the script? I just did the same as you but it read everything. I have not used scripts in HA before. How do you call them?