alexa_media_player: Can't relogin after update

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.

I got an update for Alexa Media Player on Home Assistant, I ran it and now it doesn’t find my devices, I keep getting OTP codes via SMS to re-login but I don’t know where to put them!

Update Alexa Media Player via Home Assistant to the last version

  1. Go to Settings
  2. You have an update of “Alexa Media Player”
  3. Install it
  4. Reboot HA

To have a page to re-login or where to insert the OTP code received via SMS.

Image

Image

System details

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

Debug Logs (alexa_media & alexapy) Questo errore ha avuto origine da un’integrazione personalizzata.

Registratore: alexapy.helpers Fonte: custom_components/alexa_media/media_player.py:606 Integrazione: Alexa Media Player (documentazione, problemi) Prima occorrenza: 18:43:37 (2 occorrenze) Ultimo accesso: 18:43:40

alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f454a5a90>,), {}): A login error occurred: An exception of type JSONDecodeError occurred. Arguments: (‘Expecting value: line 1 column 1 (char 0)’,) alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f454a6350>,), {}): A login error occurred: An exception of type JSONDecodeError occurred. Arguments: (‘Expecting value: line 1 column 1 (char 0)’,)

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 5
  • Comments: 45

Most upvoted comments

Solved! I deleted(renamed) the file ../homeassistant/.storage/alexa_media.pickle and restarted HA and now it works! The … depends on where is your folder located… I have Dietpi and the full path is /mnt/dietpi_userdata/homeassistant/.storage/alexa_media.pickle

Thank you, this solved it for me as well!

Yep, every two minutes here too, I didn’t wait long enough to notice.

El sáb, 8 mar 2025, 13:50, crik91 @.***> escribió:

Well, I deleted pickle file and updated everything. Integration is working but every time I restart AMP an OTP sms is sent, which is a bit annoying.

El sáb, 8 mar 2025, 13:34, crik91 @.***> escribió: … <#m_4249335192440776011_>

If it is only one it is good, I used to get them every 2 minutes

— Reply to this email directly, view it on GitHub https://github.com/alandtse/alexa_media_player/issues/2848#issuecomment-2708247955, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZM4PTXBYEGIKVZUNC2HUD2TLRQJAVCNFSM6AAAAABYMWCPWWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMBYGI2DOOJVGU . You are receiving this because you are subscribed to this thread.Message ID: @.***> [image: crik91]crik91 left a comment (alandtse/alexa_media_player#2848) https://github.com/alandtse/alexa_media_player/issues/2848#issuecomment-2708247955

Well, I deleted pickle file and updated everything. Integration is working but every time I restart AMP an OTP sms is sent, which is a bit annoying.

El sáb, 8 mar 2025, 13:34, crik91 @.***> escribió: … <#m_4249335192440776011_>

If it is only one it is good, I used to get them every 2 minutes

— Reply to this email directly, view it on GitHub https://github.com/alandtse/alexa_media_player/issues/2848#issuecomment-2708247955, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZM4PTXBYEGIKVZUNC2HUD2TLRQJAVCNFSM6AAAAABYMWCPWWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMBYGI2DOOJVGU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Logged on via SSH and searched the whole file system for everything containing pickle, found some files but none related to Alexa Media.

The alexa_media_<your_email>.pickle is saved in /config/.storage folder in home assistant container.

Yep, every two minutes here too, I didn’t wait long enough to notice.

El sáb, 8 mar 2025, 13:50, crik91 @.***> escribió: …

I switched over to an authenticator token (TOPT) instead of SMS OTP a while back and that seems to still be working fine. E.g. the code in the google authenticator app you get by scanning the on screen qrcode looking thing.

https://www.amazon.com/a/settings/approval/appbackup?ref=ch_adsec_addExtraApp_attempt

ls | grep pickle

Thank you so much! appears I do not have this file

I think you should somewhere, may just be in a different location. You could try running:

find / -name "*.pickle"

For those having issues finding and deleting the file, I’ve have had great success with the Terminal & SSH addon to simply get a terminal via browser to navigate to the directory and delete the pickle file. You can add it easily in the official add-on store: Image

What commands did you use to locate an remove?

cd /homeassistant/.storage
ls | grep pickle                                           ### Find the full alexa_media pickle file name
rm [full pickle file name from prev step]                  ### e.g. rm alexa_media.steve@aol.com.pickle

