Closed danielbrunt57 closed 1 month ago
If it works out that a change in one or more of these works out for EU, I can see if I can make them configurable from the UI...
@danielbrunt57 It seems working here from Italy. I changed all the configuration you suggest
in Italy it doesn't work, the reconfiguration pop up appears continuously
Updated AMP to 4.2.11 under Supervisor 2024.7.4 and then I updated to 2024.8.2.
Domain .es
Edited files:
File 1: manifest.json "requirements": ["alexapy>=1.28.2", "packaging>=20.3", "wrapt>=1.14.0"],
File 2: const.py SCAN_INTERVAL = timedelta(seconds=180) MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(seconds=5) DEFAULT_SCAN_INTERVAL = 300
I didn't see error at logs after restarting HA. But after 10 minutes I could see the following warnings.
Warning 1:
Registrador: homeassistant
Fuente: /usr/src/homeassistant/homeassistant/runner.py:148
Ocurrió por primera vez: 19:22:46 (1 ocurrencias)
Último inicio de sesión: 19:22:46
Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
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/alexaapi.py", line 889, in send_tts
await self.send_sequence(
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/alexaapi.py", line 512, in send_sequence
await self.run_behavior(node_data, queue_delay=queue_delay)
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/alexaapi.py", line 434, in run_behavior
await self._post_request("/api/behaviors/preview", data=data)
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 226, in _post_request
return await self._request("post", uri, data, query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry
ret = await target(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 199, in _request
raise AlexapyLoginError("Login error detected; not contacting API")
alexapy.errors.AlexapyLoginError: Login error detected; not contacting API
Warning 2:
Registrador: alexapy.helpers
Fuente: runner.py:190
Ocurrió por primera vez: 19:22:46 (3 ocurrencias)
Último inicio de sesión: 19:22:46
alexaapi.run_behavior((<alexapy.alexaapi.AlexaAPI object at 0x7fbdb9791460>, {'@type': 'com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode', 'type': 'Alexa.Speak', 'operationPayload': {'deviceType': 'A3RBAYBE7VM004', 'deviceSerialNumber': 'G************30N', 'locale': 'es-es', 'customerId': 'A*****************VKG', 'textToSpeak': 'La temperatura de jardín es de 27.1 grados.', 'target': {'customerId': 'A*****************VKG', 'devices': [{'deviceSerialNumber': 'G************30N', 'deviceTypeId': 'A3RBAYBE7VM004'}]}, 'skillId': 'amzn1.ask.1p.saysomething'}}), {'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)
alexaapi.send_sequence((<alexapy.alexaapi.AlexaAPI object at 0x7fbdb9791460>, 'Alexa.Speak'), {'customer_id': 'A*****************VKG', 'textToSpeak': 'La temperatura de jardín es de 27.1 grados.', 'target': {'customerId': 'A*****************VKG', 'devices': [{'deviceSerialNumber': 'G************30N', 'deviceTypeId': 'A3RBAYBE7VM004'}]}, 'skillId': 'amzn1.ask.1p.saysomething', 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)
alexaapi.send_tts((<alexapy.alexaapi.AlexaAPI object at 0x7fbdb9791460>, 'La temperatura de jardín es de 27.1 grados.'), {'customer_id': 'A*****************VKG', 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)
Warning 3:
Este error se originó a partir de una integración personalizada.
Registrador: alexapy.helpers
Fuente: custom_components/alexa_media/__init__.py:786
integración: Alexa Media Player (documentación, problemas)
Ocurrió por primera vez: 19:20:43 (6 ocurrencias)
Último inicio de sesión: 19:22:43
alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7fbdb7a34a70>,), {'max_record_size': 10}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Unauthorized',)
alexaapi.get_last_device_serial((<alexapy.alexalogin.AlexaLogin object at 0x7fbdb7a34a70>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Unauthorized',)
alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7fbdb7a34a70>,), {'max_record_size': 10}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)
alexaapi.get_last_device_serial((<alexapy.alexalogin.AlexaLogin object at 0x7fbdb7a34a70>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)
Then I reloaded the integration and I got the following errors at log.
Error 1:
Registrador: homeassistant.config_entries
Fuente: config_entries.py:819
Ocurrió por primera vez: 19:35:47 (2 ocurrencias)
Último inicio de sesión: 19:36:27
Error unloading entry Alexa for notify
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 819, in async_unload
result = await component.async_unload_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/notify/__init__.py", line 135, in async_unload_entry
return await component.async_unload_entry(entry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 202, in async_unload_entry
raise ValueError("Config entry was never loaded!")
ValueError: Config entry was never loaded!
Error 2:
Este error se originó a partir de una integración personalizada.
Registrador: alexapy.helpers
Fuente: custom_components/alexa_media/alexa_entity.py:336
integración: Alexa Media Player (documentación, problemas)
Ocurrió por primera vez: 19:36:20 (1 ocurrencias)
Último inicio de sesión: 19:36:20
alexaapi.get_entity_state((<alexapy.alexalogin.AlexaLogin object at 0x7fbdb6136060>,), {'entity_ids': ['*** edited ***']}): Timeout error occurred accessing AlexaAPI: An exception of type CancelledError occurred. Arguments: ()
Hi, same error here, also for the ".es" domain
2024-08-24 19:35:47.590 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
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/alexaapi.py", line 889, in send_tts
await self.send_sequence(
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/alexaapi.py", line 512, in send_sequence
await self.run_behavior(node_data, queue_delay=queue_delay)
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/alexaapi.py", line 434, in run_behavior
await self._post_request("/api/behaviors/preview", data=data)
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 226, in _post_request
return await self._request("post", uri, data, query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry
ret = await target(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 199, in _request
raise AlexapyLoginError("Login error detected; not contacting API")
alexapy.errors.AlexapyLoginError: Login error detected; not contacting API
2024-08-24 19:35:53.146 WARNING (MainThread) [alexapy.helpers] alexaapi.run_behavior((<alexapy.alexaapi.AlexaAPI object at 0x7fd007b0dfa0>, {'@type': 'com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode', 'type': 'Alexa.Speak', 'operationPayload': {'deviceType': 'A32DOYMUN6DTXA', 'deviceSerialNumber': 'G************6J9', 'locale': 'es-es', 'customerId': 'A**********W1S', 'textToSpeak': 'Hola', 'target': {'customerId': 'A**********W1S', 'devices': [{'deviceSerialNumber': 'G************6J9', 'deviceTypeId': 'A32DOYMUN6DTXA'}]}, 'skillId': 'amzn1.ask.1p.saysomething'}}), {'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-24 19:35:53.147 WARNING (MainThread) [alexapy.helpers] alexaapi.send_sequence((<alexapy.alexaapi.AlexaAPI object at 0x7fd007b0dfa0>, 'Alexa.Speak'), {'customer_id': 'A3PPHYUAMHCW1S', 'textToSpeak': 'Hola', 'target': {'customerId': 'A**********W1S', 'devices': [{'deviceSerialNumber': 'G************6J9', 'deviceTypeId': 'A32DOYMUN6DTXA'}]}, 'skillId': 'amzn1.ask.1p.saysomething', 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-24 19:35:53.148 WARNING (MainThread) [alexapy.helpers] alexaapi.send_tts((<alexapy.alexaapi.AlexaAPI object at 0x7fd007b0dfa0>, 'Hola'), {'customer_id': 'A3PPHYUAMHCW1S', 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
Also getting this error below in the logs:
2024-08-24 19:36:12.181 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry blah.redacted.blah - amazon.es for notify
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 819, in async_unload
result = await component.async_unload_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/notify/__init__.py", line 135, in async_unload_entry
return await component.async_unload_entry(entry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 202, in async_unload_entry
raise ValueError("Config entry was never loaded!")
ValueError: Config entry was never loaded!
2024-08-24 19:36:12.255 WARNING (MainThread) [custom_components.alexa_media] Could not remove cookiefile: /config/.storage/alexa_media.blah.redacted.blah.pickle. Please manually delete the file.
I manually deleted the .pickle file, but it is recreated and the error repeats.
Did not check what was changed, but a reinstall of the previous version saved it immediately.
Updated AMP to 4.2.11 under Supervisor 2024.7.4 and then I updated to 2024.8.2.
Domain .es
Edited files:
File 1: manifest.json "requirements": ["alexapy>=1.28.2", "packaging>=20.3", "wrapt>=1.14.0"],
File 2: const.py SCAN_INTERVAL = timedelta(seconds=180) MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(seconds=5) DEFAULT_SCAN_INTERVAL = 300
I didn't see error at logs after restarting HA. But after 10 minutes I could see the following warnings.
Warning 1:
Registrador: homeassistant Fuente: /usr/src/homeassistant/homeassistant/runner.py:148 Ocurrió por primera vez: 19:22:46 (1 ocurrencias) Último inicio de sesión: 19:22:46 Error doing job: Task exception was never retrieved (None) Traceback (most recent call last): 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/alexaapi.py", line 889, in send_tts await self.send_sequence( 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/alexaapi.py", line 512, in send_sequence await self.run_behavior(node_data, queue_delay=queue_delay) 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/alexaapi.py", line 434, in run_behavior await self._post_request("/api/behaviors/preview", data=data) File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 226, in _post_request return await self._request("post", uri, data, query) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry ret = await target(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 199, in _request raise AlexapyLoginError("Login error detected; not contacting API") alexapy.errors.AlexapyLoginError: Login error detected; not contacting API
Warning 2:
Registrador: alexapy.helpers Fuente: runner.py:190 Ocurrió por primera vez: 19:22:46 (3 ocurrencias) Último inicio de sesión: 19:22:46 alexaapi.run_behavior((<alexapy.alexaapi.AlexaAPI object at 0x7fbdb9791460>, {'@type': 'com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode', 'type': 'Alexa.Speak', 'operationPayload': {'deviceType': 'A3RBAYBE7VM004', 'deviceSerialNumber': 'G************30N', 'locale': 'es-es', 'customerId': 'A*****************VKG', 'textToSpeak': 'La temperatura de jardín es de 27.1 grados.', 'target': {'customerId': 'A*****************VKG', 'devices': [{'deviceSerialNumber': 'G************30N', 'deviceTypeId': 'A3RBAYBE7VM004'}]}, 'skillId': 'amzn1.ask.1p.saysomething'}}), {'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',) alexaapi.send_sequence((<alexapy.alexaapi.AlexaAPI object at 0x7fbdb9791460>, 'Alexa.Speak'), {'customer_id': 'A*****************VKG', 'textToSpeak': 'La temperatura de jardín es de 27.1 grados.', 'target': {'customerId': 'A*****************VKG', 'devices': [{'deviceSerialNumber': 'G************30N', 'deviceTypeId': 'A3RBAYBE7VM004'}]}, 'skillId': 'amzn1.ask.1p.saysomething', 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',) alexaapi.send_tts((<alexapy.alexaapi.AlexaAPI object at 0x7fbdb9791460>, 'La temperatura de jardín es de 27.1 grados.'), {'customer_id': 'A*****************VKG', 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)
Warning 3:
Este error se originó a partir de una integración personalizada. Registrador: alexapy.helpers Fuente: custom_components/alexa_media/__init__.py:786 integración: Alexa Media Player (documentación, problemas) Ocurrió por primera vez: 19:20:43 (6 ocurrencias) Último inicio de sesión: 19:22:43 alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7fbdb7a34a70>,), {'max_record_size': 10}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Unauthorized',) alexaapi.get_last_device_serial((<alexapy.alexalogin.AlexaLogin object at 0x7fbdb7a34a70>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Unauthorized',) alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7fbdb7a34a70>,), {'max_record_size': 10}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',) alexaapi.get_last_device_serial((<alexapy.alexalogin.AlexaLogin object at 0x7fbdb7a34a70>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)
Then I reloaded the integration and I got the following errors at log.
Error 1:
Registrador: homeassistant.config_entries Fuente: config_entries.py:819 Ocurrió por primera vez: 19:35:47 (2 ocurrencias) Último inicio de sesión: 19:36:27 Error unloading entry Alexa for notify Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 819, in async_unload result = await component.async_unload_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/notify/__init__.py", line 135, in async_unload_entry return await component.async_unload_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 202, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded!
Error 2:
Este error se originó a partir de una integración personalizada. Registrador: alexapy.helpers Fuente: custom_components/alexa_media/alexa_entity.py:336 integración: Alexa Media Player (documentación, problemas) Ocurrió por primera vez: 19:36:20 (1 ocurrencias) Último inicio de sesión: 19:36:20 alexaapi.get_entity_state((<alexapy.alexalogin.AlexaLogin object at 0x7fbdb6136060>,), {'entity_ids': ['*** edited ***']}): Timeout error occurred accessing AlexaAPI: An exception of type CancelledError occurred. Arguments: ()
It's impossible for me to help you troubleshoot your issue without seeing your related DEBUG logs...
This is the code in the api _request call:
async def _request(
self,
method: str,
uri: str,
data: Optional[dict[str, str]] = None,
query: Optional[dict[str, str]] = None,
) -> ClientResponse:
async with self._login._oauth_lock:
if self._login.expires_in and (self._login.expires_in - time.time() < 0):
_LOGGER.debug(
"%s: Detected access token expiration; refreshing",
hide_email(self._login.email),
)
if (
# await self._login.get_tokens()
# and
await self._login.refresh_access_token()
and await self._login.exchange_token_for_cookies()
and await self._login.get_csrf()
):
await self._login.save_cookiefile()
else:
_LOGGER.debug(
"%s: Unable to refresh oauth",
hide_email(self._login.email),
)
self._login.access_token = None
self._login.refresh_token = None
self._login.expires_in = None
if method == "get":
if query and not query.get("_"):
query["_"] = math.floor(time.time() * 1000)
elif query is None:
query = {"_": math.floor(time.time() * 1000)}
url: URL = URL(self._url + uri).update_query(query)
_LOGGER.debug(
"%s: Trying %s: %s : with uri: %s data %s query %s",
hide_email(self._login.email),
method,
url,
uri,
data,
query,
)
if self._login.close_requested:
_LOGGER.debug(
"%s: Login object has been asked to close; ignoring %s request to %s with %s %s",
hide_email(self._login.email),
method,
uri,
data,
query,
)
raise AlexapyLoginCloseRequested()
if not self._login.status.get("login_successful"):
_LOGGER.debug(
"%s:Login error detected; ignoring %s request to %s with %s %s",
hide_email(self._login.email),
method,
uri,
data,
query,
)
raise AlexapyLoginError("Login error detected; not contacting API")
if self._session.closed:
raise AlexapyLoginError("Session is closed")
response = await getattr(self._session, method)(
url,
json=data,
# cookies=self._login._cookies,
headers=self._login._headers,
ssl=self._login._ssl,
)
_LOGGER.debug(
"%s: %s: %s returned %s:%s:%s",
hide_email(self._login.email),
response.request_info.method,
response.request_info.url,
response.status,
response.reason,
response.content_type,
)
return await self._process_response(response, self._login)
It's really going to take someone who has the issue and also has somewhat expert debugging skills to get to the crux of the problem...
This is the HA debug log chunk when AMP started malfunctioning, don't know if it helps.
2024-08-25 15:01:31.863 DEBUG (MainThread) [alexapy.alexaapi] c************e@y********m: static GET: https://alexa.amazon.it/api/notifications returned 200:OK:application/json
2024-08-25 15:01:31.897 DEBUG (MainThread) [custom_components.alexa_media] c************e@y********m: Updated 9 notifications for 5 devices at 2024-08-25 15:01:31.896977+02:00
2024-08-25 15:01:32.050 DEBUG (MainThread) [alexapy.alexaapi] c************e@y********m: static GET: https://www.amazon.it/alexa-privacy/apd/rvh/customer-history-records?startTime=1724504491897&endTime=1724677291897&recordType=VOICE_HISTORY&maxRecordSize=10 returned 401:Unauthorized:text/html
2024-08-25 15:01:32.051 WARNING (MainThread) [alexapy.helpers] alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7f6faf35da00>,), {'max_record_size': 10}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Unauthorized',)
2024-08-25 15:01:32.051 WARNING (MainThread) [alexapy.helpers] alexaapi.get_last_device_serial((<alexapy.alexalogin.AlexaLogin object at 0x7f6faf35da00>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Unauthorized',)
2024-08-25 15:01:32.051 DEBUG (MainThread) [custom_components.alexa_media] Ovunque: DND False
2024-08-25 15:01:32.052 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Refreshing <entity media_player.ovunque=standby>
2024-08-25 15:01:32.052 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Ovunque: Last_called check: self: 7****************************207 reported: G************21H
2024-08-25 15:01:32.052 DEBUG (MainThread) [custom_components.alexa_media] Echo Show in cucina: Locale it-it timezone Europe/Paris
2024-08-25 15:01:32.052 DEBUG (MainThread) [custom_components.alexa_media] Echo Show in cucina: DND False
2024-08-25 15:01:32.052 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Refreshing <entity media_player.echo_show_in_cucina=standby>
2024-08-25 15:01:32.053 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Echo Show in cucina: Last_called check: self: G************07T reported: G************21H
2024-08-25 15:01:32.053 DEBUG (MainThread) [custom_components.alexa_media] Piano di sotto: DND False
2024-08-25 15:01:32.053 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Refreshing <entity media_player.piano_di_sotto=standby>
2024-08-25 15:01:32.053 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Piano di sotto: Last_called check: self: 3****************************a6b reported: G************21H
2024-08-25 15:01:32.053 DEBUG (MainThread) [custom_components.alexa_media] Dot Jolly: Locale it-it timezone Europe/Rome
2024-08-25 15:01:32.054 DEBUG (MainThread) [custom_components.alexa_media] Dot Jolly: DND False
2024-08-25 15:01:32.054 DEBUG (MainThread) [custom_components.alexa_media] Upstick: Locale it-it timezone Europe/Rome
2024-08-25 15:01:32.054 DEBUG (MainThread) [custom_components.alexa_media] Upstick: DND False
2024-08-25 15:01:32.054 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Refreshing <entity media_player.upstick=standby>
2024-08-25 15:01:32.054 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Upstick: Last_called check: self: G************WL3 reported: G************21H
2024-08-25 15:01:32.055 DEBUG (MainThread) [custom_components.alexa_media] Echo Show in salone: Locale it-it timezone Europe/Paris
2024-08-25 15:01:32.055 DEBUG (MainThread) [custom_components.alexa_media] Echo Show in salone: DND False
2024-08-25 15:01:32.055 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Refreshing <entity media_player.echo_show_in_salone=standby>
2024-08-25 15:01:32.055 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Echo Show in salone: Last_called check: self: G************21H reported: G************21H
2024-08-25 15:01:32.055 DEBUG (MainThread) [custom_components.alexa_media] Dot in studio: Locale it-it timezone Europe/Rome
2024-08-25 15:01:32.055 DEBUG (MainThread) [custom_components.alexa_media] Dot in studio: DND False
2024-08-25 15:01:32.056 DEBUG (MainThread) [custom_components.alexa_media] Piano di sopra: DND False
2024-08-25 15:01:32.056 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Refreshing <entity media_player.piano_di_sopra=standby>
2024-08-25 15:01:32.056 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Piano di sopra: Last_called check: self: 3****************************f14 reported: G************21H
2024-08-25 15:01:32.056 DEBUG (MainThread) [custom_components.alexa_media] Dot in bagno: Locale it-it timezone Europe/Paris
2024-08-25 15:01:32.056 DEBUG (MainThread) [custom_components.alexa_media] Dot in bagno: DND False
2024-08-25 15:01:32.056 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Refreshing <entity media_player.echo_dot_di_gherardo=standby>
2024-08-25 15:01:32.057 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Dot in bagno: Last_called check: self: G************4BB reported: G************21H
2024-08-25 15:01:32.057 DEBUG (MainThread) [custom_components.alexa_media] Echo Plus in camera da letto: Locale it-it timezone Europe/Rome
2024-08-25 15:01:32.057 DEBUG (MainThread) [custom_components.alexa_media] Echo Plus in camera da letto: DND False
2024-08-25 15:01:32.057 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Refreshing <entity media_player.echo_plus_in_camera_da_letto=standby>
2024-08-25 15:01:32.057 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Echo Plus in camera da letto: Last_called check: self: G************3Q6 reported: G************21H
2024-08-25 15:01:32.057 DEBUG (MainThread) [custom_components.alexa_media] LG: Locale it-it timezone Europe/Rome
2024-08-25 15:01:32.057 DEBUG (MainThread) [custom_components.alexa_media] LG: DND False
2024-08-25 15:01:32.058 DEBUG (MainThread) [custom_components.alexa_media] Salastick: Locale it-it timezone Europe/Rome
2024-08-25 15:01:32.058 DEBUG (MainThread) [custom_components.alexa_media] Salastick: DND False
2024-08-25 15:01:32.058 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Refreshing <entity media_player.salastick=standby>
2024-08-25 15:01:32.058 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Salastick: Last_called check: self: G************0MH reported: G************21H
2024-08-25 15:01:32.058 DEBUG (MainThread) [custom_components.alexa_media] This Device: Locale it-it timezone Europe/Rome
2024-08-25 15:01:32.058 DEBUG (MainThread) [custom_components.alexa_media] This Device: DND False
2024-08-25 15:01:32.059 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: Refreshing <entity media_player.this_device=standby>
2024-08-25 15:01:32.059 DEBUG (MainThread) [custom_components.alexa_media.media_player] c************e@y********m: This Device: Last_called check: self: 3****************************5da reported: G************21H
2024-08-25 15:01:32.059 DEBUG (MainThread) [custom_components.alexa_media] c************e@y********m: Existing: [<entity media_player.ovunque=standby>, <entity media_player.echo_show_in_cucina=standby>, <entity media_player.piano_di_sotto=standby>, <entity media_player.dot_in_bagno=unavailable>, <entity media_player.upstick=standby>, <entity media_player.echo_show_in_salone=standby>, <entity media_player.dot_in_mansarda=unavailable>, <entity media_player.piano_di_sopra=standby>, <entity media_player.echo_dot_di_gherardo=standby>, <entity media_player.echo_plus_in_camera_da_letto=standby>, <entity media_player.gherardo_s_lg_webos_2022_tv=unavailable>, <entity media_player.salastick=standby>, <entity media_player.this_device=standby>] New: []; Filtered out by not being in include: [] or in exclude: []
2024-08-25 15:01:32.065 DEBUG (MainThread) [custom_components.alexa_media] Finished fetching alexa_media data in 5.004 seconds (success: True)
Just for if it helps.
I enabled the debug registry from AMP and then I restarted HA.
So this is the log since the restart until it fails.
I edited serial numbers, email, ...
I did the test after updating to Core 2024.8.3, released today.
I tried the suggested workaround changing the const.py, but after the reboot i receive a "bad configuration" notification from HA with this error log:
Detected blocking call to import_module with args ('custom_components.alexa_media',) in /usr/src/homeassistant/homeassistant/loader.py, line 1067: ComponentProtocol, importlib.import_module(self.pkg_path) inside the event loop; This is causing stability issues. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#import_module Traceback (most recent call last): File "
", line 198, in _run_module_as_main File " ", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in sys.exit(main()) File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/setup.py", line 165, in async_setup_component result = await _async_setup_component(hass, domain, config) File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component component = await integration.async_get_component() File "/usr/src/homeassistant/homeassistant/loader.py", line 1019, in async_get_component comp = self._get_component() File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component ComponentProtocol, importlib.import_module(self.pkg_path)
Here is a complete debug log AMP debug log.txt
In .es always reconfigure
I just tried again as it works for me.
Core 2024.9.0.dev202408260813 Frontend 20240826.0.dev AMP 4.12.11
Manually changed the manifest.json to alexapy 1.29.0 Checked and fixed the python dependencies with pip.
Result: alexapy 1.29.0 has requirement aiofiles<24.0.0,>=23.1.0, but you have aiofiles 24.1.0.
Reboot HA.
New configuration:
TTS works, switching the "do not disturb" switch does not.
2024-08-26 16:03:13.225 DEBUG (MainThread) [alexapy.alexahttp2] Starting message parsing loop.
2024-08-26 16:03:13.225 DEBUG (MainThread) [alexapy.alexahttp2] Connecting to https://alexa.eu.gateway.devices.a2z.com/v20160207/directives with {'method': 'GET', 'path': '/v20160207/directives', 'authority': 'alexa.eu.gateway.devices.a2z.com', 'scheme': 'https', 'authorization': 'Bearer ...'}
2024-08-26 16:03:13.226 DEBUG (MainThread) [alexapy.alexahttp2] Preparing ping to https://alexa.eu.gateway.devices.a2z.com/ping
2024-08-26 16:03:13.396 DEBUG (MainThread) [alexapy.alexaapi] j*************h@g*******m: static GET: https://alexa.amazon.de/api/bootstrap returned 200:OK:application/json
2024-08-26 16:03:13.406 DEBUG (MainThread) [alexapy.alexaapi] j*************h@g*******m: static GET: https://alexa.amazon.de/api/devices-v2/device returned 200:OK:application/json
2024-08-26 16:03:13.446 DEBUG (MainThread) [alexapy.alexahttp2] Received raw message: --------abcde123
2024-08-26 16:03:13.480 DEBUG (MainThread) [alexapy.alexaapi] j*************h@g*******m: static GET: https://alexa.amazon.de/api/dnd/device-status-list returned 200:OK:application/json
2024-08-26 16:03:13.493 DEBUG (MainThread) [alexapy.alexahttp2] Received response: 204:
2024-08-26 16:03:13.638 DEBUG (MainThread) [alexapy.alexaapi] j*************h@g*******m: static GET: https://alexa.amazon.de/api/device-preferences returned 200:OK:application/json
2024-08-26 16:03:13.640 DEBUG (MainThread) [alexapy.alexaapi] j*************h@g*******m: static GET: https://alexa.amazon.de/api/bluetooth?cached=false returned 200:OK:application/json
2024-08-26 16:03:13.675 DEBUG (MainThread) [alexapy.alexaapi] j*************h@g*******m: static GET: https://alexa.amazon.de/api/phoenix returned 200:OK:application/json
Hi,
System details
Home Assistant version: 2024.8.3 alexa_media version: 4.12.11 alexapy version (from pip show alexapy in homeasssistant container or HA startup log): 1.29 Is Amazon [2FA/2SV enabled]): Yes Amazon Domain: .it
I changed the values in const.py as in the original post.
The integration is working pretty decent, I don't have to reauthenticate every 10 minutes like some days ago. If I don't "play" too much with TTS and update_last_called, it works.
I'm not a programmer or anything, just trying to understand so maybe what I write has no sense or is normal...
What I found now is that AMP was not able to login anymore for some time, than it started working again but the "reauthenticate" message appeared in home assistant (check log below).
Even though "reauthenticate" message is still there, if I just reload the integration it works. I don't need to do the authentication procedure.the TTS is working or at least not giving errors in the log (I'm not at home to hear if the TTS worked).
update_last_called still doesn't work, the sensor is not updated.
I just get the log
2024-08-27 11:40:48.595 DEBUG (MainThread) [custom_components.alexa_media.services] Service update_last_called for: []
2024-08-27 11:22:10.809 DEBUG (MainThread) [custom_components.alexa_media.helpers] alexa_media.media_player.refresh: detected bad login for s*****0@h********t: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-27 11:22:10.809 DEBUG (MainThread) [custom_components.alexa_media.helpers] Reporting need to relogin to amazon.it with s*****0@h********t stats: {'login_timestamp': datetime.datetime(2024, 8, 27, 11, 19, 27, 153377), 'api_calls': 22}
2024-08-27 11:22:10.810 DEBUG (MainThread) [custom_components.alexa_media] s*****0@h********t: Received relogin request: <Event alexa_media_relogin_required[L]: email=s*****0@h********t, url=amazon.it, stats=login_timestamp=2024-08-27T11:19:27.153377+02:00, api_calls=22>
2024-08-27 11:22:10.811 DEBUG (MainThread) [custom_components.alexa_media.helpers] s*****0@h********t: Returning uuid {'uuid': '051b68318db52310ca72e00409c9b9bc', 'index': 0}
2024-08-27 11:22:10.818 DEBUG (MainThread) [custom_components.alexa_media] s*****0@h********t: Received relogin request: <Event alexa_media_relogin_required[L]: email=s*****0@h********t, url=amazon.it, stats=login_timestamp=2024-08-27T11:19:27.153377+02:00, api_calls=22>
2024-08-27 11:22:10.818 DEBUG (MainThread) [custom_components.alexa_media.helpers] s*****0@h********t: Returning uuid {'uuid': '051b68318db52310ca72e00409c9b9bc', 'index': 0}
2024-08-27 11:22:10.824 DEBUG (MainThread) [custom_components.alexa_media] Testing login status: {}
2024-08-27 11:22:10.824 DEBUG (MainThread) [custom_components.alexa_media] Logging in: {'otp_secret': '4************************************************3BA', 'email': 's*****0@h********t', 'password': 'REDACTED 16 CHARS', 'url': 'amazon.it', 'scan_interval': 600, 'include_devices': '', 'exclude_devices': 'This Device, Ovunque, Sonos Cucina, Sonos Soggiorno', 'debug': False, 'oauth': {'access_token': 'A*********kYA', 'refresh_token': 'A**********1BA', 'expires_in': 1724753196.050189, 'mac_dms': {'device_private_key': ****}'}, 'code_verifier': '***', 'authorization_code': '***'}, 'public_url': '', 'queue_delay': 1.5, 'extended_entity_discovery': False} set()
2024-08-27 11:22:10.825 DEBUG (MainThread) [custom_components.alexa_media] Login stats: {'login_timestamp': datetime.datetime(2024, 8, 27, 11, 19, 27, 153377), 'api_calls': 22}
2024-08-27 11:22:10.825 DEBUG (MainThread) [custom_components.alexa_media] Creating new config flow to login
2024-08-27 11:22:10.838 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Creating reauth form with OrderedDict({'otp_secret': '4************************************************3BA', 'email': 's*****0@h********t', 'password': 'REDACTED 16 CHARS', 'url': 'amazon.it', 'scan_interval': 600, 'include_devices': '', 'exclude_devices': 'This Device, Ovunque, Sonos Cucina, Sonos Soggiorno', 'debug': False, 'reauth': True})
2024-08-27 11:22:10.838 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Attempting automatic relogin
2024-08-27 11:22:10.844 DEBUG (MainThread) [custom_components.alexa_media] Testing login status: {}
2024-08-27 11:22:10.844 DEBUG (MainThread) [custom_components.alexa_media] Logging in: {'otp_secret': '4************************************************3BA', 'email': 's*****0@h********t', 'password': 'REDACTED 16 CHARS', 'url': 'amazon.it', 'scan_interval': 600, 'include_devices': '', 'exclude_devices': 'This Device, Ovunque, Sonos Cucina, Sonos Soggiorno', 'debug': False, 'oauth': {'access_token': 'A********kYA', 'refresh_token': 'A*****1BA', 'expires_in': 1724753196.050189, 'mac_dms': {'device_private_key': '****}, 'code_verifier': '****', 'authorization_code': '****'}, 'public_url': '', 'queue_delay': 1.5, 'extended_entity_discovery': False} set()
2024-08-27 11:22:10.845 DEBUG (MainThread) [custom_components.alexa_media] Login stats: {'login_timestamp': datetime.datetime(2024, 8, 27, 11, 19, 27, 153377), 'api_calls': 22}
2024-08-27 11:22:10.845 DEBUG (MainThread) [custom_components.alexa_media] Creating new config flow to login
2024-08-27 11:22:10.847 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Creating reauth form with OrderedDict({'otp_secret': '4************************************************3BA', 'email': 's*****0@h********t', 'password': 'REDACTED 16 CHARS', 'url': 'amazon.it', 'scan_interval': 600, 'include_devices': '', 'exclude_devices': 'This Device, Ovunque, Sonos Cucina, Sonos Soggiorno', 'debug': False, 'reauth': True})
2024-08-27 11:22:10.847 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Attempting automatic relogin
2024-08-27 11:22:12.309 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
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/alexaapi.py", line 584, in run_custom
await self.send_sequence(
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/alexaapi.py", line 512, in send_sequence
await self.run_behavior(node_data, queue_delay=queue_delay)
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/alexaapi.py", line 434, in run_behavior
await self._post_request("/api/behaviors/preview", data=data)
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 226, in _post_request
return await self._request("post", uri, data, query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry
ret = await target(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 199, in _request
raise AlexapyLoginError("Login error detected; not contacting API")
alexapy.errors.AlexapyLoginError: Login error detected; not contacting API
2024-08-27 11:22:25.841 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Using existing login
2024-08-27 11:22:25.841 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Trying to login {}
2024-08-27 11:22:25.849 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Using existing login
2024-08-27 11:22:25.850 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Trying to login {}
2024-08-27 11:22:29.010 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Testing login status: {'login_successful': True}
2024-08-27 11:22:29.011 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Reauth successful for s*****0@h********t
2024-08-27 11:22:29.011 DEBUG (MainThread) [custom_components.alexa_media] Received Login success: <Event alexa_media_relogin_success[L]: email=s*****0@h********t, url=amazon.it>
Login Attempts and Reauthentications:
The logs show repeated attempts to log into Amazon. Notably, after a successful login at 2024-08-27 11:19:27.153377
, a "bad login" is detected again within a few minutes (2024-08-27 11:22:10.809
). This suggests that the integration repeatedly tried to access the API, which may have been perceived as suspicious by Amazon, necessitating reauthentication.
Multiple Error Messages:
The repeated error messages, particularly the AlexapyLoginError
, which indicates that a "login error was detected" and that the API is not being contacted, suggest that the integration is having trouble maintaining authentication. This could be due to making too frequent requests to the API, which Amazon might interpret as abuse.
API Call Patterns:
Between the first and second relevant login attempts, approximately 2 minutes and 43 seconds elapsed during which 22 API calls were made. This relatively high number of requests in such a short time could be the reason Amazon interrupted the authentication to ensure that the user is legitimate. This could have been triggered by internal security features or rate limits that might exhibit similar behavior patterns as those in the better-documented AWS services.
In Summary:
Frequent API Calls and Authentication Errors:
The logs show a pattern of frequent API calls and repeated authentication errors, indicating that the integration might be trying too aggressively to access the Amazon API.
Potential Rate Limits or Security Mechanisms:
The repeated prompts for reauthentication could be a result of security features designed to prevent suspicious behavior or of implicit rate limits leading to throttling, as is the case with other Amazon APIs.
Possible Solutions:
- Login Attempts and Reauthentications: The logs show repeated attempts to log into Amazon. Notably, after a successful login at
2024-08-27 11:19:27.153377
, a "bad login" is detected again within a few minutes (2024-08-27 11:22:10.809
). This suggests that the integration repeatedly tried to access the API, which may have been perceived as suspicious by Amazon, necessitating reauthentication.- Multiple Error Messages: The repeated error messages, particularly the
AlexapyLoginError
, which indicates that a "login error was detected" and that the API is not being contacted, suggest that the integration is having trouble maintaining authentication. This could be due to making too frequent requests to the API, which Amazon might interpret as abuse.- API Call Patterns: Between the first and second relevant login attempts, approximately 2 minutes and 43 seconds elapsed during which 22 API calls were made. This relatively high number of requests in such a short time could be the reason Amazon interrupted the authentication to ensure that the user is legitimate. This could have been triggered by internal security features or rate limits that might exhibit similar behavior patterns as those in the better-documented AWS services.
In Summary:
- Frequent API Calls and Authentication Errors: The logs show a pattern of frequent API calls and repeated authentication errors, indicating that the integration might be trying too aggressively to access the Amazon API.
- Potential Rate Limits or Security Mechanisms: The repeated prompts for reauthentication could be a result of security features designed to prevent suspicious behavior or of implicit rate limits leading to throttling, as is the case with other Amazon APIs.
Possible Solutions:
- Reduce API Call Frequency: It might be helpful to reduce the number of API calls and adopt less aggressive access patterns. This could prevent Amazon from flagging the requests as suspicious and requiring reauthentication.
- Adjust Integration Settings: We should consider adjusting the integration settings to generate fewer API calls, thereby minimizing the likelihood of triggering rate limits or security measures.
OK, all correct! but then why doesn't this happen with the July version of HA??
Hi, I just changed the scan interval to 3600. It's working despite I immediately got this error:
2024-08-27 13:59:48.076 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry **.@****.com - amazon.it for notify Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 819, in async_unload result = await component.async_unload_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/notify/init.py", line 135, in async_unload_entry return await component.async_unload_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 202, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded!
What does it mean?
Before 3600 it was 600 secs and AMP worked for a day.
AMP 4.12.11 core 2024.08.2
In .es always reconfigure
I can't help as I don't use .es...
switching the "do not disturb" switch does not.
This sounds like http2 is not connected...
OK, all correct! but then why doesn't this happen with the July version of HA??
Perhaps there are bugs in the dependent Python libraries, and Home Assistant 2024.8.x is using exactly those buggy versions.
I have a developer version of HA: 2024.9.x.DEV Here I attached my requirements.txt
It's not possible to install it with:
pip install -r requirements.txt
I get:
The conflict is caused by: The user requested aiofiles==24.1.0 alexapy 1.29.0 depends on aiofiles<24.0.0 and >=23.1.0
But it's possible to overwrite this with, but you shouldn't do it unless you know how to roll back if it breaks:
pip install --no-deps -r requirements.txt
But maybe it's useful to compare the library versions?
You can get this list with:
pip install pipdeptree
pipdeptree --packages alexapy --freeze > requirements.txt
pipdeptree --packages wrapt --freeze >> requirements.txt
pipdeptree --packages packaging --freeze >> requirements.txt
Hi, I just changed the scan interval to 3600. It's working despite I immediately got this error: ... entry was never loaded!") ValueError: Config entry was never loaded!
What does it mean?
Before 3600 it was 600 secs and AMP worked for a day.
AMP 4.12.11 core 2024.08.2
Oh? I had this issue after an HA upgrade, too. Nonetheless, the integration still worked. I removed the configuration and created a new one, then I could reload without this error.
update_last_called still doesn't work, the sensor is not updated.
Yes, Amazon ceased issuing the command "PUSH_ACTIVITY" via http2push back in June which negated AMP's ability to automatically update LAST_ALEXA via that command.
Hi, I just changed the scan interval to 3600. It's working despite I immediately got this error:
2024-08-27 13:59:48.076 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry .@.com - amazon.it for notify Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 819, in async_unload result = await component.async_unload_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/notify/init**.py", line 135, in async_unload_entry return await component.async_unload_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 202, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded!
What does it mean?
Before 3600 it was 600 secs and AMP worked for a day.
AMP 4.12.11 core 2024.08.2
You can safely disregard that error as it would seem to be irrelevant. I've witnessed trying to unload a config entry that was never loaded but when I try and troubleshoot the reason then it doesn't happen! If it tries to unload a config entry that isn't loaded it should silently proceed, or maybe issue a warning, but not an error! If I could pinpoint it, I'd try and fix it!
Hi, I just changed the scan interval to 3600. It's working despite I immediately got this error: ... entry was never loaded!") ValueError: Config entry was never loaded! What does it mean? Before 3600 it was 600 secs and AMP worked for a day. AMP 4.12.11 core 2024.08.2
Oh? I had this issue after an HA upgrade, too. Nonetheless, the integration still worked. I removed the configuration and created a new one, then I could reload without this error.
unfortunately I am not able to give this kind of collaboration. I chose to install OS of HA precisely because I am not able to manage, I'm really sorry 😭
I have been inside AMP for a while now attempting to dissect it, and comparing it to other "standard" integrations is difficult as nothing else seems to try and do what AMP does, and nothing else is structured quite the way AMP is.
Also, my overall understanding of all the HA python workings is still very limited and to illustrate, I was bothered by the fact that http2connect was remaining active after removing the integration config entry. Removing it should have terminated the http2 connection but didn't. I analyzed the code flow for hours and finally inserted a _LOGGER.debug statement to try and see what was going on, removed the config entry, restarted to implement my code addition, re-added config entry and then removed it. My debug line logged my message Connections closed: True
and a check of debug messages for http2 showed that http had ceased this time! So it would seem that my simple addition of the _LOGGER.debug statement somehow allowed the connection to close and log my message. Why? It's beyond my current HA debug abilities of HA to figure out, despite my 35+ years in computer technology programming and debugging!
unfortunately I am not able to give this kind of collaboration. I chose to install OS of HA precisely because I am not able to manage, I'm really sorry
No worries, thanks!
hello,
not clear if someone solve the issues. I have done following change but without good result: In const.py, try editing these constants as follows: From:
SCAN_INTERVAL = timedelta(seconds=60)
MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(seconds=1)
DEFAULT_SCAN_INTERVAL = 60
To:
SCAN_INTERVAL = timedelta(seconds=180)
MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(seconds=5)
DEFAULT_SCAN_INTERVAL = 300
the reconfiguration pop up appears continuously:
just after the HA restart this is the situation:
hello,
not clear if someone solve the issues. I have done following change but without good result: In const.py, try editing these constants as follows: From:
SCAN_INTERVAL = timedelta(seconds=60) MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(seconds=1) DEFAULT_SCAN_INTERVAL = 60
To:
SCAN_INTERVAL = timedelta(seconds=180) MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(seconds=5) DEFAULT_SCAN_INTERVAL = 300
the reconfiguration pop up appears continuously:
just after the HA restart this is the situation:
Hai risolto?
hello, not clear if someone solve the issues. I have done following change but without good result: In const.py, try editing these constants as follows: From:
SCAN_INTERVAL = timedelta(seconds=60) MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(seconds=1) DEFAULT_SCAN_INTERVAL = 60
To:
SCAN_INTERVAL = timedelta(seconds=180) MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(seconds=5) DEFAULT_SCAN_INTERVAL = 300
the reconfiguration pop up appears continuously: just after the HA restart this is the situation:
Hai risolto?
till now seem working well but i'm sure that after "x" time the reconfiguration will be requested again from system (why is not clear).
No way to get it working for a whole day: it works only for a while after the integration has been loaded, but after a certain amunt of time it raises Error doing job: Task exception was never retrieved (None) if an automation tries to send a notification to a device
I use amazon.es and i have the same problem, alexa integration request for relogin every few minutes and not work until restart HA o reload integration
i try to uninstall and reinstall integration, removing .pickle file but, nothing works
To anyone:
Hi, I'm crossing fingers because it's working for 3 days continuously after days of struggle with TTS notifications and reauthentication requirements. I have 2SV with mobile phone OTP (as main method) and the authenticator APP for AMP. AMP 4.12.11 core 2024.8.2 HA OS amazon.it none of the suggested settings aside Seconds Between Scans: 3600.
My working setup:
amazon.it
4.12.11
(+ forcing alexapy >= 1.29.0
+ modified consts.py
as per this thread)2024.8.3
600
In my case, what led to a stable connection was turning completely off alexa_media.update_last_called
in my automations.
I can manually invoke it without losing login, but as part of the automation (invoked before every time I asked alexa to speak, was quickly leading to login errors.
It's likely the underlying error that triggers too many API calls is still in the codebase, as speculated, triggered by fixing bugs in aiohttp, but my system is stable with this config.
My working setup:
- Domain:
amazon.it
- AMP:
4.12.11
(+ forcingalexapy >= 1.29.0
+ modifiedconsts.py
as per this thread)- HAOS:
2024.8.3
- Using built-in 2FA
- Configured Seconds Between Scans:
600
- No scheduled reloads of the Integration.
In my case, what led to a stable connection was turning completely off
alexa_media.update_last_called
in my automations.I can manually invoke it without losing login, but as part of the automation (invoked before every time I asked alexa to speak, was quickly leading to login errors.
It's likely the underlying error that triggers too many API calls is still in the codebase, as speculated, triggered by fixing bugs in aiohttp, but my system is stable with this config.
Same configuration but it stops working after a while, as usual
In my case, what led to a stable connection was turning completely off
alexa_media.update_last_called
in my automations.I can manually invoke it without losing login, but as part of the automation (invoked before every time I asked alexa to speak, was quickly leading to login errors.
Maybe the const.py changes may help here?
@danielbrunt57
HAOS 2024.7.4 ".fr" user here and I didn't stumble on this issue a single time. Upgraded to Alexa_media_player 4.12.11, and it's working perfectly. Really wonder what shenanigan 2024.8.X changed to trigger such error.
HAOS 2024.7.4 ".fr" user here and I didn't stumble on this issue a single time. Upgraded to Alexa_media_player 4.12.11, and it's working perfectly. Really wonder what shenanigan 2024.8.X changed to trigger such error.
Nobody experienced any issue with version < 2024.8.x
HAOS 2024.7.4 ".fr" user here and I didn't stumble on this issue a single time.
Upgraded to Alexa_media_player 4.12.11, and it's working perfectly.
Really wonder what shenanigan 2024.8.X changed to trigger such error.
This is not a great news.
It's a known thing that HA > 2024.8.x caused the issue.
Unfortunately here in Italy the integration still does not work. I reconfigure the integration, but after a few minutes it disconnects again. I also tried to reconfigure the 2FA association, but the problem remains the same.
Unfortunately here in Italy the integration still does not work.
Logs?
Unfortunately here in Italy the integration still does not work.
Logs?
Mine is currently working with polling disabled, alexapy 1.29.00 and latest version of HA and AMP. I'm not requesting much from the API with polling disabled though... As a test I will try enable polling again, I think I will be able to give you some logs tomorrow.
EDIT:
well it didn't take long... I enabled polling, restarted AMP and I got a 400 bad request
Here below the logs. Why is trying to login through amazon.com(at 21:03:07.122)? I guess that's why it can't login... it should login as amazon.it
This is a bad login:
2024-09-01 21:03:07.080 DEBUG (MainThread) [custom_components.alexa_media] Loaded alexapy==1.29.0
2024-09-01 21:03:07.080 DEBUG (MainThread) [custom_components.alexa_media.helpers] s*****0@h********t: Returning uuid {'uuid': '051b68318db52310ca72e00409c9b9bc', 'index': 0}
2024-09-01 21:03:07.118 DEBUG (MainThread) [alexapy.alexalogin] Creating TOTP for O************************************************VIA
2024-09-01 21:03:07.118 DEBUG (MainThread) [alexapy.alexalogin] Generating OTP ******
2024-09-01 21:03:07.119 DEBUG (MainThread) [alexapy.alexalogin] Login created for myemail@myemail.it - amazon.it
2024-09-01 21:03:07.119 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/.storage/alexa_media.myemail@myemail.it.pickle
2024-09-01 21:03:07.120 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/alexa_media.myemail@myemail.it.pickle
2024-09-01 21:03:07.121 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/.storage/alexa_media.myemail@myemail.it.txt
2024-09-01 21:03:07.121 DEBUG (MainThread) [alexapy.alexalogin] Using credentials to log in
2024-09-01 21:03:07.122 DEBUG (MainThread) [alexapy.alexalogin] Attempting oauth login to https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:303531623638333138646235323331306361373265303034303963396239626332333431333234393536346335363335353634643332353733383331&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=code&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&openid.oa2.code_challenge_method=S256&openid.oa2.code_challenge=wtcc5FQKKvqcyGdZ3eL7CDR_58LMIKfVS_YfDoFNurk&language=it_IT
2024-09-01 21:03:07.314 DEBUG (MainThread) [alexapy.alexalogin] GET:
https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:303531623638333138646235323331306361373265303034303963396239626332333431333234393536346335363335353634643332353733383331&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=code&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&openid.oa2.code_challenge_method=S256&openid.oa2.code_challenge=wtcc5FQKKvqcyGdZ3eL7CDR_58LMIKfVS_YfDoFNurk&language=it_IT returned 200:OK with response <CIMultiDictProxy('Content-Type': 'text/html', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Server': 'Server', 'Date': 'Sun, 01 Sep 2024 19:03:07 GMT', 'x-amz-rid': 'PE357KZCHGPETQC0A3E2', 'Strict-Transport-Security': 'max-age=47474747; includeSubDomains; preload', 'Vary': 'Content-Type,Accept-Encoding,User-Agent', 'Content-Encoding': 'gzip', 'p3p': 'policyref="http://www.amazon.com/w3c/p3p.xml",CP="CAO DSP LAW CUR ADM IVAo IVDo CONo OTPo OUR DELi PUBi OTRi BUS PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA HEA PRE LOC GOV OTC "', 'X-Frame-Options': 'SAMEORIGIN', 'X-Cache': 'Miss from cloudfront', 'Via': '1.1 5a897fa3742273380e3e2532c7dadcb6.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'MXP64-P1', 'Alt-Svc': 'h3=":443"; ma=86400', 'X-Amz-Cf-Id': 'wIpzokuuv4Yp_knvHG0tuW0qUDa3RvmUlSS8R0e7S3SKLsujHT-QBQ==')>
2024-09-01 21:03:07.314 DEBUG (MainThread) [alexapy.alexalogin] Processing https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:303531623638333138646235323331306361373265303034303963396239626332333431333234393536346335363335353634643332353733383331&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=code&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&openid.oa2.code_challenge_method=S256&openid.oa2.code_challenge=wtcc5FQKKvqcyGdZ3eL7CDR_58LMIKfVS_YfDoFNurk&language=it_IT
2024-09-01 21:03:07.346 DEBUG (MainThread) [alexapy.alexalogin] Captcha/2FA not requested; confirming login.
2024-09-01 21:03:07.348 DEBUG (MainThread) [alexapy.alexalogin] Attempting to register with amazon.it
2024-09-01 21:03:07.758 DEBUG (MainThread) [alexapy.alexalogin] auth response <ClientResponse(https://api.amazon.it/auth/register) [400 Bad Request]>
This is a good login:
2024-08-30 22:29:12.951 DEBUG (MainThread) [custom_components.alexa_media] Loaded alexapy==1.29.0
2024-08-30 22:29:12.951 DEBUG (MainThread) [custom_components.alexa_media.helpers] s*****0@h********t: Returning uuid {'uuid': '051b68318db52310ca72e00409c9b9bc', 'index': 0}
2024-08-30 22:29:12.997 DEBUG (MainThread) [alexapy.alexalogin] Creating TOTP for O************************************************VIA
2024-08-30 22:29:12.997 DEBUG (MainThread) [alexapy.alexalogin] Generating OTP ******
2024-08-30 22:29:12.998 DEBUG (MainThread) [alexapy.alexalogin] Login created for myemail@myemail.it - amazon.it
2024-08-30 22:29:12.999 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/.storage/alexa_media.myemail@myemail.it.pickle
2024-08-30 22:29:13.000 DEBUG (MainThread) [alexapy.alexalogin] Trying to load cookie from file /config/.storage/alexa_media.myemail@myemail.it.pickle
2024-08-30 22:29:13.029 DEBUG (MainThread) [alexapy.alexalogin] Trying to load aiohttpCookieJar to session
2024-08-30 22:29:13.042 DEBUG (MainThread) [alexapy.alexalogin] Loaded 8 cookies
2024-08-30 22:29:13.044 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/alexa_media.myemail@myemail.it.pickle
2024-08-30 22:29:13.044 DEBUG (MainThread) [alexapy.alexalogin] Using cookies to log in
2024-08-30 22:29:13.045 DEBUG (MainThread) [alexapy.alexalogin] Attempting to register with amazon.it
2024-08-30 22:29:13.954 DEBUG (MainThread) [alexapy.alexalogin] auth response <ClientResponse(https://api.amazon.it/auth/register) [200 OK]>
EDIT 2:
Reloading AMP still got me [400 bad request]
.
Restarting HA instead gave me a [200 OK]
again
Unfortunately here in Italy the integration still does not work. I reconfigure the integration, but after a few minutes it disconnects again. I also tried to reconfigure the 2FA association, but the problem remains the same.
I'm in Italy too and I have It working.. kind of. Depending on your use you could try to disable polling to see if it gets better. I only use mine for TTS and room awareness (for covers and heating) scripts with last_called attributes.
Unfortunately here in Italy the integration still does not work.
Logs?
here it is. It was working 15 minutes ago, and it has every time.
Here is a complete debug log AMP debug log.txt
Analysis done by ChatGPT:
09:54:08.282:
alexapy
library is loaded, version 1.28.2.09:54:08.295:
c************e@y********m
on the amazon.it
domain begins./config/.storage/alexa_media.c************e@y********m.pickle
to facilitate and speed up re-authentication.09:54:08.309:
amazon.it
.09:54:08.795:
amazon.it
fails with a 401 Unauthorized
error.https://api.amazon.it/auth/register
was made using the loaded cookies and other authentication data.401 Unauthorized
, indicating that the provided authentication data was invalid or expired.09:54:08.796:
amazon.com
also fails with a 401 Unauthorized
error.amazon.com
.09:54:09.295:
Unable to register with ['amazon.it', 'amazon.com']
.09:54:09.564:
https://api.amazonalexa.com/v1/devices/@self/capabilities
, receiving a 403 Forbidden
response.403 Forbidden
error.09:54:09.950:
5 cookies successfully exchanged for refresh token for domain .amazon.it
.09:54:10.693:
https://alexa.amazon.com/api/bootstrap
, receiving a 401 Unauthorized
error.09:54:10.914:
amazon.it
(Logged in as c************e@y********m to amazon.it
).09:54:11.138:
Login confirmed for...
).I have polling currently disabled but AMP still stops working sometimes, showing auth response <ClientResponse(https://api.amazon.it/auth/register) [400 Bad Request]>
when reloading the integration or [401 Unauthorized]
After days of testing I'm 99% sure that the issue is not related to Too many requests
, at least in my case of course.
I tried TTS and update_last_called 11 times in around 30 minutes right after restarting HA. All worked, not a single issue.
I will try again this evening but I'm pretty sure I won't be able to get so much success when calling update_last_called... maybe I will be able to run 1 or 2 update_last_called before getting[401 Unauthorized]
and having to restart HA.
Below is what happened during the night, of course nobody was doing anything... Not sure why http2 was closed (at 02:45:32.712 ) and which autorization token was missing (02:45:32.979). http2 was completely closed at 02:45:35.587 and never restarted.
2024-09-03 02:45:15.708 DEBUG (MainThread) [alexapy.alexahttp2] Preparing ping to https://alexa.eu.gateway.devices.a2z.com/ping
2024-09-03 02:45:15.768 DEBUG (MainThread) [alexapy.alexahttp2] Received response: 204:
2024-09-03 02:45:32.712 DEBUG (MainThread) [alexapy.alexahttp2] HTTP2 Connection Closed.
2024-09-03 02:45:32.714 DEBUG (MainThread) [custom_components.alexa_media] s*****0@h********t: HTTP2 push closed; reconnect #0 in 5s
2024-09-03 02:45:32.756 DEBUG (MainThread) [custom_components.alexa_media] s*****0@h********t: HTTP2 created: <alexapy.alexahttp2.HTTP2EchoClient object at 0x7f85faf080>
2024-09-03 02:45:32.757 DEBUG (MainThread) [custom_components.alexa_media] s*****0@h********t: HTTP2push successfully connected
2024-09-03 02:45:32.757 DEBUG (MainThread) [alexapy.alexahttp2] Starting message parsing loop.
2024-09-03 02:45:32.757 DEBUG (MainThread) [alexapy.alexahttp2] Connecting to https://alexa.eu.gateway.devices.a2z.com/v20160207/directives with {'method': 'GET', 'path': '/v20160207/directives', 'authority': 'alexa.eu.gateway.devices.a2z.com', 'scheme': 'https', 'authorization': 'Bearer Atna|EwICIGk3MAU0L2OWgIac-Tg7NIlzfcUQz4-FlY9sEc2qkUSfvczCJVvQ0RBNzoa1IfUa261pEQ19ut1dKzGgv55vfOZh7McfoAKjOY_23emjJZl6GRUYj_ScziPaAtp9p2hA_t7p1TPBebe1IuT4uqd7pCxrPBd8HNhUnsgQq5dUhtDNIZUTA9h2TGKViyVabf-POD9ePBw3blrcZrFUUeXZGOe7uAgEJeGXykpC94OEtFYcLZcAwBLjdvJyaibHcXLkJrt7_YliKVpm9dsuoSPs-XXFP4dvJBnTcqIbTk5IdX9bb40CmhCWHY8bM-r50Kb-beaycY3o12SzfE-BRcN5r6y8yjOyUEmJW8iWkFnuS0oYrdUxm8Grk7MFHA68YgcrVNg'}
2024-09-03 02:45:32.758 DEBUG (MainThread) [alexapy.alexahttp2] Preparing ping to https://alexa.eu.gateway.devices.a2z.com/ping
2024-09-03 02:45:32.979 DEBUG (MainThread) [alexapy.alexahttp2] Received raw message: Unable to authenticate the request. Please provide a valid authorization token.
2024-09-03 02:45:32.979 DEBUG (MainThread) [alexapy.alexahttp2] HTTP2 login error: Unable to authenticate the request. Please provide a valid authorization token.
2024-09-03 02:45:32.981 DEBUG (MainThread) [alexapy.alexalogin] Attempting to register with amazon.it
2024-09-03 02:45:33.262 DEBUG (MainThread) [alexapy.alexalogin] auth response <ClientResponse(https://api.amazon.it/auth/register) [401 Unauthorized]>
<CIMultiDictProxy('Server': 'Server', 'Date': 'Tue, 03 Sep 2024 00:45:33 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '253', 'Connection': 'keep-alive', 'x-amz-rid': 'TQNAA3G7YER9RMJQHHKS', 'x-amzn-RequestId': '1ecbd640-0b04-4b54-b535-5ff13516fe0e', 'X-Amz-Date': 'Tue, 03 Sep 2024 00:45:33 GMT', 'WWW-Authenticate': 'Basic realm="api.amazon.it/auth/register"', 'Cache-Control': 'no-cache, no-store, must-revalidate', 'x-amzn-Remapped-WWW-Authenticate': 'Basic realm="api.amazon.it/auth/register"', 'Pragma': 'no-cache', 'Vary': 'Content-Type,Accept-Encoding,User-Agent', 'Strict-Transport-Security': 'max-age=47474747; includeSubDomains; preload')>
with
{"requested_extensions": ["device_info", "customer_info"], "cookies": {"website_cookies": [], "domain": ".amazon.it"}, "registration_data": {"domain": "Device", "app_version": "2.2.556530.0", "device_type": "A2IVLV5VM2W81", "device_name": "%FIRST_NAME%'s%DUPE_STRATEGY_1ST%Alexa Media Player", "os_version": "16.6", "device_serial": "051b68318db52310ca72e00409c9b9bc", "device_model": "iPhone", "app_name": "Alexa Media Player", "software_version": "1"}, "auth_data": {"access_token": "Atna|EwICIGk3MAU0L2OWgIac-Tg7NIlzfcUQz4-FlY9sEc2qkUSfvczCJVvQ0RBNzoa1IfUa261pEQ19ut1dKzGgv55vfOZh7McfoAKjOY_23emjJZl6GRUYj_ScziPaAtp9p2hA_t7p1TPBebe1IuT4uqd7pCxrPBd8HNhUnsgQq5dUhtDNIZUTA9h2TGKViyVabf-POD9ePBw3blrcZrFUUeXZGOe7uAgEJeGXykpC94OEtFYcLZcAwBLjdvJyaibHcXLkJrt7_YliKVpm9dsuoSPs-XXFP4dvJBnTcqIbTk5IdX9bb40CmhCWHY8bM-r50Kb-beaycY3o12SzfE-BRcN5r6y8yjOyUEmJW8iWkFnuS0oYrdUxm8Grk7MFHA68YgcrVNg"}, "user_context_map": {"frc": "wGnfIcut4458zo0XMa9IGsFZJRL7epG0MqBfqpTo3XQmcql5ncex/QCVydRLc3/YFfWqqDoX4SD1+VOZzgIp32tQs+suGNzRD7BpWBA/y2mDwC5fbmFO78QT2pMpLzDERvNgWdyUvEGaFpQNmB6k1Db5ttsMSCEem328WWOzm2qhEK8KEhJPY0hlaHWWEYBhaD/kPS/tuUVXRVowkqx970kLTGI66zQ9GvyN9zAynDQBavMn+FXMGzjX65zzpUPF2dDtv9oHoZE5PSDAOXJ0pPOC+pfBZHOx0ska9qcF8jZob1HbKZO8iyV0T+rBVv2uA77fkJHm2tzd2/wS0pHg+AfFOFYS2uxjHuI96uM9ESAcNwCYor4wCe/L5e1MUHSrYeTMfyUa1VlUtFmU4IOKTAuqAGYieWQHsg"}, "requested_token_type": ["bearer", "mac_dms", "website_cookies"]}
2024-09-03 02:45:33.264 DEBUG (MainThread) [alexapy.alexalogin] Attempting to register with amazon.com
2024-09-03 02:45:33.682 DEBUG (MainThread) [alexapy.alexalogin] auth response <ClientResponse(https://api.amazon.com/auth/register) [401 Unauthorized]>
<CIMultiDictProxy('Server': 'Server', 'Date': 'Tue, 03 Sep 2024 00:45:33 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '254', 'Connection': 'keep-alive', 'x-amz-rid': 'K8R472M2PJF5P9BFKP1V', 'x-amzn-RequestId': '276c4d75-e28b-4c0c-9705-0ca9fa73ecf1', 'X-Amz-Date': 'Tue, 03 Sep 2024 00:45:33 GMT', 'WWW-Authenticate': 'Basic realm="api.amazon.com/auth/register"', 'Cache-Control': 'no-cache, no-store, must-revalidate', 'x-amzn-Remapped-WWW-Authenticate': 'Basic realm="api.amazon.com/auth/register"', 'Pragma': 'no-cache', 'Vary': 'Content-Type,Accept-Encoding,User-Agent', 'Strict-Transport-Security': 'max-age=47474747; includeSubDomains; preload')>
with
{"requested_extensions": ["device_info", "customer_info"], "cookies": {"website_cookies": [], "domain": ".amazon.com"}, "registration_data": {"domain": "Device", "app_version": "2.2.556530.0", "device_type": "A2IVLV5VM2W81", "device_name": "%FIRST_NAME%'s%DUPE_STRATEGY_1ST%Alexa Media Player", "os_version": "16.6", "device_serial": "051b68318db52310ca72e00409c9b9bc", "device_model": "iPhone", "app_name": "Alexa Media Player", "software_version": "1"}, "auth_data": {"access_token": "Atna|EwICIGk3MAU0L2OWgIac-Tg7NIlzfcUQz4-FlY9sEc2qkUSfvczCJVvQ0RBNzoa1IfUa261pEQ19ut1dKzGgv55vfOZh7McfoAKjOY_23emjJZl6GRUYj_ScziPaAtp9p2hA_t7p1TPBebe1IuT4uqd7pCxrPBd8HNhUnsgQq5dUhtDNIZUTA9h2TGKViyVabf-POD9ePBw3blrcZrFUUeXZGOe7uAgEJeGXykpC94OEtFYcLZcAwBLjdvJyaibHcXLkJrt7_YliKVpm9dsuoSPs-XXFP4dvJBnTcqIbTk5IdX9bb40CmhCWHY8bM-r50Kb-beaycY3o12SzfE-BRcN5r6y8yjOyUEmJW8iWkFnuS0oYrdUxm8Grk7MFHA68YgcrVNg"}, "user_context_map": {"frc": "wGnfIcut4458zo0XMa9IGsFZJRL7epG0MqBfqpTo3XQmcql5ncex/QCVydRLc3/YFfWqqDoX4SD1+VOZzgIp32tQs+suGNzRD7BpWBA/y2mDwC5fbmFO78QT2pMpLzDERvNgWdyUvEGaFpQNmB6k1Db5ttsMSCEem328WWOzm2qhEK8KEhJPY0hlaHWWEYBhaD/kPS/tuUVXRVowkqx970kLTGI66zQ9GvyN9zAynDQBavMn+FXMGzjX65zzpUPF2dDtv9oHoZE5PSDAOXJ0pPOC+pfBZHOx0ska9qcF8jZob1HbKZO8iyV0T+rBVv2uA77fkJHm2tzd2/wS0pHg+AfFOFYS2uxjHuI96uM9ESAcNwCYor4wCe/L5e1MUHSrYeTMfyUa1VlUtFmU4IOKTAuqAGYieWQHsg"}, "requested_token_type": ["bearer", "mac_dms", "website_cookies"]}
2024-09-03 02:45:33.683 DEBUG (MainThread) [alexapy.alexalogin] Unable to register with ['amazon.it', 'amazon.com']
2024-09-03 02:45:33.870 DEBUG (MainThread) [alexapy.alexalogin] capabilities response <ClientResponse(https://api.amazonalexa.com/v1/devices/@self/capabilities) [403 Forbidden]>
<CIMultiDictProxy('Content-Length': '0', 'Connection': 'keep-alive', 'Server': 'Server', 'Date': 'Tue, 03 Sep 2024 00:45:33 GMT', 'x-amz-rid': 'BDBJQ9Q18CK9X8JQH6CW', 'Vary': 'Content-Type,Accept-Encoding,User-Agent', 'Strict-Transport-Security': 'max-age=47474747; includeSubDomains; preload', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 fd1922963c91836bd3bc6df1671c0612.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'MXP64-P1', 'X-Amz-Cf-Id': 'V_cVpjG7aVkOvtwHFRJDpP_HiVOLNXua77iHlCID0ridEdQXQIr1DA==')>
with
{"legacyFlags": {"SUPPORTS_COMMS": true, "SUPPORTS_ARBITRATION": true, "SCREEN_WIDTH": 1170, "SUPPORTS_SCRUBBING": true, "SPEECH_SYNTH_SUPPORTS_TTS_URLS": false, "SUPPORTS_HOME_AUTOMATION": true, "SUPPORTS_DROPIN_OUTBOUND": true, "FRIENDLY_NAME_TEMPLATE": "VOX", "SUPPORTS_SIP_OUTBOUND_CALLING": true, "VOICE_PROFILE_SWITCHING_DISABLED": true, "SUPPORTS_LYRICS_IN_CARD": false, "SUPPORTS_DATAMART_NAMESPACE": "Vox", "SUPPORTS_VIDEO_CALLING": true, "SUPPORTS_PFM_CHANGED": true, "SUPPORTS_TARGET_PLATFORM": "TABLET", "SUPPORTS_SECURE_LOCKSCREEN": false, "AUDIO_PLAYER_SUPPORTS_TTS_URLS": false, "SUPPORTS_KEYS_IN_HEADER": false, "SUPPORTS_MIXING_BEHAVIOR_FOR_AUDIO_PLAYER": false, "AXON_SUPPORT": true, "SUPPORTS_TTS_SPEECHMARKS": true}, "envelopeVersion": "20160207", "capabilities": [{"version": "0.1", "interface": "CardRenderer", "type": "AlexaInterface"}, {"interface": "Navigation", "type": "AlexaInterface", "version": "1.1"}, {"type": "AlexaInterface", "version": "2.0", "interface": "Alexa.Comms.PhoneCallController"}, {"type": "AlexaInterface", "version": "1.1", "interface": "ExternalMediaPlayer"}, {"type": "AlexaInterface", "interface": "Alerts", "configurations": {"maximumAlerts": {"timers": 2, "overall": 99, "alarms": 2}}, "version": "1.3"}, {"version": "1.0", "interface": "Alexa.Display.Window", "type": "AlexaInterface", "configurations": {"templates": [{"type": "STANDARD", "id": "app_window_template", "configuration": {"sizes": [{"id": "fullscreen", "type": "DISCRETE", "value": {"value": {"height": 1440, "width": 3200}, "unit": "PIXEL"}}], "interactionModes": ["mobile_mode", "auto_mode"]}}]}}, {"type": "AlexaInterface", "interface": "AccessoryKit", "version": "0.1"}, {"type": "AlexaInterface", "interface": "Alexa.AudioSignal.ActiveNoiseControl", "version": "1.0", "configurations": {"ambientSoundProcessingModes": [{"name": "ACTIVE_NOISE_CONTROL"}, {"name": "PASSTHROUGH"}]}}, {"interface": "PlaybackController", "type": "AlexaInterface", "version": "1.0"}, {"version": "1.0", "interface": "Speaker", "type": "AlexaInterface"}, {"version": "1.0", "interface": "SpeechSynthesizer", "type": "AlexaInterface"}, {"version": "1.0", "interface": "AudioActivityTracker", "type": "AlexaInterface"}, {"type": "AlexaInterface", "interface": "Alexa.Camera.LiveViewController", "version": "1.0"}, {"type": "AlexaInterface", "version": "1.0", "interface": "Alexa.Input.Text"}, {"type": "AlexaInterface", "interface": "Alexa.PlaybackStateReporter", "version": "1.0"}, {"version": "1.1", "interface": "Geolocation", "type": "AlexaInterface"}, {"interface": "Alexa.Health.Fitness", "version": "1.0", "type": "AlexaInterface"}, {"interface": "Settings", "type": "AlexaInterface", "version": "1.0"}, {"configurations": {"interactionModes": [{"dialog": "SUPPORTED", "interactionDistance": {"value": 18, "unit": "INCHES"}, "video": "SUPPORTED", "keyboard": "SUPPORTED", "id": "mobile_mode", "uiMode": "MOBILE", "touch": "SUPPORTED"}, {"video": "UNSUPPORTED", "dialog": "SUPPORTED", "interactionDistance": {"value": 36, "unit": "INCHES"}, "uiMode": "AUTO", "touch": "SUPPORTED", "id": "auto_mode", "keyboard": "UNSUPPORTED"}]}, "type": "AlexaInterface", "interface": "Alexa.InteractionMode", "version": "1.0"}, {"type": "AlexaInterface", "configurations": {"catalogs": [{"type": "IOS_APP_STORE", "identifierTypes": ["URI_HTTP_SCHEME", "URI_CUSTOM_SCHEME"]}]}, "version": "0.2", "interface": "Alexa.Launcher"}, {"interface": "System", "version": "1.0", "type": "AlexaInterface"}, {"interface": "Alexa.IOComponents", "type": "AlexaInterface", "version": "1.4"}, {"type": "AlexaInterface", "interface": "Alexa.FavoritesController", "version": "1.0"}, {"version": "1.0", "type": "AlexaInterface", "interface": "Alexa.Mobile.Push"}, {"type": "AlexaInterface", "interface": "InteractionModel", "version": "1.1"}, {"interface": "Alexa.PlaylistController", "type": "AlexaInterface", "version": "1.0"}, {"interface": "SpeechRecognizer", "type": "AlexaInterface", "version": "2.1"}, {"interface": "AudioPlayer", "type": "AlexaInterface", "version": "1.3"}, {"type": "AlexaInterface", "version": "3.1", "interface": "Alexa.RTCSessionController"}, {"interface": "VisualActivityTracker", "version": "1.1", "type": "AlexaInterface"}, {"interface": "Alexa.PlaybackController", "version": "1.0", "type": "AlexaInterface"}, {"type": "AlexaInterface", "interface": "Alexa.SeekController", "version": "1.0"}, {"interface": "Alexa.Comms.MessagingController", "type": "AlexaInterface", "version": "1.0"}]}
{"User-Agent": "AmazonWebView/Amazon Alexa/2.2.556530.0/iOS/16.6/iPhone", "Accept-Language": "en-US", "Accept-Charset": "utf-8", "Connection": "keep-alive", "Content-type": "application/json; charset=UTF-8", "authorization": "Bearer Atna|EwICIGk3MAU0L2OWgIac-Tg7NIlzfcUQz4-FlY9sEc2qkUSfvczCJVvQ0RBNzoa1IfUa261pEQ19ut1dKzGgv55vfOZh7McfoAKjOY_23emjJZl6GRUYj_ScziPaAtp9p2hA_t7p1TPBebe1IuT4uqd7pCxrPBd8HNhUnsgQq5dUhtDNIZUTA9h2TGKViyVabf-POD9ePBw3blrcZrFUUeXZGOe7uAgEJeGXykpC94OEtFYcLZcAwBLjdvJyaibHcXLkJrt7_YliKVpm9dsuoSPs-XXFP4dvJBnTcqIbTk5IdX9bb40CmhCWHY8bM-r50Kb-beaycY3o12SzfE-BRcN5r6y8yjOyUEmJW8iWkFnuS0oYrdUxm8Grk7MFHA68YgcrVNg"}
2024-09-03 02:45:33.871 DEBUG (MainThread) [alexapy.alexalogin] Failed to register capabilities
2024-09-03 02:45:34.190 DEBUG (MainThread) [alexapy.alexalogin] 5 cookies successfully exchanged for refresh token for domain .amazon.it
2024-09-03 02:45:34.191 DEBUG (MainThread) [alexapy.alexalogin] CSRF already exists; no need to discover
2024-09-03 02:45:34.742 DEBUG (MainThread) [alexapy.alexalogin] GET:
https://alexa.amazon.com/api/bootstrap returned 200:OK with response <CIMultiDictProxy('Content-Type': 'application/json', 'Content-Length': '179', 'Connection': 'keep-alive', 'Server': 'Server', 'Date': 'Tue, 03 Sep 2024 00:45:34 GMT', 'Vary': 'Content-Type,Accept-Encoding,User-Agent', 'x-amz-rid': 'KPXN5DHC89D5GE4B6K0P', 'x-amzn-RequestId': 'KPXN5DHC89D5GE4B6K0P', 'x-amzn-alt-domain': 'https://alexa.amazon.it/logout', 'X-Cache': 'Miss from cloudfront', 'Via': '1.1 946a47118939fc2908c7ce8e46e8d16c.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'MXP64-P1', 'X-Amz-Cf-Id': '9PUiRYb3sgd4DxOW1Js9xp1M2CoMqoud4qWJ6uA6YT9z76yIwC8Isw==')>
2024-09-03 02:45:35.068 DEBUG (MainThread) [alexapy.alexalogin] GET:
https://alexa.amazon.it/api/bootstrap returned 200:OK with response <CIMultiDictProxy('Content-Type': 'application/json', 'Content-Length': '179', 'Connection': 'keep-alive', 'Server': 'Server', 'Date': 'Tue, 03 Sep 2024 00:45:35 GMT', 'Strict-Transport-Security': 'max-age=0; includeSubDomains;', 'x-amz-rid': 'ZJ2H45MTRG2MA1X04M3W', 'x-amzn-RequestId': 'ZJ2H45MTRG2MA1X04M3W', 'Vary': 'Content-Type,Accept-Encoding,User-Agent', 'X-Cache': 'Miss from cloudfront', 'Via': '1.1 bbdab68f6dd980a27e635ee335ffbfb0.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'MXP53-P4', 'X-Amz-Cf-Id': 'HKFczlo2f0htMBn_sW2lM7Z6Ap6wyxg3z5JW63SoflO0rJeuwhmQow==')>
2024-09-03 02:45:35.069 DEBUG (MainThread) [alexapy.alexalogin] Logged in as sinki90@hotmail.it to amazon.it with id: A19N0OQD5SALS3
2024-09-03 02:45:35.579 DEBUG (MainThread) [alexapy.alexalogin] Domain amazon.it matches reported account domain: amazon.it
2024-09-03 02:45:35.587 DEBUG (MainThread) [alexapy.alexahttp2] HTTP2 Connection Closed.
2024-09-03 02:45:42.759 DEBUG (MainThread) [alexapy.alexaapi] s*****0@h********t: Detected access token expiration; refreshing
2024-09-03 02:45:42.834 DEBUG (MainThread) [alexapy.alexalogin] refresh response <ClientResponse(https://api.amazon.it/auth/token) [200 OK]>
AMP then stopped working
2024-09-03 13:47:29.061 WARNING (MainThread) [alexapy.helpers] alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7f96ae29f0>,), {'max_record_size': 10}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Unauthorized',)
No interactions made between 2:45 and 13:47...
Just posting this as feedback, maybe someone who reads can understand more.
as an update to the above, for now all seems to be working since I posted it. Http2 session was closed again after around 3 hours and 27 minutes since AMP was restarted. Never opened again so AMP is working without http2 at the moment.
as an update to the above, for now all seems to be working since I posted it. Http2 session was closed again after around 3 hours and 27 minutes since AMP was restarted. Never opened again so AMP is working without http2 at the moment.
Hey Matteo, thanks for your feedback.
It's not clear to me what did you do to make it working. You are on amazon.it i guess, so your "method" probably will work for me too...
as an update to the above, for now all seems to be working since I posted it. Http2 session was closed again after around 3 hours and 27 minutes since AMP was restarted. Never opened again so AMP is working without http2 at the moment.
Hey Matteo, thanks for your feedback.
It's not clear to me what did you do to make it working. You are on amazon.it i guess, so your "method" probably will work for me too...
to be honest I didn't change anything from yesterday and I don't think it will work forever. For sure it is working better. I have the latest AMP version, latest HA version and alexapy 1.29.0 (not in the manifest only, I had to update it through SSH). Polling disabled as I don't really need it.
But again... I don't think it's fixed, it's just working longer than usual. This is the same setup I used for days and I think it's just luck that it's now working for around 20 hours...
Describe the bug
For those users in the EU region continuing to have issues.
System details
const.py
or HA startup log): 4.12.11pip show alexapy
in homeasssistant container or HA startup log): => 1.28.2Debug Logs (alexa_media & alexapy)
Result of successful http2 communication:
What to try
In const.py, try editing these constants as follows: From:
To:
I'm most interested in whether
MIN_TIME_BETWEEN_FORCED_SCANS
has a positive effect or not as the integration only retries 5 times with an increasing backoff in time in between, which may not be enough to prevent Amazon EU from shutting down.It's a shot in the dark since I'm in the NA region (amazon.ca) and do not have your issues...