-
Notifications
You must be signed in to change notification settings - Fork 304
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
Every time I tried to install the alexa media plugin I got : Too Many Requests #2639
Comments
I give up! ¯_(ツ)_/¯ |
I think to give up is not a solution. I heard about others that installed HA new on a test system and installed the Alexa Media Player there a few days before without any problems. This indicates that the installation should work. I remarked on another implementation that if you delete the entities and then the implementation and the rest in the hacs store, that not all is really deleted. Some information still be left on haos and if you try to install it later again, some information are already there. I think this could be my problem with the alexa media player. |
A lot of of users are having a myriad of issues, none of which I've had/not been able to overcome with a re & re therefore, I give up trying to figure out other's issues. I need to get on with my life, make money, & pay the bill collectors who are calling several times a day, every day. |
I installed a fresh copy of haos in a virtual machine. I stopped AdGuard and I stopped CrowdSec. Then I added the HACS, added the Alexa Media Player, restarted HA and added this integration. Same result. Too Many Request, as it was written it means that too many requests are done from my account what else does it stand for ? All possible filters I've stopped before. |
If it can help analyze the issue, I am using Alexa Media Player 4.13.5 on version 2024.7.4 without any problems. If I try to update to any subsequent version, 2024.8, 2024.9, or 2024.10, connection issues start (I connect to the amazon.it domain). I also tried creating a new Home Assistant virtual machine, restoring the backup from the old one, completely removing Alexa Media Player from HACS, and reconfiguring it, but it still throws errors even with the latest version 2024.10.3. The only solution I have found, if it can be called that, is to continue using Home Assistant 2024.7.4. |
You can try my modified version of The other change I had to make to completely eliminate the "429" errors was to remove the automatic
You can still execute it manually and as long as it doesn't occur right after a polling sequence it's fine. Based on my usage & testing, I'm under the impression the Amazon request limit seems to be dynamic based on their server load at any given moment. So when your Amazon host endpoint is busier, they seem to reduce the number of API calls permitted. The endpoint is a pool of IP addresses, which should be load balanced DNS resolution but could just be round-robin, and each IP address could be a rack of servers or an entire farm of servers somewhere in their "cloud".
|
first, thanks for not giving up. |
My apologies! The correct file name is |
As for the
and here:
|
I removed the AlexaConnectionError and the AlexapyCancelledError, cause this one was not known by the error.py.
and this error :
|
Not sure if your reply is a typo or not as you stated you removed
and
Or, restore those and replace errors.py with:
|
alexapy/AMP needs to be revised/updated to remove alexaapi.get_guard_details since Alexa Guard is officially dead now since earlier this year. |
Well, I changed the alexaapi.py as described obove, the @backof part too and entered the missing error into the errors.py but the message remains the same like before. Then I removed the amp, stopped adguard and crowdsec. Then did the last core update. Redownloaded the amp and added this integration again. I remarked that the alexaapi was deletet ;.( and redownloaded amp, add the integration, reentered all the above changes ( lesson learned ) luckily I did a copy of the alexaapi.py and the errors.py before. Restarted homeassistant but the warning and the error are the result. |
My last try now was to take the original alexaapi.py and inserted the _min_expo_wait function and changed the two @backof.on_exception to : _min_expo_wait(2.0), instead backoff.expo, first the warning :
and the error :
adguard was inactive and crowdsec was stopped. |
In case that it could help here is the downloaded log from homeassistant :
|
2024-10-27 12:07:49.921 DEBUG (MainThread) [alexapy.alexaapi] ***@***.*******e: static GET: https://alexa.amazon.de/api/phoenix returned 429:Too Many Requests:application/json
2024-10-27 12:07:49.921 INFO (MainThread) [alexapy.alexaapi] Backing off _static_request(...) for 0.7s (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-10-27 12:07:50.697 DEBUG (MainThread) [alexapy.alexaapi] ***@***.*******e: static GET: https://alexa.amazon.de/api/phoenix returned 429:Too Many Requests:application/json
2024-10-27 12:07:50.697 INFO (MainThread) [alexapy.alexaapi] Backing off _static_request(...) for 0.3s (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-10-27 12:07:51.050 DEBUG (MainThread) [alexapy.alexaapi] ***@***.*******e: static GET: https://alexa.amazon.de/api/phoenix returned 429:Too Many Requests:application/json
2024-10-27 12:07:51.050 INFO (MainThread) [alexapy.alexaapi] Backing off _static_request(...) for 0.1s (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-10-27 12:07:51.281 DEBUG (MainThread) [alexapy.alexaapi] ***@***.*******e: static GET: https://alexa.amazon.de/api/phoenix returned 429:Too Many Requests:application/json
2024-10-27 12:07:51.281 INFO (MainThread) [alexapy.alexaapi] Backing off _static_request(...) for 3.8s (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-10-27 12:07:55.160 DEBUG (MainThread) [alexapy.alexaapi] ***@***.*******e: static GET: https://alexa.amazon.de/api/phoenix returned 429:Too Many Requests:application/json
2024-10-27 12:07:55.160 INFO (MainThread) [alexapy.alexaapi] Backing off _static_request(...) for 6.4s (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-10-27 12:08:01.657 DEBUG (MainThread) [alexapy.alexaapi] ***@***.*******e: static GET: https://alexa.amazon.de/api/phoenix returned 429:Too Many Requests:application/json
2024-10-27 12:08:01.657 INFO (MainThread) [alexapy.alexaapi] Backing off _static_request(...) for 57.5s (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-10-27 12:08:19.852 WARNING (MainThread) [alexapy.helpers] alexaapi.get_guard_details((<alexapy.alexalogin.AlexaLogin object at 0x7f1e3ecfd4f0>,), {}): Timeout error occurred accessing AlexaAPI: An exception of type CancelledError occurred. Arguments:
()
2024-10-27 12:08:19.852 DEBUG (MainThread) [alexapy.alexaapi] ***@***.*******e: get_network_details response: None
2024-10-27 12:08:19.852 ERROR (MainThread) [custom_components.alexa_media] Error fetching alexa_media data: Error communicating with API:
2024-10-27 12:08:19.852 DEBUG (MainThread) [custom_components.alexa_media] Finished fetching alexa_media data in 30.001 seconds (success: False)
1. The static GET to `/api/phoenix` has failed after 5 tries in 12s resulting in the timeout warning.
2. The min_expo_wait guarantees a minimum delay but I’m seeing 0.7s, 0.3s & 0.1s which means jitter wasn’t “None”.
Also, min_expo_wait wasn’t applied to the static request as that should have guaranteed a minimum backoff.
3. There was an addition backoff for 57.5s but that didn’t render as the code only allows 5 retries.
4. Th phoenix failure results in there being no network details for the API to process (success: False).
My coding is still a WIP and I’m still working on the min_expo_wait logic.
It is still not ready to submit yet…
|
That was my fault, I did not reenter the jitter line again. But after we completed the errors.py I downloaded your zip file again and put your alexaapi.py into the /usr/local/lib/......./alexaapy and restarted homeassistant and got the same results but can see that he is waiting for every login first 4s then 8s ... and so on . The timestamps in the log did show this too. This is the end of the LogEntries :
|
maybe it helps you I installed a fresh copy af haos again.
|
It looks like Alexa Guard might need to be removed from AMP & alexapy. Amazon discontinued it earlier this year and and replaced it with a new Emergency Assist subscription. What I don't know at this point is whether the home/away modes in it are still "guard" devices in the backend and I did not sign up for the new subscription so I can't test anything. If the backend devices are different then I suspect the backend is slowly getting cleaned of "guard" devices. FYI, I'm not getting "429" errors on the phoenix call; it just finds no guard devices. See: https://reolink.com/blog/alexa-guard/ |
Try this revised function:
|
As for Alexa Guard, there are a few places it's defined. |
I changed the function but this did not change anything. I think, the guard timeout error is a consequence of the too many requests error. I've read the alexa guard and think this should not be a problem for poeple who don't use this feature and as you mentioned it will be only a message worth that this service is no longer available. Here are the last log lines, after I insertet the new function and startet her :
|
I tried this version of the alexaapy too, but it won't help. For any reason, everytime the phoenix call started, I got the too many requests error. Maybe amazon dislike me. I have a FHEM installation, that works fine. For testing the Alexa_Media_Player integration, I set the VM with FHEM to pause, to avoid to have too many requests at the same time. I enabled the Wirequard Plugin and set the routing of the Plugin to route all the traffic trough the tunnel but with no effekt. I took out an old Backup of the homeassistant from July this Year in another VM and testet the alexa_media_player there .... same results. I have 9 echos, this should not be too much. I should try to create a new amazon account, maybe this helps but than I would have none of my echos in there. At this point it is a little bit frustrating. |
@Traders-Banquet did you perform the |
Well I'm not shure but I did it again with this result :
|
@Traders-Banquet sorry but what did you do again exactly? 😅 If you restarted your home assistant from UI that will not wipe previous alexapy cached in the container, please check these steps, you need to run the |
First I edited the manifest.json Last I relogin into the supervisor terminal and go to /usr/local/lib...../alexaapy and check this too ... |
The version in the manifest must contain the full URL to the branch, check this example Also, the |
i just noticed that in your log are present 401 errors before hitting the too many requests, so I suspect my fix could resolve this issue as well 🤞🏻 |
This is the manifest.json that I changed :
|
Hmm I inserted my manifest.json to show that I inserted the whole path but the Problem still exist with my last Logfile as the result. @srescio I think my manifest.json is as you would expect, am I right ? Then the problem did not solve my Problems :
and :
and :
@... and I never said that it works |
Try the released AMP version, i flagged the issue as related because among logs there were also 401 errors so i imagined the retry mechanism with back off cap at 5 may be triggered because calls where not login refreshed I d suggest giving a cooldown of 12 or 24h (not sure what timing alexa servers use) before reconnecting it even with the new version, If after that issue still persist do reopen this issue, which will then require further investigation |
Yes the manifest is correct though there is no way to confirm from that alone nor the logs that it is picking that version vs the previous as in my branch i did not change the version number as that is managed by CI at release time so we re not supposed to hard code it in the source...we probably need to add some kind of utility in AMP to make it log out something like the alexapy lockfile hash so that we can check this in a reliable way |
Is your fix part of the new release ? |
Yeah there is the pr link mention above, which links to the alexapy edits |
OK, I deactivated the alexa_media_player integration and will wait for one day. Maybe it helps. |
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
<everytime I install the alexa media player plugin I got no devicec and constantly one error : too many request:
I install the amp with my amazon login and password the domain is amazon.de for germany, I entered the local address for my homassistant instanz. When I continue on the next page I enterd my amazon credentials and the otp I got by sms, but I tried the authenticator app too. And if I finished the process the amp is installed but no devices appear and I got in my protokol the error above.
I tried this with the last 7 releases of the plugin. Everytime I delete the amp, restart ha, download it on hacs and redo the procedure. By now everytime with the same result. Instead of the local homeassistant address I enterd the public address too, but with the same result.
Is there anything that I don't know by now ?
Logger: alexapy.helpers
Quelle: runner.py:189
Erstmals aufgetreten: 17:42:35 (6 Vorkommnisse)
Zuletzt protokolliert: 17:47:42
alexaapi.get_guard_details((<alexapy.alexalogin.AlexaLogin object at 0x7feee6c92000>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyTooManyRequestsError occurred. Arguments: ('Too Many Requests',)
alexaapi.get_network_details((<alexapy.alexalogin.AlexaLogin object at 0x7feee6c92000>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyTooManyRequestsError occurred. Arguments: ('Too Many Requests',)
and :
Logger: alexapy.alexaapi
Quelle: runner.py:189
Erstmals aufgetreten: 17:42:35 (3 Vorkommnisse)
Zuletzt protokolliert: 17:47:42
Giving up _static_request(...) after 5 tries (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
System details
Supervisor 2024.10.2
Operating System 13.2
Frontend 20241002.3
const.py
or HA startup log): 4.13.5pip show alexapy
in homeasssistant container or HA startup log):The text was updated successfully, but these errors were encountered: