Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All devices unavailable after restart, list of device not appearing with new installation #2558

Open
samuele2723 opened this issue Sep 22, 2024 · 37 comments

Comments

@samuele2723
Copy link

IMPORTANT: Please search the issues, including closed issues, and the FAQ before opening a new issue. The template is mandatory; failure to use it will result in issue closure.

Describe the bug

I am using this integration since few years, i was using it without any issue since a month ago, while upgrading to 4.13+ i had authentication issue, so i went back to 4.12.

Then, the 12th of september after a HA restart, all alexa echo devices appear offline ever since. I tried to reinstall the intregration, upgrade and reauthenticate from fresh, but in case of a fresh new installation the list doesn't appear at all (therefore why is unavailable in the list already present since previous)

To Reproduce

i can install a fresh new integration and list of devices not appearing even if the alexa account is active and devices there and working

ì

System details

  • Home Assistant version: 2024.6.3 but i also tried 2024.9.2
  • alexa_media version (from const.py or HA startup log):
Screenshot 2024-09-22 alle 22 14 19
  • alexapy version (from pip show alexapy in homeasssistant container or HA startup log):
  • Is Amazon 2FA/2SV enabled <!---We will not debug login issues if unanswered---> (y/n): YES
  • Amazon Domain: amazon.it

Debug Logs (alexa_media & alexapy)
Please provide logs.
Screenshot 2024-09-22 alle 22 14 54

Additional context

@bennydente
Copy link

Same here. on home assistant core 2024.9.2 and alexa media player 4.13.2.

thanks, bye

@c2mfj
Copy link

c2mfj commented Sep 23, 2024

adding another one
2024-09-23 13:14:15.725 WARNING (MainThread) [alexapy.helpers] alexalogin.login((<alexapy.alexalogin.AlexaLogin object at 0x7f30da34bdd0>,), {'cookies': {}}): An error occurred accessing AlexaAPI: An exception of type TypeError occurred. Arguments: ('can only concatenate str (not "NoneType") to str',) 2024-09-23 13:14:15.725 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry <myEmailAddress> - amazon.com for alexa_media

@kyleb822
Copy link

kyleb822 commented Sep 23, 2024

Same here, integration is now saying “Failed setup, will retry: Connection Error during login”

HA core 2024.9.2
AMP 4.13.2

@38Cherry
Copy link

same.
image
Logger: homeassistant.config_entries
Source: config_entries.py:604
First occurred: 11:59:31 AM (1 occurrences)
Last logged: 11:59:31 AM

Error setting up entry [email protected] - amazon.com for alexa_media
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alexa_media/init.py", line 361, in async_setup_entry
await login.login(cookies=await login.load_cookie())
File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
return await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py", line 713, in login
self._site = await self._process_page(await post_resp.text(), site)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py", line 1506, in _process_page
error_message += list_item.find("span").string
TypeError: can only concatenate str (not "NoneType") to st

and

This error originated from a custom integration.

Logger: alexapy.helpers
Source: custom_components/alexa_media/init.py:361
integration: Alexa Media Player (documentation, issues)
First occurred: 11:59:31 AM (1 occurrences)
Last logged: 11:59:31 AM

alexalogin.login((<alexapy.alexalogin.AlexaLogin object at 0x7fbe9f8be120>,), {'cookies': {}}): An error occurred accessing AlexaAPI: An exception of type TypeError occurred. Arguments: ('can only concatenate str (not "NoneType") to str',)

@dersch81
Copy link

Same here

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: alexapy.helpers
Quelle: custom_components/alexa_media/__init__.py:361
Integration: Alexa Media Player (Dokumentation, Probleme)
Erstmals aufgetreten: 23:34:56 (3 Vorkommnisse)
Zuletzt protokolliert: 23:41:56

alexalogin.login((<alexapy.alexalogin.AlexaLogin object at 0x7fcd9dd922d0>,), {'cookies': {}}): An error occurred accessing AlexaAPI: An exception of type TypeError occurred. Arguments: ('can only concatenate str (not "NoneType") to str',)

AMP 4.13.2
HASS 2024.9.2

@stefanomarino75
Copy link

Same problem Too Many Requests

@ruralleafowner
Copy link

ruralleafowner commented Sep 24, 2024

Same issue. Have spent hours on it, as do NOT want to delete and reinstall, worried it will get rid of all the automations I have setup.

Is it possible to re-authenticate the media player as I think this may be the issue? (I do not get the option to do this sadly!)

Uploading Screenshot 2024-09-24 at 14.49.10.jpg…

@darioz90
Copy link

Same issue after 20/30 min -> “All devices unavailable”

i try time polling to 500 , but don’t work

HA core 2024.9.2
AMP 4.13.2

@mifraburneo
Copy link

Exact same issue.
HA core 2024.9.2
AMP 4.13.2

Poorly tried changing public domain to local ip and adding and removing trailing /
Also to reinstall the integration
Nothing so far...

@delboydell
Copy link

Same here for me in the UK
Logger: homeassistant.config_entries
Source: config_entries.py:604
First occurred: 08:51:19 (1 occurrences)
Last logged: 08:51:19

Error setting up entry p.p.*******@*******net.com - amazon.co.uk for alexa_media
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alexa_media/init.py", line 361, in async_setup_entry
await login.login(cookies=await login.load_cookie())
File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
return await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py", line 671, in login
site = await self._process_page(html, site)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py", line 1506, in _process_page
error_message += list_item.find("span").string

This error originated from a custom integration.

Logger: alexapy.helpers
Source: custom_components/alexa_media/init.py:361
integration: Alexa Media Player (documentation, issues)
First occurred: 08:51:19 (1 occurrences)
Last logged: 08:51:19

alexalogin.login((<alexapy.alexalogin.AlexaLogin object at 0x7fe1963f2150>,), {'cookies': {}}): An error occurred accessing AlexaAPI: An exception of type TypeError occurred. Arguments: ('can only concatenate str (not "NoneType")

@121Westlife212
Copy link

121Westlife212 commented Sep 26, 2024

Same here for me (Spain)

Registrador: homeassistant.config_entries
Fuente: config_entries.py:604
Ocurrió por primera vez: 07:48:50 (1 ocurrencias)
Última vez registrado: 07:48:50

Error setting up entry joe*****@*******.com - amazon.es for alexa_media
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alexa_media/init.py", line 361, in async_setup_entry
await login.login(cookies=await login.load_cookie())
File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
return await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py", line 713, in login
self._site = await self._process_page(await post_resp.text(), site)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py", line 1506, in _process_page
error_message += list_item.find("span").string
TypeError: can only concatenate str (not "NoneType") to str

@cagnulein
Copy link

Same issue unfortunately :(

@JamesIrish
Copy link

Same issue here from UK. Error for me is: TypeError: can only concatenate str (not "NoneType") to str as others have posted above as opposed to the TooManyRequests 429 issue.

@c2mfj
Copy link

c2mfj commented Sep 26, 2024

I got mine working by updating to HA Core 2024.9.3. (that seemed to remove the "none type" error I was getting before) but then I was getting a generic authentication failure error in the logs.

I removed the AMP integration, restarted Home Assistant, and re-added it. Ran through the setup and everything is working again. For those who said they are worried about automations, the devices picked right back up and I didn't miss a beat.

@PV-Joe
Copy link

PV-Joe commented Sep 27, 2024

Same problem here in Germany.
Please fix.

I tried to uninstall and reinstall and now I'm in a endless loop on the Amazon Login website during setup.

@bennydente
Copy link

Hi, there is a workaround for endless loop signin here. #2514
In my scenario, after uninstall and reinstall, the integration stop working after some minutes and I receive this error
""" An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)""""

@PV-Joe
Copy link

PV-Joe commented Sep 28, 2024

I did use that workaround. After the next restart AMP was disconnected again.

Accidentally logging into amazon.com instead of amazon.de didn't have any issue.

This is really annoying.
Hope for a fix.

@zav13r
Copy link

zav13r commented Sep 29, 2024

I think linked to this issue, after removing and reinstalling integration and following the workaround for the login loop, I receive a blank 'Error' dialogue back in HA at the final step and nothing is added.

This is using 2SV and both amazon.com and amazon.co.uk domains in setup.

@CommittotheIndian
Copy link

I'm in the same boat. I've tried removing the component completely, reinstalling, and now I get an error when trying to log in. I've gone back all the way to v12.2

@mattia93cz
Copy link

using AMP version 4.12.7 and 2024.9.3 for HA I don't encounter any problems.
To resolve the authentication loop:
instead of entering the data and logging in, just go to register new account and by entering the data the error "user already registered" will be returned.
Once this step has been carried out, simply log in by entering the correct data and everything will work correctly.

@CommittotheIndian
Copy link

using AMP version 4.12.7 and 2024.9.3 for HA I don't encounter any problems. To resolve the authentication loop: instead of entering the data and logging in, just go to register new account and by entering the data the error "user already registered" will be returned. Once this step has been carried out, simply log in by entering the correct data and everything will work correctly.

I've done this multiple times. Its when I get returned to HA that HA just shows a blank error screen.

@zav13r
Copy link

zav13r commented Sep 29, 2024

using AMP version 4.12.7 and 2024.9.3 for HA I don't encounter any problems. To resolve the authentication loop: instead of entering the data and logging in, just go to register new account and by entering the data the error "user already registered" will be returned. Once this step has been carried out, simply log in by entering the correct data and everything will work correctly.

I've done this multiple times. Its when I get returned to HA that HA just shows a blank error screen.

This ^

It is not the Amazon login or 2SV that's the issue. The workaround for create new, then login works. It's back in HA at the final step that the error is generated and setup of thr integration fails.

@mattia93cz
Copy link

using AMP version 4.12.7 and 2024.9.3 for HA I don't encounter any problems. To resolve the authentication loop: instead of entering the data and logging in, just go to register new account and by entering the data the error "user already registered" will be returned. Once this step has been carried out, simply log in by entering the correct data and everything will work correctly.

I've done this multiple times. Its when I get returned to HA that HA just shows a blank error screen.

This ^

It is not the Amazon login or 2SV that's the issue. The workaround for create new, then login works. It's back in HA at the final step that the error is generated and setup of thr integration fails.

By following this procedure I was able to get the installation to work several times.
Using chrome and trying to create a new account before logging in has always worked for me.
Importantly, you do not need to refresh the web page

@zav13r
Copy link

zav13r commented Sep 29, 2024

I don't know what to tell you - it's great that it works for you, I'm simply saying that it doesn't for me, and others.

  • New chrome browser install, logged into amazon

  • 2SV setup correctly

  • Create new account on Amazon login page, then 'user already registered' to login

  • HA recognises this, begins final setup and returns a blank Error box

  • Integration is not loaded.

  • Tried uninstalling AMP, deleting pickle file, restart and re download. No joy

This is on the latest AMP version, and up to date HA install.

@CommittotheIndian
Copy link

using AMP version 4.12.7 and 2024.9.3 for HA I don't encounter any problems. To resolve the authentication loop: instead of entering the data and logging in, just go to register new account and by entering the data the error "user already registered" will be returned. Once this step has been carried out, simply log in by entering the correct data and everything will work correctly.

I've done this multiple times. Its when I get returned to HA that HA just shows a blank error screen.

This ^
It is not the Amazon login or 2SV that's the issue. The workaround for create new, then login works. It's back in HA at the final step that the error is generated and setup of thr integration fails.

By following this procedure I was able to get the installation to work several times. Using chrome and trying to create a new account before logging in has always worked for me. Importantly, you do not need to refresh the web page

This was even after completely removing AMP, removing config files, clearing cookies, removing alexa and .pickle within .storage.

I reinstalled at AMP 4.12.11 and on HA 2024.8.2.

As you can see the Amazon login/workaround for creating an account works. It's when we get back to HA, we get the error.

image

@Toxo666
Copy link

Toxo666 commented Sep 30, 2024

Maybe this helps?

#2554 (comment)

@zav13r
Copy link

zav13r commented Sep 30, 2024

Maybe this helps?

#2554 (comment)

Oh, thank you!! This was it for me, using pi hole. Disabling blocking didn't seem to work but adding the new regex fixed it. AMP seems to be working again.

@bennydente
Copy link

Thanks, but trying adding whitelist regex filter or disabling blocking for exact domain not working for me. I have same error after some minutes.

" An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)"

@Eric-boop
Copy link

I found the answer on github!: "Are any of you using an ad blocker/firewall such as Pi-hole or AdGuard by chance? Some adlists were recently updated to block the Amazon Alexa API. This is solved by adding ^api(.[a-z]+)?.amazonalexa.com$ to your Pi-hole whitelist or @@||api*.amazonalexa.com^ for AdGuard. This regex is not region specific and should work for all endpoints"

@chesterflaps
Copy link

Same issue for me. Suddenly all alexa devices are showing as unavailable.

@elbrondor
Copy link

In my installation of Home Assistant 2024.9 and AMP 4.13.2, I have encountered both errors.
The first issue is with the authentication process. During the initial installationof AMP, the window asking for the account name and password appears in a loop. If I don't use the workaround, the OTP window never shows up. This issue occurs only with amazon.de and not when I try with amazon.com.

However, with amazon.com, I am unable to control any devices, though all of my devices are available when using amazon.com. If I try with amazon.de, no devices are shown.

I have tested this with Pi-hole disabled, and I have completely opened my firewall.

Hopefully, someone can help.

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Oct 1, 2024

However, with amazon.com, I am unable to control any devices, though all of my devices are available when using amazon.com. If I try with amazon.de, no devices are shown.

You can't play games with Amazon Alexa as she doesn't know how to play!

If your devices are registered via your account at amazon.com then you need to use amazon.com.

image

If your devices are registered via your account at amazon.de then you need to use amazon.de.

image

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Oct 1, 2024

with amazon.com, I am unable to control any devices

@elbrondor What devices are you trying to control?
AMP does not control any devices, only notify.alexa_media and media_player.xyz commands...

@itzalgd24
Copy link

I can confirm that whitelisting ^api(.[a-z]+)?.amazonalexa.com$ in Pi-Hole fixed the issue for me.

@elbrondor
Copy link

Hello All,
i like to control my Amazon Echo devicves. All of them are registerd to Amazon.de
grafik
but in Home assistant AMP is see:
grafik

@elbrondor
Copy link

Here are the related log lines:

2024-10-04 15:22:38.796 DEBUG (MainThread) [custom_components.alexa_media] Discovered new media_player G09G
2024-10-04 15:22:38.922 DEBUG (MainThread) [alexapy.alexaapi] J
r@g****e: static GET: https://alexa.amazon.de/api/phoenix returned 429:Too Many Requests:application/json
2024-10-04 15:22:38.923 INFO (MainThread) [alexapy.alexaapi] Backing off _static_request(...) for 0.6s (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-10-04 15:22:38.958 DEBUG (MainThread) [alexapy.alexaapi] J
r@g****e: static GET: https://alexa.amazon.de/api/bootstrap returned 200:OK:application/json
2024-10-04 15:22:39.023 DEBUG (MainThread) [alexapy.alexaapi] J
r@g****e: static GET: https://alexa.amazon.de/api/devices-v2/device returned 200:OK:application/json
2024-10-04 15:22:39.033 DEBUG (MainThread) [alexapy.alexaapi] J
r@g****e: static GET: https://alexa.amazon.de/api/dnd/device-status-list returned 200:OK:application/json
2024-10-04 15:22:39.196 DEBUG (MainThread) [alexapy.alexaapi] J
r@g****e: static GET: https://alexa.amazon.de/api/bluetooth?cached=false returned 200:OK:application/json
2024-10-04 15:22:39.423 DEBUG (MainThread) [alexapy.alexaapi] J
r@g****e: static GET: https://alexa.amazon.de/api/device-preferences returned 200:OK:application/json
2024-10-04 15:22:39.591 DEBUG (MainThread) [alexapy.alexaapi] J
r@g****e: static GET: https://alexa.amazon.de/api/phoenix returned 429:Too Many Requests:application/json
2024-10-04 15:22:39.592 INFO (MainThread) [alexapy.alexaapi] Backing off _static_request(...) for 1.5s (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-10-04 15:22:41.191 DEBUG (MainThread) [alexapy.alexaapi] J
r@g****e: static GET: https://alexa.amazon.de/api/phoenix returned 429:Too Many Requests:application/json
2024-10-04 15:22:41.191 INFO (MainThread) [alexapy.alexaapi] Backing off _static_request(...) for 3.9s (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-10-04 15:22:45.127 DEBUG (MainThread) [alexapy.alexaapi] J
r@g****e: static GET: https://alexa.amazon.de/api/phoenix returned 429:Too Many Requests:application/json
2024-10-04 15:22:45.128 INFO (MainThread) [alexapy.alexaapi] Backing off _static_request(...) for 3.9s (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-10-04 15:22:49.120 DEBUG (MainThread) [alexapy.alexaapi] J
************r@g****e: static GET: https://alexa.amazon.de/api/phoenix returned 429:Too Many Requests:application/json
2024-10-04 15:22:49.120 ERROR (MainThread) [alexapy.alexaapi] Giving up _static_request(...) after 5 tries (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-10-04 15:22:49.120 WARNING (MainThread) [alexapy.helpers] alexaapi.get_guard_details((<alexapy.alexalogin.AlexaLogin object at 0x7f550664b4d0>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyTooManyRequestsError occurred. Arguments:
('Too Many Requests',)
2024-10-04 15:22:49.121 WARNING (MainThread) [alexapy.helpers] alexaapi.get_network_details((<alexapy.alexalogin.AlexaLogin object at 0x7f550664b4d0>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyTooManyRequestsError occurred. Arguments:
('Too Many Requests',)
2024-10-04 15:22:49.122 DEBUG (MainThread) [custom_components.alexa_media] Finished fetching alexa_media data in 10.336 seconds (success: False)

@oentzforeva
Copy link

None of the solutions are working for me anymore. Amazon login loop, workaround - check. Reconfiguration to my domain .de - check. Pihole regex whitelist for api.amazonalexa.* - check. No changes. All the entities are in a "not available" state. I tried several versions of HA Core and AMP. I cant get it to work at all. After every reconfiguration alexa app is saying that it detected some new devices, but its not possible to control anything from HA. Any solution would be great. I could provide logs, but nothing which wasn't already posted here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests