Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Alexa Media Reauthentication Required - continuously appear: Login error detected; not contacting API #2453

Closed
Kosztyk opened this issue Aug 10, 2024 · 511 comments

Comments

@Kosztyk
Copy link

Kosztyk commented Aug 10, 2024

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

Looks like in Homeassistant OS X64, 2024.8.0 integration Alexa Media Player in continuously asking for authentification or reauthentification.

integration version 4.12.7, amazon.com domain, 2FA enabled.

Even just after authentification no dot speaker is shown.

To Reproduce

  1. Go to Alexa Media Player
  2. Click on reconfigure and authenticate, even the auth process went fine none of my dot speakers are shown and "attention required message is appearing

Reauthenticate [email protected] on the Integrations page. Relogin required after 0:00:01.582947 and 2 api calls.

Expected behavior

to stop asking for authentification and my dot speakers to appear in HAOS

Screenshots

attached

System details

Core
2024.8.0
Supervisor
2024.08.0
Operating System
12.4
Frontend
20240806.1

alexa_media (version from const.py or HA startup): Which ever is the latest updated new version (08/08/24)
alexapy (version from pip show alexapy or HA startup): Same as above
Amazon [2FA is enabled] - Yes
Screenshot 2024-08-10 at 15 41 12
Screenshot 2024-08-10 at 15 33 34
. <!---We will not debug login issues if unanswered--->:

Logs
Please provide logs.

