alexa_media_player
alexa_media_player copied to clipboard
Alexa API / Too many requests
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 getting quite a lot of errors saying that there were too many requests and other problems (getting history records). The problem seems to be the Indoor Air Quallity Monitor, at least it is the only Amazon device I use except my Echos. I am using it as temperature and hygrometer device, I think the device is sending updates every 5 minutes.
To Reproduce
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior
No problem with getting data, not getting the "too many requests error.
Screenshots
System details
- Home-assistant (version): 2024.1.5 // 2023.12.1
- alexa_media (version from
const.py
or HA startup): 4.9.0 - alexapy (version from
pip show alexapy
or HA startup): Package not found - Amazon 2FA is enabled (y/n). <!---We will not debug login issues if unanswered--->: yes
Logs Please provide logs. 1.) Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht
Logger: custom_components.alexa_media Source: helpers/update_coordinator.py:332 Integration: Alexa Media Player (documentation, issues) First occurred: 18:12:58 (1 occurrences) Last logged: 18:12:58
Error fetching alexa_media data: Error communicating with API:
2,) Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht
Logger: alexapy.helpers Source: custom_components/alexa_media/init.py:756 Integration: Alexa Media Player (documentation, issues) First occurred: 18:12:58 (2 occurrences) Last logged: 18:12:58
alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7f74fc4950>,), {'max_record_size': 10}): An error occurred accessing AlexaAPI: An exception of type AlexapyTooManyRequestsError occurred. Arguments: ('',) alexaapi.get_last_device_serial((<alexapy.alexalogin.AlexaLogin object at 0x7f74fc4950>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyTooManyRequestsError occurred. Arguments: ('',)
3.) Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht
Logger: alexapy.alexaapi Source: custom_components/alexa_media/init.py:756 Integration: Alexa Media Player (documentation, issues) First occurred: 18:12:58 (1 occurrences) Last logged: 18:12:58
Giving up _static_request(...) after 5 tries (alexapy.errors.AlexapyTooManyRequestsError)
Additional context
I am also seeing similar behaviour:
Error fetching alexa_media data: Error communicating with API: Too Many Requests 6:23:58 AM – (ERROR) Alexa Media Player (custom integration) - message first occurred at January 29, 2024 at 12:50:17 PM and shows up 7 times alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7fc34466ca10>,), {'max_record_size': 10}): An error occurred accessing AlexaAPI: An exception of type AlexapyTooManyRequestsError occurred. Arguments: ('Too Many Requests',) 6:23:58 AM – (WARNING) Alexa Media Player (custom integration) - message first occurred at January 29, 2024 at 12:50:17 PM and shows up 16 times Giving up _static_request(...) after 5 tries (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests) 6:23:58 AM – (ERROR) Alexa Media Player (custom integration) - message first occurred at January 29, 2024 at 12:50:17 PM and shows up 7 times
Hi 👋, same problem for me; I bring you my experience and the series of facts (coincidences?) that occurred at the same time as the errors appeared:
- I had just gotten the "add connected devices" option to get the temperature sensor of one of my 10 alexa devices. I deactivated and deleted this entity firstly because these error messages started and secondly because it was not very precise and timely in updating; I prefer to keep the other sensors I have integrated. after restoring everything to how it was before the 3 error messages continued to appear.
- I looked in core.config_entries for that value (object at 0x7f8879d8d690) reported in the 3 occurrences of the warning message relating to the "Logger: alexapy.helpers" and I discovered that it referred to the "radio browser" integration that I had disabled; at this point I re-enabled it but the errors continued; I decided to remove it completely but the result did not change.
maybe they are just coincidences but this is it and unfortunately even by removing what seemed to me to be the cause, the errors continue.
also other smarthome tools like FHEM have problems - Amazon changed something
Hi,
enclose my log entries from different days. There is no recognizable frequency that leads to a certain automation causing this error:
2024-01-28 22:38:47.309 ERROR (MainThread) [alexapy.alexaapi] Giving up _static_request(...) after 5 tries (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-01-28 22:38:47.311 ERROR (MainThread) [custom_components.alexa_media] Error fetching alexa_media data: Error communicating with API: Too Many Requests
2024-01-28 23:09:16.992 ERROR (MainThread) [alexapy.alexaapi] Giving up _static_request(...) after 5 tries (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-01-28 23:09:16.993 ERROR (MainThread) [custom_components.alexa_media] Error fetching alexa_media data: Error communicating with API: Too Many Requests
2024-01-29 02:26:09.265 ERROR (MainThread) [alexapy.alexaapi] Giving up _static_request(...) after 5 tries (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-01-29 02:26:09.267 ERROR (MainThread) [custom_components.alexa_media] Error fetching alexa_media data: Error communicating with API: Too Many Requests
2024-01-29 03:06:41.212 ERROR (MainThread) [alexapy.alexaapi] Giving up _static_request(...) after 5 tries (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-01-29 03:06:41.213 ERROR (MainThread) [custom_components.alexa_media] Error fetching alexa_media data: Error communicating with API: Too Many Requests
2024-01-29 09:33:14.224 ERROR (MainThread) [alexapy.alexaapi] Giving up _static_request(...) after 5 tries (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-01-29 09:33:14.224 ERROR (MainThread) [custom_components.alexa_media] Error fetching alexa_media data: Error communicating with API: Too Many Requests
2024-01-30 00:43:23.971 ERROR (MainThread) [alexapy.alexaapi] Giving up _static_request(...) after 5 tries (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-01-30 00:43:23.972 ERROR (MainThread) [custom_components.alexa_media] Error fetching alexa_media data: Error communicating with API: Too Many Requests
2024-01-30 07:38:28.368 ERROR (MainThread) [alexapy.alexaapi] Giving up _static_request(...) after 5 tries (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-01-30 07:38:28.369 ERROR (MainThread) [custom_components.alexa_media] Error fetching alexa_media data: Error communicating with API: Too Many Requests
also other smarthome tools like FHEM have problems - Amazon changed something
Yes, I also think so. I integrated the air quality sensor in December and the errors started approx. 10 days (?) ago. I cannot be precise here as I noted them by coincidence when I saw my dashboard is not showing values for the sensors every now and then.
Yup. Its getting pretty annoying. Thought I was the only one. To a state where I cant stop my audio player radio over voice command.
alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7fe0e26befd0>,), {'max_record_size': 10}): An error occurred accessing AlexaAPI: An exception of type AlexapyTooManyRequestsError occurred. Arguments: ('Too Many Requests',)
alexaapi.get_last_device_serial((<alexapy.alexalogin.AlexaLogin object at 0x7fe0e26befd0>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyTooManyRequestsError occurred. Arguments: ('Too Many Requests',)
alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7fe0e26befd0>,), {'max_record_size': 10}): Timeout error occurred accessing AlexaAPI: An exception of type CancelledError occurred. Arguments: ()
Giving up _static_request(...) after 5 tries (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
Error fetching alexa_media data: Error communicating with API: Too Many Requests
Same problem here from a couple of weeks ago, no HA configuration changed in the last month. The problem was already succeeded last year, I suppose this is a problem caused by limited resources available in the AWS cloud to the customer without regular subscription, but I could be wrong ..
Same problem
I had the same problem.
I deleted the following file: /homeassistant/.storage/[email protected]
After the integration was reloaded, the error did not reappear. Let's see how it goes now...
I had the same problem. I deleted the following file:
/homeassistant/.storage/[email protected]
After the integration was reloaded, the error did not reappear. Let's see how it goes now...
Did you need to reconfigure alexa_media or just reloaded the integration?
I had the same problem. I deleted the following file:
/homeassistant/.storage/[email protected]
After the integration was reloaded, the error did not reappear. Let's see how it goes now...Did you need to reconfigure alexa_media or just reload the integration?
The integration was automatically reloaded after I pressed CTRL + F5. Nothing more had to be done. But as I said, so far the message hasn't come back, but I'll know tomorrow between 8 and 11 a.m., because it was usually during this time that problems occurred.
Did not fix it for me. Deleted it, restarted and again got this.
alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7fc1f7edf800>,), {'max_record_size': 10}): Timeout error occurred accessing AlexaAPI: An exception of type CancelledError occurred. Arguments: ()
Did not fix for me. I suppose depend of responsive of AWS cloud.
Didn't work for me either
Unfortunately, it didn't last for me. It started again this morning at around 1am and then at around 8am.
Logger: alexapy.alexaapi Source: custom_components/alexa_media/init.py:756 Integration: Alexa Media Player (documentation, issues) First occurred: 01:30:58 (2 occurrences) Last logged: 08:41:51
Giving up _static_request(...) after 5 tries (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests) Giving up _static_request(...) after 5 tries (alexapy.errors.AlexapyTooManyRequestsError)
--
Logger: custom_components.alexa_media Source: helpers/update_coordinator.py:332 Integration: Alexa Media Player (documentation, issues) First occurred: 01:30:58 (2 occurrences) Last logged: 08:41:51
Error fetching alexa_media data: Error communicating with API: Too Many Requests Error fetching alexa_media data: Error communicating with API:
--
Logger: aiohttp.server Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:421 First occurred: 02:10:54 (2 occurrences) Last logged: 08:58:11 Error handling request
Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 350, in data_received messages, upgraded, tail = self._request_parser.feed_data(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadStatusLine: 400, message: Invalid method encountered:
b'\x03' ^
--
Logger: alexapy.helpers Source: custom_components/alexa_media/init.py:756 Integration: Alexa Media Player (documentation, issues) First occurred: 01:30:58 (9 occurrences) Last logged: 10:40:42
alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7f1b1d522e90>,), {'max_record_size': 10}): An error occurred accessing AlexaAPI: An exception of type AlexapyTooManyRequestsError occurred. Arguments: ('Too Many Requests',) alexaapi.get_last_device_serial((<alexapy.alexalogin.AlexaLogin object at 0x7f1b1d522e90>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyTooManyRequestsError occurred. Arguments: ('Too Many Requests',) alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7f1b1d522e90>,), {'max_record_size': 10}): Timeout error occurred accessing AlexaAPI: An exception of type CancelledError occurred. Arguments: () alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7f1b1d522e90>,), {'max_record_size': 10}): An error occurred accessing AlexaAPI: An exception of type AlexapyTooManyRequestsError occurred. Arguments: ('',) alexaapi.get_last_device_serial((<alexapy.alexalogin.AlexaLogin object at 0x7f1b1d522e90>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyTooManyRequestsError occurred. Arguments: ('',)
Same issues in the log. But to be honest, I don't see any limitations in functionality, at least none that I noticed. What impact do you have as a result of the error?
2024-02-03 06:16:08.325 ERROR (MainThread) [custom_components.alexa_media] Error fetching alexa_media data: Error communicating with API: Too Many Requests
2024-02-03 06:26:19.769 ERROR (MainThread) [alexapy.alexaapi] Giving up _static_request(...) after 5 tries (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests)
2024-02-03 06:26:19.769 WARNING (MainThread) [alexapy.helpers] alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7ff11c835fd0>,), {'max_record_size': 10}): An error occurred accessing AlexaAPI: An exception of type AlexapyTooManyRequestsError occurred. Arguments:
('Too Many Requests',)
2024-02-03 06:26:19.769 WARNING (MainThread) [alexapy.helpers] alexaapi.get_last_device_serial((<alexapy.alexalogin.AlexaLogin object at 0x7ff11c835fd0>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyTooManyRequestsError occurred. Arguments:
('Too Many Requests',)
sometimes the Echo are unavailable, the related service not available and repair required
Error fetching alexa_media data: Error communicating with API: Too Many Requests
After this error I a having a 5 minute gap in history data for my air quality monitor, in the dashboard it is shown as unavailable for the same time. My Echos are then not capable to execute HA scripts using tts.
Error fetching alexa_media data: Error communicating with API: Too Many Requests
After this error I a having a 5 minute gap in history data for my air quality monitor, in the dashboard it is shown as unavailable for the same time.
My Echos are then not capable to execute HA scripts using tts.
same thing for me too
What impact do you have as a result of the error?
I don't actually have any problems that I would notice. But as the others here have just reported, it is also the case with me that various Alexa devices (in my case Echo) sometimes seem to lose the connection or recording. This happens at the times when the error message appears.
This happens more often with an Echo in the kitchen than with other devices and the recording time is then interrupted for about 10 minutes. Unfortunately, I can only see this in the temperature recording.
Logger: alexapy.helpers Source: custom_components/alexa_media/init.py:756 Integration: Alexa Media Player (documentation, issues) First occurred: 04:57:40 (6 occurrences) Last logged: 09:56:47
alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7fb8f2194490>,), {'max_record_size': 10}): Timeout error occurred accessing AlexaAPI: An exception of type CancelledError occurred. Arguments: () In this case, however, it is only a warning, not an error message.
The other Echo devices in the apartment (living room, 2x bedroom) only have two interruptions, while the one in the kitchen has 6 interruptions.
It is a pity that certain error messages / warnings cannot simply be suppressed. :) The warning/error messages only appeared with the updates this year, I didn't have such messages before. It's either due to HA or Amazon itself.
Regarding the voice output of the Echo devices caused by HA, I don't notice anything. Because the voice output only comes as soon as windows are opened or closed in connection with the heating. And so far everything has worked without any problems.
Perhaps this will also change in the future so that the extension (Alexa Media Player) will soon no longer work at all and you will have to do it via the Nabu Casa service.
Same problem
Same problem too
Okay, can we please stop writing me too? Getting an email notification just because someone can't press thumbs up and instead has to write "same problem" isn't helping. Thanks.
Hi 👋, same problem for me; I bring you my experience and the series of facts (coincidences?) that occurred at the same time as the errors appeared:
- I had just gotten the "add connected devices" option to get the temperature sensor of one of my 10 alexa devices. I deactivated and deleted this entity firstly because these error messages started and secondly because it was not very precise and timely in updating; I prefer to keep the other sensors I have integrated. after restoring everything to how it was before the 3 error messages continued to appear.
- I looked in core.config_entries for that value (object at 0x7f8879d8d690) reported in the 3 occurrences of the warning message relating to the "Logger: alexapy.helpers" and I discovered that it referred to the "radio browser" integration that I had disabled; at this point I re-enabled it but the errors continued; I decided to remove it completely but the result did not change.
maybe they are just coincidences but this is it and unfortunately even by removing what seemed to me to be the cause, the errors continue.
with reference to point 2. of your note, I am not finding in the core.config_entries file or other HA file any reference to the object reported in the error log (e.g. object at 0x7f4f5e6090 ), where am I going wrong?
Hi 👋, same problem for me; I bring you my experience and the series of facts (coincidences?) that occurred at the same time as the errors appeared:
- I had just gotten the "add connected devices" option to get the temperature sensor of one of my 10 alexa devices. I deactivated and deleted this entity firstly because these error messages started and secondly because it was not very precise and timely in updating; I prefer to keep the other sensors I have integrated. after restoring everything to how it was before the 3 error messages continued to appear.
- I looked in core.config_entries for that value (object at 0x7f8879d8d690) reported in the 3 occurrences of the warning message relating to the "Logger: alexapy.helpers" and I discovered that it referred to the "radio browser" integration that I had disabled; at this point I re-enabled it but the errors continued; I decided to remove it completely but the result did not change.
maybe they are just coincidences but this is it and unfortunately even by removing what seemed to me to be the cause, the errors continue.
with reference to point 2. of your note, I am not finding in the core.config_entries file or other HA file any reference to the object reported in the error log (e.g. object at 0x7f4f5e6090 ), where am I going wrong?
I @micium, I think that "0x7f4f5e6090" is the object string in my log; you search this? if yes, you need to look for the string that appears in your log.
with reference to point 2. of your note, I am not finding in the core.config_entries file or other HA file any reference to the object reported in the error log (e.g. object at 0x7f4f5e6090 ), where am I going wrong?
I @micium, I think that "0x7f4f5e6090" is the object string in my log; you search this? if yes, you need to look for the string that appears in your log.
No, the 0x7f4f5e6090 is the object in my log but i did not find it in my HA files
with reference to point 2. of your note, I am not finding in the core.config_entries file or other HA file any reference to the object reported in the error log (e.g. object at 0x7f4f5e6090 ), where am I going wrong?
I @micium, I think that "0x7f4f5e6090" is the object string in my log; you search this? if yes, you need to look for the string that appears in your log.
No, the 0x7f4f5e6090 is the object in my log but i did not find it in my HA files
I' m sorry, I don't know.
In this time I can't find it in my file either; maybe it really was a coincidence
In case it wasn't obvious, this is an Amazon issue and there's nothing we can do about it here. I'll leave this open for reference.
ok. I understand it's a problem with Amazon's servers. But I ask you, is there any solution to limit the frequency of the problem? In other words... Does the problem depend on the number of requests made on single session (so the more devices you have, the more the problem occurs) or on the frequency with which each account connects to the servers to check the status of the devices? Is there a chance that the situation can be resolved somehow or will we have to learn to live with this aspect?
You'll have to ask Amazon. We already limit our connections. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 is what they're telling us. Maybe there's a PR to see if Amazon sends us actual retry info. Otherwise we already use exponential backoff with jitter which is an AWS recommended practice.