alexa_media_player: not able to install - failing at final step (KeyError: 'public_url')

IMPORTANT: Please search the issues, including closed issues, and the FAQ before opening a new issue. The template is mandatory; failure to use it will result in issue closure.

Describe the bug

I am installing Alexa Media player (I’ve done it before) and it is failing on the final login to Amazon via home assistant

To Reproduce

  1. Go to 'integrations - select alexa_media_player
  2. Click on multiple steps including access to Amazon.com
  3. Fails to update after final entry of Amazon password
  4. See error

Expected behavior

successful installation - but it stops after final password entry

Screenshots

System details

  • Home Assistant version: 2024.09.1
  • alexa_media version (from const.py or HA startup log):
  • alexapy version (from pip show alexapy in homeasssistant container or HA startup log):
  • Is Amazon 2FA/2SV enabled <!—We will not debug login issues if unanswered—> (y/n):
  • Amazon Domain: amazon.com

Debug Logs (alexa_media & alexapy) 2024-09-22 11:14:42.207 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration alexa_media which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2024-09-22 11:14:42.815 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 2: {‘device_tracker’, ‘amberelectric’, ‘media_source’, ‘assist_pipeline’, ‘group’, ‘template’, ‘history’, ‘xiaomi_ble’, ‘mobile_app’, ‘default_config’, ‘bluetooth_adapters’, ‘frigate’, ‘scene’, ‘counter’, ‘logbook’, ‘watchman’, ‘tts’, ‘tesla_custom’, ‘onboarding’, ‘input_text’, ‘variable’, ‘blueprint’, ‘application_credentials’, ‘bureau_of_meteorology’, ‘backup’, ‘lifx’, ‘script’, ‘hacs’, ‘zone’, ‘lovelace’, ‘integration’, ‘automation’, ‘conversation’, ‘powerwall’, ‘tasmota’, ‘intent’, ‘sun’, ‘search’, ‘nut’, ‘config’, ‘stt’, ‘diagnostics’, ‘persistent_notification’, ‘energy’, ‘format_ble_tracker’, ‘stream’, ‘image_upload’, ‘ffmpeg’, ‘sensor’, ‘hardware’, ‘localtuya’, ‘homeassistant_alerts’, ‘analytics’, ‘input_select’, ‘input_datetime’, ‘trace’, ‘system_health’, ‘ocpp’, ‘input_button’, ‘schedule’, ‘esphome’, ‘alexa_media’, ‘systemmonitor’, ‘file_upload’, ‘mbapi2020’, ‘sonos’, ‘input_boolean’, ‘device_automation’, ‘smartthinq_sensors’, ‘wake_word’, ‘statistics’, ‘tag’, ‘timer’, ‘mqtt’, ‘map’, ‘samsungtv’, ‘my’, ‘input_number’, ‘person’, ‘min_max’} 2024-09-22 11:14:43.457 INFO (MainThread) [homeassistant.setup] Setting up alexa_media 2024-09-22 11:14:43.458 ERROR (MainThread) [homeassistant.setup] Error during setup of component alexa_media File “/config/custom_components/alexa_media/init.py”, line 189, in async_setup 2024-09-22 11:14:43.460 INFO (MainThread) [homeassistant.setup] Setup of domain alexa_media took 0.00 seconds 2024-09-22 11:15:11.462 INFO (MainThread) [homeassistant.components.automation.automatic_updates_alexa_integration] Initialized trigger Automatic updates - Alexa integration 2024-09-22 11:17:27.650 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7f4110b62f50>, ‘/usr/local/lib/python3.12/site-packages/certifi/cacert.pem’, None, None) inside the event loop by custom integration ‘alexa_media’ at custom_components/alexa_media/config_flow.py, line 278: self.login = AlexaLogin( (offender: /usr/local/lib/python3.12/ssl.py, line 708: context.load_verify_locations(cafile, capath, cadata)), please create a bug report at https://github.com/alandtse/alexa_media_player/issues File “/config/custom_components/alexa_media/config_flow.py”, line 278, in async_step_user self.login = AlexaLogin( 2024-09-22 11:17:46.949 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7f4122ddcf50>,) inside the event loop by custom integration ‘alexa_media’ at custom_components/alexa_media/config_flow.py, line 372: self.proxy = AlexaProxy( (offender: /usr/local/lib/python3.12/site-packages/httpx/_config.py, line 147: context.load_verify_locations(cafile=cafile)), please create a bug report at https://github.com/alandtse/alexa_media_player/issues File “/config/custom_components/alexa_media/config_flow.py”, line 567, in async_step_totp_register File “/config/custom_components/alexa_media/config_flow.py”, line 372, in async_step_start_proxy self.proxy = AlexaProxy(

Additional context

Logger: homeassistant.setup Source: setup.py:416 First occurred: 11:30:42 (1 occurrences) Last logged: 11:30:42

Error during setup of component alexa_media Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/setup.py”, line 416, in _async_setup_component result = await task ^^^^^^^^^^ File “/config/custom_components/alexa_media/init.py”, line 189, in async_setup CONF_PUBLIC_URL: account[CONF_PUBLIC_URL], ~~~~~~~^^^^^^^^^^^^^^^^^ KeyError: ‘public_url’

I have successfully installed this at another location - so I am familiar with what is required

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 7
  • Comments: 35 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Yes I am getting the same issue. Latest verison of Home Assistant OS with latest version of HACS alexa media player. When I validate the install it redirects me to Amazons website where I sign-in, but won’t sign-in and keeps looping on the amazon sign-in page.

Are any of you using an ad blocker/firewall such as Pi-hole or AdGuard by chance? Some adlists were recently updated to block the Amazon Alexa API. This is solved by adding ^api(\.[a-z]+)?\.amazonalexa\.com$ to your Pi-hole whitelist or @@||api*.amazonalexa.com^ for AdGuard. This regex is not region specific and should work for all endpoints. Then use this workaround to get past the login loop.

I have encountered several of the errors reported (re-auth, cannot concatenate None type str error, etc.) but was always able to fix as follows…

First, make sure OTP/Amazon 2SV via App is set up correctly and that you have provided the OTP secret to AMP so that it can generate new OTP codes when it needs to reauthenticate with Amazon. Then, start with a clean slate… Delete the config entry. Redownload the AMP custom component in HACS and restart HA. Check if either of these files exist in /.storage:

cd /config/.storage ls -al alexa_* -rw-r–r-- 1 root root 783 Sep 22 16:40 alexa_auth -rw-r–r-- 1 root root 8480 Sep 22 16:54 alexa_media.<your_email>.pickle

If so, delete them, restart HA and verify they do not exist. Clear your browser’s cookies, restart the browser and then log into Amazon to reestablish its cookies. <- This was critical for me numerous times! Now login into HA and try re-adding the integration.

Same issue as all above

Tried everything that was given here.

My Versions:

HA Core 2024.9.3 Supervisor 2024.09.1 Operating System Frontend 20240909.1

Alexa_Media v4.13.2

Log is attached:

messages:

2024-09-25 10:42:15.020 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7fff0cc94350>, '/usr/local/lib/python3.12/site-packages/certifi/cacert.pem', None, None) inside the event loop by custom integration 'alexa_media' at custom_components/alexa_media/config_flow.py, line 278: self.login = AlexaLogin( (offender: /usr/local/lib/python3.12/ssl.py, line 708: context.load_verify_locations(cafile, capath, cadata)), please create a bug report at https://github.com/alandtse/alexa_media_player/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_verify_locations
Traceback (most recent call last):

home-assistant_2024-09-25T15-24-35.340Z.log

Thanks for any sollution. Maybe i can get my system running again. I really miss this notify.

2024-09-25 10:42:15.020 WARNING has nothing to do with any errors

Yep that worked for me. Thanks @nstyqz

I feel like such a DAU (dümmster anzunehmender User ) - roughly translated DIU (dumbest imaginable user)…

Pi-hole blocked api.eu.amazonalexa.com and api.amazonalexa.com. After I whitelisted them both it worked…

THANKS for the nudge into the correct direction! Works perfectly now.

@Joeslinky THAT DID IT! Thank you!

Are any of you using Pi-Hole by chance? I was able to solve this by adding api.amazonalexa.com to my whitelist.

Yes I do! Why the hell didn’t I think if this? Will try asap and report back…

^^^ This!

In my AdGuard, this url is new on a block list. i have added @@||api.amazonalexa.com^$important to custom rules an with the 1 page login trick, amp works again.

for now. 😃

Same issue as all above

Tried everything that was given here.

My Versions:

HA Core 2024.9.3 Supervisor 2024.09.1 Operating System Frontend 20240909.1

Alexa_Media v4.13.2

Log is attached:

messages:

2024-09-25 10:42:15.020 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7fff0cc94350>, '/usr/local/lib/python3.12/site-packages/certifi/cacert.pem', None, None) inside the event loop by custom integration 'alexa_media' at custom_components/alexa_media/config_flow.py, line 278: self.login = AlexaLogin( (offender: /usr/local/lib/python3.12/ssl.py, line 708: context.load_verify_locations(cafile, capath, cadata)), please create a bug report at https://github.com/alandtse/alexa_media_player/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_verify_locations
Traceback (most recent call last):

home-assistant_2024-09-25T15-24-35.340Z.log

Thanks for any sollution. Maybe i can get my system running again. I really miss this notify.

Here #2514 there is a halfway solution…

Thank you! That worked for me.