For those having issues finding and deleting the file, I’ve have had great success with the Terminal & SSH addon to simply get a terminal via browser to navigate to the directory and delete the pickle file. You can add it easily in the official add-on store:

Image

Hi thanks for that, now that you mention it 😉 But unfortunately I can’t find the file in various folders Image /root/homeassistant/.storage/ /mnt/ --> Folder is empty /homeassistant/.storage/ I can’t find any files with “alexa_media” here PS: Just for me again, by default VSC is set in HA aug /Homeassistant/ or?

Enable SSH and try to access via SSH, then launch locate alexa_media.pickle or find / -name "alexa_media.pickle" 2>/dev/null

fyi my pickle was named a little different: alexa_media.[amazon account email].pickle

Hi thanks for that, now that you mention it 😉

But unfortunately I can’t find the file in various folders

Image

/root/homeassistant/.storage/ /mnt/ --> Folder is empty /homeassistant/.storage/

I can’t find any files with “alexa_media” here

PS: Just for me again, by default VSC is set in HA aug /Homeassistant/ or?

Enable SSH and try to access via SSH, then launch locate alexa_media.pickle or find / -name "alexa_media.pickle" 2>/dev/null

I have found that it can be difficult to find, mine is located in /mnt/dietpi_userdata/homeassistant/.storage/alexa_media.pickle Depending on the system hosting Home Assistant you can launch a global search to find out where it is.

Same problem for me too. After updating to version 5.5.1, I started receiving OTP SMS messages from Amazon every 2-3 minutes. Thinking it was a hacking attempt, I changed my passwords, then realized it all started after updating AMP. I reverted to the previous version and everything went back to working smoothly without any OTP requests.

Solved! I deleted(renamed) the file ../homeassistant/.storage/alexa_media.pickle and restarted HA and now it works! The … depends on where is your folder located… I have Dietpi and the full path is /mnt/dietpi_userdata/homeassistant/.storage/alexa_media.pickle

AMP was never written to deal with OTP codes issued by Amazon via SMS. It only works with 2-step Verification using an authenticator app generated OTP, the authenticator app being AMP itself via Python’s pyauth/pyotp which it supplies with the 52-character app secret to self-generate a TOTP (time-based one time password aka “OTP”) to give to Amazon. The SMS OTP is generated by Amazon and AMP can’t use that. You need to turn that off in your Amazon account.

This is happening to me as well on a fresh installation. After successfully authenticating on the web page, it just got stuck “Waiting for next step” and timed out.

Getting the same issue here, my devices are listed but for a few weeks I’ve been randomly receiving OTP texts, to the point I thought my Amazon account was compromised. After changing my password it happened again and I discovered the same error above in my Home Assistant logs. This error originated from a custom integration.

Logger: alexapy.helpers Source: custom_components/alexa_media/media_player.py:606 integration: Alexa Media Player (documentation, issues) First occurred: 10:20:51 PM (2 occurrences) Last logged: 10:20:54 PM

alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0xffff53095e10>,), {}): A login error occurred: An exception of type JSONDecodeError occurred. Arguments: (‘Expecting value: line 1 column 1 (char 0)’,) alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0xffff5272e0d0>,), {}): A login error occurred: An exception of type JSONDecodeError occurred. Arguments: (‘Expecting value: line 1 column 1 (char 0)’,)

Same problem here too on any version, even older ones

It seems like, I have the same issue.

Logger: alexapy.helpers
Quelle: custom_components/alexa_media/media_player.py:606
Integration: Alexa Media Player (Dokumentation, Probleme)
Erstmals aufgetreten: 4. März 2025 um 20:28:06 (5 Vorkommnisse)
Zuletzt protokolliert: 21:57:46

alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f29ad227230>,), {}): A login error occurred: An exception of type JSONDecodeError occurred. Arguments: ('Expecting value: line 1 column 1 (char 0)',)
alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f29ad227100>,), {}): A login error occurred: An exception of type JSONDecodeError occurred. Arguments: ('Expecting value: line 1 column 1 (char 0)',)
alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f29f25b2660>,), {}): A login error occurred: An exception of type JSONDecodeError occurred. Arguments: ('Expecting value: line 1 column 1 (char 0)',)