alandtse / alexa_media_player

This is a custom component to allow control of Amazon Alexa devices in Home Assistant using the unofficial Alexa API.
Apache License 2.0
1.36k stars 263 forks source link

Alexa Media Player fails to start after restarting HA 2024.6.3 #2290

Open macroysan opened 2 weeks ago

macroysan commented 2 weeks ago

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

To Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

Screenshots

System details

Logs Please provide logs.

Additional context

DanrwAU commented 1 week ago

Seeing similar issues with failing to start.

Restarting does fix it

2024-06-22 12:39:07.053 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry myemail - amazon.com.au for alexa_media
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alexa_media/__init__.py", line 335, in async_setup_entry
await login.login(cookies=await login.load_cookie())
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py", line 328, in load_cookie
cookies = pickle.loads(await myfile.read())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/http/cookies.py", line 312, in __setitem__
raise CookieError("Invalid attribute %r" % (K,))
http.cookies.CookieError: Invalid attribute 'partitioned'
jum0n commented 1 week ago

Mine fails after every HA restart. If I manually restart later, it works until the next restart then fails to start again. Is that the same behavior each of you have?

Menz01 commented 1 week ago

for me... every time I restart HA it shows failed but if i go to the integration and click reload, it starts working

TarheelGrad1998 commented 1 week ago

Same issue, with the partitioned error. As a workaround, I have implemented an automation that fixes it for now (below, replace with one of your Alexa media players).

alias: "Alexa Media: Keep Online"
description: ""
trigger:
  - platform: state
    entity_id:
      - media_player.den_echo
    to: unavailable
    for:
      hours: 0
      minutes: 1
      seconds: 0
action:
  - service: homeassistant.reload_config_entry
    target:
      entity_id: media_player.den_echo
    data: {}
mode: single
bozzobrain commented 1 week ago

Same issue here. Restart HA and Alexa Media Player failed to setup. Reloading the integration appears to permanently fix the setup until the next restart of HA.

Log

Logger: homeassistant.config_entries
Source: config_entries.py:594
First occurred: 2:08:55 PM (1 occurrences)
Last logged: 2:08:55 PM

Error setting up entry email@gmail.com - amazon.com for alexa_media
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/alexa_media/__init__.py", line 335, in async_setup_entry
    await login.login(cookies=await login.load_cookie())
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py", line 328, in load_cookie
    cookies = pickle.loads(await myfile.read())
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/http/cookies.py", line 312, in __setitem__
    raise CookieError("Invalid attribute %r" % (K,))
http.cookies.CookieError: Invalid attribute 'partitioned'
simonk1969 commented 1 week ago

Isn't this a duplication of #2288 ?

danielbrunt57 commented 1 week ago

Isn't this a duplication of #2288 ?

Yes it is.

danielbrunt57 commented 1 day ago

This is a duplicate of https://github.com/alandtse/alexa_media_player/issues/2288.