Echo Devices (Alexa) as Media Player - Testers Needed

Alexa Media Player v4.12.7 now requires alexapy v1.28.2 in its manifest.json and everything seems to be stable and working on Home Assistant Core 2024.8.0!

i was having the same issue then i restored from full-backup and then:

  1. updated the Alexa Media Player to v4.12.7
  2. Home Assistant Core to 2024.8.0

at this point things were lokking good but the entities go offline after sometime and they never come back online…

i’m getting this warning:

Logger: alexapy.helpers
Source: custom_components/alexa_media/__init__.py:785
integration: Alexa Media Player ([documentation](https://github.com/alandtse/alexa_media_player/wiki), [issues](https://github.com/alandtse/alexa_media_player/issues))
First occurred: 08:17:02 (4 occurrences)
Last logged: 08:59:19

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

i tried removing the account and the logged in again but it behaves as before…

Did you also manually update manifest.json like it says in the posts right above yours?

i checked that file and it contains the correct versions

{
  "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==1.28.2", "packaging>=20.3", "wrapt>=1.14.0"],
  "version": "4.12.7"
}

it happend again and log says:

Logger: alexapy.helpers
Source: custom_components/alexa_media/__init__.py:785
integration: Alexa Media Player (documentation, issues)
First occurred: 10:48:14 (2 occurrences)
Last logged: 10:48:14

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

Hmm. Unauthorised error. Try reloading the integration. If that doesn’t work, restart HA just in case.

Reloading the integration works but it keeps happening…

Sorry mate, I’m all out of ideas

i’m done with all this and i think i will throw away the amazon main board and put a arduino nano matter board in air quality sensors and have them connected locally…

Heh, was randomly browsing around and might have found your issue!

Change "alexapy==1.28.2" to "alexapy>=1.28.2", then reload.

If it works, all credits go to this post.

2 Likes

Thanks mate, i will try this and report back

This literally does nothing while there is no alexapy release beyond 1.28.2. It also will lead to weird potential errors in the future if you fail to update amp and we do any release with alexapy. So I don’t think this is a good idea.

My setup is working perfect after the patch. No issues since this idea popped up

I wanted to reinstall Alexa media Player because it was not working…but it fails:

  • After configuration step, 2FA authentification, it brings me on a local amazon loging page (an external connection is needed) but nothing happens, I cant login into this page it loops…
  • after that , the integration does not shows up in the integration list
    what shoul I do?

anyone seen this form? which value I have to insert in second and third position?

2024-10-05 22:07:08.658 DEBUG (MainThread) [custom_components.alexa_media] {'coordinator': None, 'config_entry': <ConfigEntry entry_id=0162aa1b96ebca9775bd9583d2e940bc version=1 domain=alexa_media [email protected] - amazon.it state=ConfigEntryState.SETUP_ERROR [email protected] - amazon.it>, 'setup_alexa': <function setup_alexa at 0x7fc6c484c0e0>, 'devices': {'media_player': {}, 'switch': {}, 'guard': [], 'light': [], 'binary_sensor': [], 'temperature': [], 'smart_switch': []}, 'entities': {'media_player': {}, 'switch': {}, 'sensor': {}, 'light': [], 'binary_sensor': [], 'alarm_control_panel': {}, 'smart_switch': []}, 'excluded': {}, 'new_devices': True, 'http2_lastattempt': 0, 'http2error': 0, 'http2_commands': {}, 'http2_activity': {'serials': {}, 'refreshed': {}}, 'http2': None, 'auth_info': None, 'second_account_index': 0, 'should_get_network': True, 'options': {'include_devices': 'echo cucina', 'exclude_devices': 'echo garage', 'queue_delay': 1.5, 'scan_interval': 60.0, 'public_url': 'https://dxxxxxduckdns.org/', 'extended_entity_discovery': True, 'debug': False}, 'listener': [<function ConfigEntry.add_update_listener.<locals>.<lambda> at 0x7fc6c484c9a0>], 'login_obj': <alexapy.alexalogin.AlexaLogin object at 0x7fc6c4848710>, 'last_push_activity': 0} options reloaded
2024-10-05 22:24:33.939 DEBUG (MainThread) [custom_components.alexa_media.helpers] d*************i@g*******m: Returning uuid {'uuid': '268d2309eb7b7db11ecdb201b0c911e3', 'index': 0}
2024-10-05 22:24:34.004 DEBUG (MainThread) [alexapy.alexalogin] Creating TOTP for H************************************************D2A
2024-10-05 22:24:34.004 DEBUG (MainThread) [alexapy.alexalogin] Generating OTP 644816
2024-10-05 22:24:34.006 DEBUG (MainThread) [alexapy.alexalogin] Login created for [email protected] - amazon.it
2024-10-05 22:24:34.010 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/.storage/[email protected]
2024-10-05 22:24:34.013 DEBUG (MainThread) [alexapy.alexalogin] Trying to load cookie from file /config/.storage/[email protected]
2024-10-05 22:24:34.039 DEBUG (MainThread) [alexapy.alexalogin] Trying to load aiohttpCookieJar to session
2024-10-05 22:24:34.082 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/[email protected]
2024-10-05 22:24:34.085 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/.storage/[email protected]
2024-10-05 22:24:34.088 DEBUG (MainThread) [alexapy.alexalogin] Using credentials to log in
2024-10-05 22:24:34.089 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:323638643233303965623762376462313165636462323031623063393131653332333431333234393536346335363335353634643332353733383331&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=jTRCQHzjPbr_n_zvxBFTX_oTbCDASrGaTpLi78c2eDs&language=it_IT
2024-10-05 22:24:34.089 DEBUG (MainThread) [alexapy.alexalogin] Loaded last request to https://www.amazon.com/ap/register 
2024-10-05 22:24:34.091 DEBUG (MainThread) [alexapy.alexalogin] Processing https://www.amazon.com/ap/register
2024-10-05 22:24:34.159 WARNING (MainThread) [alexapy.helpers] alexalogin.login((<alexapy.alexalogin.AlexaLogin object at 0x7fc6c4848710>,), {'cookies': {}}): An error occurred accessing AlexaAPI: An exception of type TypeError occurred. Arguments:
('can only concatenate str (not "NoneType") to str',)

regards

You will need to create a new account on the Alex Login page.
You enter the email from the existing account.
It shows that the account already exists
Confirm again and you will be taken to enter the OTP
done!

1 Like

it doesn’t open alexa login web page…How I can do?

It was a reply to moreje.

In your case, delete installation, restart HA, re-add installation.

I done again alexa integration, and now seems to be ok, but I’m not able to control my echo dot; in logs I found this:

2024-10-06 21:59:29.222 DEBUG (MainThread) [alexapy.alexaapi] d******i@gm:Login error detected; ignoring post request to /api/np/command with {‘type’: ‘PlayCommand’} {‘deviceSerialNumber’: ‘G0922H0725120SFN’, ‘deviceType’: ‘A4ZXE0RM7LQ7A’}
2024-10-06 21:59:29.222 WARNING (MainThread) [alexapy.helpers] alexaapi.play((<alexapy.alexaapi.AlexaAPI object at 0x7f3a4f3eb950>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
(‘Login error detected; not contacting API’,)

So, I uninstalled AMP due to the boot issues, reinstall the latest version, and I now get a login loop with the amazon alexa webpage.

2FA steps work as expected and described in the installation guide on the WIKI

Is there a simple fix ?

2 Likes

Hi,
I installed again all and it works only few minutes…then I receive these errors:

Registratore: alexapy.helpers
Fonte: runner.py:189
Prima occorrenza: 21:04:08 (6 occorrenze)
Ultima registrazione: 21:04:15

* alexaapi.run_behavior((<alexapy.alexaapi.AlexaAPI object at 0x7f81ff72ae10>, {'@type': 'com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode', 'type': 'Alexa.Speak', 'operationPayload': {'deviceType': 'A4ZXE0RM7LQ7A', 'deviceSerialNumber': 'G************SFN', 'locale': 'it-it', 'customerId': 'A**********TDL', 'textToSpeak': 'ciao, bella gioia!', 'target': {'customerId': 'A**********TDL', 'devices': [{'deviceSerialNumber': 'G************SFN', 'deviceTypeId': 'A4ZXE0RM7LQ7A'}]}, '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 0x7f81ff72ae10>, 'Alexa.Speak'), {'customer_id': 'A10MHAKBMVITDL', 'textToSpeak': 'ciao, bella gioia!', 'target': {'customerId': 'A**********TDL', 'devices': [{'deviceSerialNumber': 'G************SFN', 'deviceTypeId': 'A4ZXE0RM7LQ7A'}]}, '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 0x7f81ff72ae10>, 'ciao, bella gioia!'), {'customer_id': 'A10MHAKBMVITDL', 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)


Registratore: alexapy.helpers
Fonte: custom_components/alexa_media/__init__.py:778
Integrazione: Alexa Media Player ([documentazione](https://github.com/alandtse/alexa_media_player/wiki), [problemi](https://github.com/alandtse/alexa_media_player/issues))
Prima occorrenza: 20:53:40 (2 occorrenze)
Ultima registrazione: 20:53:40

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