('Login error detected; not contacting API',)
2024-08-10 15:53:41.987 WARNING (MainThread) [alexapy.helpers] alexaapi.get_bluetooth((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.009 WARNING (MainThread) [alexapy.helpers] alexaapi.get_guard_details((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.009 WARNING (MainThread) [alexapy.helpers] alexaapi.get_network_details((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.022 WARNING (MainThread) [alexapy.helpers] alexaapi.get_authentication((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.030 WARNING (MainThread) [alexapy.helpers] alexaapi.get_authentication((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.046 WARNING (MainThread) [alexapy.helpers] alexaapi.get_dnd_state((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.054 WARNING (MainThread) [alexapy.helpers] alexaapi.get_bluetooth((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.095 WARNING (MainThread) [alexapy.helpers] alexaapi.get_devices((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.226 WARNING (MainThread) [alexapy.helpers] alexaapi.get_dnd_state((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.250 WARNING (MainThread) [alexapy.helpers] alexaapi.get_authentication((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.279 WARNING (MainThread) [alexapy.helpers] alexaapi.get_device_preferences((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.298 WARNING (MainThread) [alexapy.helpers] alexaapi.get_devices((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.313 WARNING (MainThread) [alexapy.helpers] alexaapi.get_device_preferences((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.356 WARNING (MainThread) [alexapy.helpers] alexaapi.get_device_preferences((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)

Additional context

@Javisen
Copy link

Javisen commented Aug 10, 2024

+1

4 similar comments
@javiges
Copy link

javiges commented Aug 10, 2024

+1

@conorokelly
Copy link

+1

@Mapsy-AI
Copy link

+1

@marco-hacs
Copy link

+1

@javilopezalarcon
Copy link

+1
if you do an automation to reload the integration every 9 minutes it seems that it doesn't fail again... Like the auto restart integration when Home Assistant starts..

@Kosztyk
Copy link
Author

Kosztyk commented Aug 10, 2024

Hi,

The problem is not only the reauthentication, my speakers are not shown at all even after it authenticates, like in my printscreen

@javilopezalarcon
Copy link

Registrador: homeassistant.components.media_player

Fuente: helpers/entity_platform.py:764
integración: Reproductor multimedia (documentación, problemas)
Ocurrió por primera vez: 17:27:39 (141 ocurrencias)
Último inicio de sesión: 22:27:39

Platform alexa_media does not generate unique IDs. ID G0922M0624520K4L already exists - ignoring media_player.alexa_matrimonio
Platform alexa_media does not generate unique IDs. ID G091GM10227401QM already exists - ignoring media_player.alexa_salon
Platform alexa_media does not generate unique IDs. ID 30ba105f4e3a4b3fbfff1e84e90f78b0 already exists - ignoring media_player.nuestra_casita
Platform alexa_media does not generate unique IDs. ID eb94a13bfe07413c9186044f9aa31cf6 already exists - ignoring media_player.amazfit_balance_javi 


Registrador: homeassistant.helpers.entity
Fuente: helpers/entity.py:942
Ocurrió por primera vez: 17:36:40 (140 ocurrencias)
Último inicio de sesión: 22:27:38

Update for media_player.alexa_matrimonio fails
Update for media_player.alexa_salon fails
Update for media_player.nuestra_casita fails
Update for media_player.amazfit_balance_javi fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1300, in async_device_update
    await self.async_update()
  File "/config/custom_components/alexa_media/helpers.py", line 158, in _catch_login_errors
    result = await func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/alexa_media/media_player.py", line 918, in async_update
    device = self.hass.data[DATA_ALEXAMEDIA]["accounts"][email]["devices"][
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'G0922M0624520K4L'

Registrador: homeassistant.config_entries
Fuente: config_entries.py:819
Ocurrió por primera vez: 15:25:37 (50 ocurrencias)
Último inicio de sesión: 22:27:30

Error unloading entry Alexa Javi- 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!

Este error se originó a partir de una integración personalizada.

Registrador: alexapy.helpers
Fuente: custom_components/alexa_media/__init__.py:848
integración: Alexa Media Player (documentación, problemas)
Ocurrió por primera vez: 17:27:44 (6 ocurrencias)
Último inicio de sesión: 17:34:56

alexaapi.get_dnd_state((<alexapy.alexalogin.AlexaLogin object at 0x7f81a0aa91c0>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)
Este error se originó a partir de una integración personalizada.

Registrador: alexapy.helpers
Fuente: custom_components/alexa_media/media_player.py:639
integración: Alexa Media Player (documentación, problemas)
Ocurrió por primera vez: 14:22:38 (27 ocurrencias)
Último inicio de sesión: 17:32:49

alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f81ae8d97f0>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)
alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f81aa35a5a0>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)
alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f81aa35aa20>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)
alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f81a62d5ac0>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)
alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f81a62d6420>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)

Este error se originó a partir de una integración personalizada.

Registrador: alexapy.helpers
Fuente: custom_components/alexa_media/__init__.py:785
integración: Alexa Media Player (documentación, problemas)
Ocurrió por primera vez: 05:27:23 (6 ocurrencias)
Último inicio de sesión: 17:27:38

alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7f81bd77d160>,), {'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 0x7f81bd77d160>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Unauthorized',)
alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7f81a0aa91c0>,), {'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 0x7f81a0aa91c0>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Unauthorized',)


Registrador: alexapy.helpers
Fuente: runner.py:190
Ocurrió por primera vez: 09:00:37 (45 ocurrencias)
Último inicio de sesión: 15:25:25

alexaapi.send_sequence((<alexapy.alexaapi.AlexaAPI object at 0x7f81a85b5fd0>, 'Alexa.Speak'), {'customer_id': 'ASDHY88HGVBO6', 'textToSpeak': 'La humedad exterior es 37% menor que la interior. Sería un buen momento para abrir las ventanas y airear la casa.', 'target': {'customerId': 'A*********BO6', 'devices': [{'deviceSerialNumber': 'G************1QM', 'deviceTypeId': 'A15996VY63BQ2D'}]}, '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 0x7f81a85b5fd0>, 'La humedad exterior es 37% menor que la interior. Sería un buen momento para abrir las ventanas y airear la casa.'), {'customer_id': 'ASDHY88HGVBO6', 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)
alexaapi.run_behavior((<alexapy.alexaapi.AlexaAPI object at 0x7f81a85b5fd0>, {'@type': 'com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode', 'type': 'Alexa.Speak', 'operationPayload': {'deviceType': 'A15996VY63BQ2D', 'deviceSerialNumber': 'G************1QM', 'locale': 'es-es', 'customerId': 'A*********BO6', 'textToSpeak': 'Esto es una prueba', 'target': {'customerId': 'A*********BO6', 'devices': [{'deviceSerialNumber': 'G************1QM', 'deviceTypeId': 'A15996VY63BQ2D'}]}, '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 0x7f81a85b5fd0>, 'Alexa.Speak'), {'customer_id': 'ASDHY88HGVBO6', 'textToSpeak': 'Esto es una prueba', 'target': {'customerId': 'A*********BO6', 'devices': [{'deviceSerialNumber': 'G************1QM', 'deviceTypeId': 'A15996VY63BQ2D'}]}, '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 0x7f81a85b5fd0>, 'Esto es una prueba'), {'customer_id': 'ASDHY88HGVBO6', 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)

@TruantRiccardo
Copy link

TruantRiccardo commented Aug 10, 2024

Fixed with HA 2024.8.1 update
edit: My mistake. Reloading the integration works for a few minutes.

@Kosztyk
Copy link
Author

Kosztyk commented Aug 10, 2024

Still the same for me, same error

@ml0renz0
Copy link

ml0renz0 commented Aug 11, 2024

Fixed with HA 2024.8.1 update

Updated and rebooted, just in case.
Still not working for me as well.

In my case it requires to re-authenticate every half hour and it started this week.
I know this because I use the echo dot's temperature sensor

Screenshot_20240811-035805~2.png

@javiges
Copy link

javiges commented Aug 11, 2024

Fixed with HA 2024.8.1 update

Does everything work for you? It no longer asks to authenticate every half hour and notifications always work? Thank you very much.

@DAB42
Copy link

DAB42 commented Aug 11, 2024

This is still happening for me at HA version 2024.8.1

@asmsaifs
Copy link

I am also facing this at HA version 2024.8.1

@vix66
Copy link

vix66 commented Aug 11, 2024

Same situation … stress!

@Catkin75
Copy link

Same here after 2024.8.1 update.

@lankymat
Copy link

Same here after 2024.8.1 update. Continually asking to authenticate and failing to login.

@matte-a
Copy link

matte-a commented Aug 11, 2024

Hi all!

As many others, i'm experiensing the same problem, but i've notice somenthing.
In the configuration section the integration seems it's losing the public url of my hass instance. As soon as i update the configuration with the url, the integration start to work again

image

image

@josemaX
Copy link

josemaX commented Aug 11, 2024

Home-assistant (version): 2024.8.0
alexa_media (version):4.12.7

After reconfiguring the integration as commented above, restarting the computer (no home assistant), Alexa plays the HA messages in automations for a bunch of minutes, after that, no speaking again.

Then if I reload the AMP integration, works again for a while, and fails after a while until reload the integration and so on.

@Kosztyk
Copy link
Author

Kosztyk commented Aug 11, 2024

Not working in my case

@nstyqz
Copy link

nstyqz commented Aug 11, 2024

Another one

Screenshot_20240811-004420.png

Screenshot_20240811-004619.png

@mirlorojiblanco
Copy link

The same here 😭

@sdholden28
Copy link

Same issue here. Logs:
Logger: alexapy.helpers
Source: runner.py:190
First occurred: 6:39:54 PM (6 occurrences)
Last logged: 6:40:14 PM

alexaapi.send_sequence((<alexapy.alexaapi.AlexaAPI object at 0x7f14adfe8410>, 'Alexa.Speak'), {'customer_id': 'A369Q6OMY8A2EE', 'textToSpeak': "Home Assistant reports all doors are closed", 'target': {'customerId': 'A2EE', 'devices': [{'deviceSerialNumber': 'G19C', 'deviceTypeId': 'A7WXQPH584YP'}]}, 'skillId': 'amzn1.ask.1p.saysomething', 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Unauthorized',)
alexaapi.send_tts((<alexapy.alexaapi.AlexaAPI object at 0x7f14adfe8410>, "Home Assistant reports all doors are closed"), {'customer_id': 'A369Q6OMY8A2EE', 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Unauthorized',)
alexaapi.run_behavior((<alexapy.alexaapi.AlexaAPI object at 0x7f14adfe8410>, {'@type': 'com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode', 'type': 'Alexa.Speak', 'operationPayload': {'deviceType': 'A7WXQPH584YP', 'deviceSerialNumber': 'G
19C', 'locale': 'en-us', 'customerId': 'A2EE', 'textToSpeak': "Home Assistant reports all doors are closed", 'target': {'customerId': 'A2EE', 'devices': [{'deviceSerialNumber': 'G19C', 'deviceTypeId': 'A7WXQPH584YP'}]}, '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 0x7f14adfe8410>, 'Alexa.Speak'), {'customer_id': 'A369Q6OMY8A2EE', 'textToSpeak': "Home Assistant reports all doors are closed", 'target': {'customerId': 'A
2EE', 'devices': [{'deviceSerialNumber': 'G****19C', 'deviceTypeId': 'A7WXQPH584YP'}]}, '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 0x7f14adfe8410>, "Home Assistant reports all doors are closed"), {'customer_id': 'A369Q6OMY8A2EE', 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)

@djeghe
Copy link

djeghe commented Aug 12, 2024

Same problem here with amazon.it domain.
I also try to uninstall and reinstall integration but the problem was unsolved

@djeghe
Copy link

djeghe commented Aug 12, 2024

reload the integration

Ciao. What is the HA service that reload an integration?

@Xploder
Copy link

Xploder commented Aug 12, 2024

Same here, amazon.de

@javilopezalarcon
Copy link

reload the integration

Ciao. What is the HA service that reload an integration?

I'll give you my automation, just using 1 of the speakers is enough, reload the entire integration

`alias: Recarga Alexa hasta que se arregle
description: ""
trigger:

  • platform: homeassistant
    event: start
  • platform: time_pattern
    minutes: /9
    condition: []
    action:
  • delay:
    hours: 0
    minutes: 0
    seconds: 30
    milliseconds: 0
  • metadata: {}
    data: {}
    target:
    entity_id: media_player.alexa_pc
    action: homeassistant.reload_config_entry
    mode: single`

@nstyqz
Copy link

nstyqz commented Aug 12, 2024

Service... I meant action 😎😎😎

@qfina
Copy link

qfina commented Aug 12, 2024

Also suffering this, example:

Reauthenticate a**@**m on the Integrations page. Relogin required after 0:00:04.279868 and 10 api calls.

Simply pressing "Reload" on the integration fixes it temporarily (2FA enabled).

@mpch13
Copy link

mpch13 commented Aug 12, 2024

Same issue on both core versions 2024.8.0 and 2024.8.1 with 4.12.7 Alexa media player.

@figorr
Copy link

figorr commented Oct 29, 2024

The problem is ... although I edited the manifest.json according to 4. If I restart HA once manifest.json was edited ... HA should run a pip installl (according to manifest.json data) and you shouldn't do any manual pip install. But HA is not doing the job. So when you update again HA (for instance at 2024.11.1) you will need to run a new manual pip install, because manifest.json it is not working as it is supposed to be.

I believe this might be what's happening:

  1. keaton/alexapy v1.29.3 is installed in python
  2. You edit manifest.json to indicate srescio/alexapy (also v1.29.3)
  3. Restart HA
  4. HA starts & confirms that alexapy 1.29.3 is already installed in python
    Result: It does not remove keaton/alexapy 1.29.3 and install srescio/alexapy 1.29.3

I forked Keaton alexapy and I edited pyproject.toml and setup.py to change to alexapy version, in my case totally different (version 1.30.7).

And then I Alexa Media Player manifest.json to point to the GitLab forked version. That includes the latest merge requests (open and closed). In order to test the latest changes.

{
  "domain": "alexa_media",
  "name": "Alexa Media Player",
  "codeowners": ["@alandtse", "@keatontaylor"],
  "config_flow": true,
  "dependencies": ["persistent_notification", "http"],
  "documentation": "https://github.com/alandtse/alexa_media_player/wiki",
  "iot_class": "cloud_polling",
  "issue_tracker": "https://github.com/alandtse/alexa_media_player/issues",
  "loggers": ["alexapy", "authcaptureproxy"],
  "requirements": [
    "alexapy @ git+https://gitlab.com/figorr1/alexapy.git",
    "packaging>=20.3",
    "wrapt>=1.14.0"
  ],
  "version": "4.13.5"
}

I tried also "alexapy @ git+https://gitlab.com/figorr1/alexapy.git@7eec8bdad4aa3858a2ee0045667c0365cf943b42", but It is not working.

@srescio
Copy link
Contributor

srescio commented Oct 29, 2024

@figorr I dont think where/how the notification trigger should matter given that change was done into the alexapy lib at low level to refresh the session when 401 is hit which will succed so long that credetials were not changed in the meanwhile...
Most likely your instance is still picking the other alexapy version?

Or youre picking an old one, please mind the commit hash after the @ symbol, latest one is

https://gitlab.com/keatontaylor/alexapy/-/merge_requests/398/diffs?commit_id=5e500d107a0f6f01343c0d52243a66150885f769

@srescio
Copy link
Contributor

srescio commented Oct 29, 2024

@figorr for testing purpose I would suggest to use only my branch reference with latest commit ID

"alexapy@git+https://gitlab.com/srescio/alexapy.git@5e500d107a0f6f01343c0d52243a66150885f769"

otherwise its not possible to tell if something is due to my changes or to other unrelated things because we risk comparing apples to pears

@srescio
Copy link
Contributor

srescio commented Oct 29, 2024

Also do not forget the core rebuild step against the container, that is the only thing ensuring previous alexapy gets wiped out and new git hash in the manifest gets downloaded

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Oct 29, 2024

I had to edit your node to action notify.alexa_media but that might be a result of "z" being different? ¯\_(ツ)_/¯
It also imported as json despite your flow saying jsonata. I had to change my node from json to jsonata.
Once I put in my echo entities, it ran fine.

[{"id":"33ab817166b3255a","type":"api-call-service","z":"5ec5aa7b5c8a8187","name":"","server":"c879ac61.99cd1","version":7,"debugenabled":false,"action":"notify.alexa_media","floorId":[],"areaId":[],"deviceId":[],"entityId":[],"labelId":[],"data":"{\t   \"message\":\"La lavadora se ha puesto en marcha.\",\t   \"title\":\"Lavadora\",\t   \"target\":\"media_player.echo_cocinilla,media_player.echo_1,media_player.echo_bodega,media_player.echo_2,media_player.echo_cocina,media_player.echo_3,media_player.echo_4,media_player.echo_atico\",\t   \"data\":\t   {\t    \"type\":\"tts\"\t    }\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"notify","service":"alexa_media","x":590,"y":1600,"wires":[[]]},{"id":"c879ac61.99cd1","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

What do your debug logs show prior to the Login error detected; not contacting API occurrence after you action the flow?

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Oct 29, 2024

I don't think where/how the notification trigger should matter

I agree. The same result should happen from within HA as NR.

Also do not forget the core rebuild step against the container, that is the only thing ensuring previous alexapy gets wiped out and new git hash in the manifest gets downloaded

That or wait for the next HA core release!

I'm not even sure whether completely removing AMP will remove the alexapy that HA has installed. It should but you'd have to check pip show alexapy. If it's gone then reinstalling AMP will get the desired alexapy version.

@f18m
Copy link

f18m commented Oct 29, 2024

@figorr ,

I tried also "alexapy @ git+https://gitlab.com/figorr1/alexapy.git@7eec8bdad4aa3858a2ee0045667c0365cf943b42", but It is not working.

did you try to follow the steps I described at: #2453 (comment)

As Simone and Daniel pointed out, it's very likely that you're running some alexapy version which does not include the fix. Using the git + commit hash works just fine but the 'ha core rebuild' step is critical..

@srescio , @danielbrunt57 ,
After 24hours, still no glitch. Everything's working fine with all settings to their default values (polling enabled, 60seconds time between scans, 1.5 seconds to batch commands together). So thanks, I think this is indeed the fix.
I hope it can be merged soon to the stable branch!

cc @alandtse

@figorr
Copy link

figorr commented Oct 29, 2024

I had to edit your node to action notify.alexa_media but that might be a result of "z" being different? ¯\_(ツ)_/¯ It also imported as json despite your flow saying jsonata. I had to change my node from json to jsonata. Once I put in my echo entities, it ran fine.

[{"id":"33ab817166b3255a","type":"api-call-service","z":"5ec5aa7b5c8a8187","name":"","server":"c879ac61.99cd1","version":7,"debugenabled":false,"action":"notify.alexa_media","floorId":[],"areaId":[],"deviceId":[],"entityId":[],"labelId":[],"data":"{\t   \"message\":\"La lavadora se ha puesto en marcha.\",\t   \"title\":\"Lavadora\",\t   \"target\":\"media_player.echo_cocinilla,media_player.echo_1,media_player.echo_bodega,media_player.echo_2,media_player.echo_cocina,media_player.echo_3,media_player.echo_4,media_player.echo_atico\",\t   \"data\":\t   {\t    \"type\":\"tts\"\t    }\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"notify","service":"alexa_media","x":590,"y":1600,"wires":[[]]},{"id":"c879ac61.99cd1","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

What do your debug logs show prior to the Login error detected; not contacting API occurrence after you action the flow?

I can recover this from "HOME ASSISTANT Core" log ...

AlexaPy_ERROR.log

There are two errors ...

  1. When the flow is sending the tts that notifies the washing machine started.
    See line starting at:
    2024-10-28 11:28:20.940 WARNING
  2. When the flow is sending the tts that notifies the washing machine had finished.
    See line starting at:
    2024-10-28 12:24:57.159 WARNING

I was outside home, so I cannot see If it failed with the first tts or with the second one (when the washing machine finished). But it was when I received the push notification to the phone (notifying that the washing machine had finished) when I entered at HA and I could check that the Echo Temperature sensors were unavailable and the last alexa sensor failed too. So this is the moment I noticed the integration failed and I couldn't send any new notifications. But probably it failed with the first tts.

I tried then to reload the integration. Everything returned to work flawesly but I got the following warning at log.

2024-10-28 12:47:05.231 WARNING

@figorr
Copy link

figorr commented Oct 29, 2024

@figorr ,

I tried also "alexapy @ git+https://gitlab.com/figorr1/alexapy.git@7eec8bdad4aa3858a2ee0045667c0365cf943b42", but It is not working.

did you try to follow the steps I described at: #2453 (comment)

As Simone and Daniel pointed out, it's very likely that you're running some alexapy version which does not include the fix. Using the git + commit hash works just fine but the 'ha core rebuild' step is critical..

@srescio , @danielbrunt57 , After 24hours, still no glitch. Everything's working fine with all settings to their default values (polling enabled, 60seconds time between scans, 1.5 seconds to batch commands together). So thanks, I think this is indeed the fix. I hope it can be merged soon to the stable branch!

cc @alandtse

Ok. I didn't do the ha core rebuild because I thought It was enough to edit the manifest.json and restart HA.

I think I had included the latest fixes (opened and closed merges), except the last ones from Daniel from yesterday. But maybe I forgot something. I will check when I went back to home.

In the meantime ... I will use "alexapy@git+https://gitlab.com/srescio/alexapy.git@5e500d107a0f6f01343c0d52243a66150885f769"

@srescio
Copy link
Contributor

srescio commented Oct 29, 2024

Ok, second check in, of those who:

  1. Used my latest branch commit in alexapy manifest
  2. AND did the container core rebuild

How is stability so far? Any login error?

@PaulBiod
Copy link

Ok, second check in, of those who:

  1. Used my latest branch commit in alexapy manifest
  2. AND did the container core rebuild

How is stability so far? Any login error?

Hi @srescio
Did the changes (manifest + core rebuilt) this afternoon. Till now, everyth is ok. I will keep you updated
Thanks for your work

@srescio
Copy link
Contributor

srescio commented Oct 29, 2024

FYI this is what the fix does for 401 when credentials did not change:
401retry-happy-path-uml

and this is the unhappy path when credentials change to not hit 429
401retry-unhappy-path-uml

so when response status code is 401 it will attempt refreshing login, if that succeeds it retries immediately the failed request without raising the exception, then the response flow keeps on normally

if login refresh does not succeed (changed credentials), it will not retry the request, response processor will raise the login exception and block further calls to avoid spamming which could end in 429 or having the app blocked

@f18m
Copy link

f18m commented Oct 29, 2024

Ok, second check in, of those who:

  1. Used my latest branch commit in alexapy manifest
  2. AND did the container core rebuild

How is stability so far? Any login error?

So far so good for me. After 48 still everything working fine: I have several automations using AMP to notify what's happening in the house and they all work fine. No login errors. Thanks!

@PaulBiod
Copy link

24h for me everyth is ok

@figorr
Copy link

figorr commented Oct 30, 2024

AMP running smoothly. I didn't see more warnings at logs.

@JackTalisker
Copy link

People who are testing could kindly specify if:

  • Polling is enabled
  • Custom tts notifications are correctly handled by echo devices without issues.

Thank you.

@PaulBiod
Copy link

Hi,
polling disabled, TTS perfectly working with echo shows, pop

@f18m
Copy link

f18m commented Oct 30, 2024

Hi,
after 72 hours, everything working perfectly with:

  • polling enabled
  • TTS notifications working

@monogalactico
Copy link

monogalactico commented Oct 30, 2024 via email

@francescop68
Copy link

francescop68 commented Oct 30, 2024 via email

@PaulBiod
Copy link

@francescop68

Edit the manifest.json file on the custom_components/alexa directory, and change the line "requirements" to this :

"requirements": ["alexapy@git+https://gitlab.com/srescio/alexapy.git@5e500d107a0f6f01343c0d52243a66150885f769", "packaging>=20.3", "wrapt>=1.14.0"],

And then, open an ssh terminal and put : HA core rebuild

That's all

@monogalactico
Copy link

monogalactico commented Oct 30, 2024 via email

@PaulBiod
Copy link

last ones

@f18m
Copy link

f18m commented Oct 30, 2024

Hi all, Please is there someone so kind as to describe from scratch the process for beginner to apply the patch you are successfully testing?

Please check also #2453 (comment) if it helps

@matte-oss
Copy link

matte-oss commented Oct 31, 2024

Installed the latest update, i'll update you if It works

EDIT: Usually It stops working after 30 minutes, been going for 5 hours 🎉 (amazon.it)

@srescio
Copy link
Contributor

srescio commented Oct 31, 2024

my job here is done

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

No branches or pull requests