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.54k stars 291 forks source link

Beta 2024.12.0b0 breaks amp #2698

Open Bergasha opened 4 days ago

Bergasha commented 4 days 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

Integration does not load

To Reproduce

update to latest beta

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

Expected behavior

it works

Screenshots

System details

Debug Logs (alexa_media & alexapy)

Unable to install package alexapy==1.29.4: × No solution found when resolving dependencies: ╰─▶ Because alexapy==1.29.4 depends on aiofiles>=23.1.0,<24.0.0 and aiofiles>=24.1.0, we can conclude that alexapy==1.29.4 cannot be used. And because you require alexapy==1.29.4, we can conclude that your requirements are unsatisfiable.

Additional context

IceBotYT commented 4 days ago

It looks like an update to aiofiles 24.1.0 would fix the problem

danielbrunt57 commented 4 days ago

It looks like an update to aiofiles 24.1.0 would fix the problem

I checked what's changed in aiofiles 24.1.0 from 23.2.1 and the update looks to be safe for alexapy to use. That said, it still needs to be tested first. Then alexapy library dependencies updated followed by alexapy bump to v1.29.5, then new AMP bump with a revised manifest.json...

@alandtse: alexapy issue posted: Error loading Alexa Media Player integration on the latest HA beta release 2024.12.0b0 which requires aiofiles>=24.1.0

larena1 commented 3 days ago

Can't we just move alexapy into this repo to ease further development? Aland is not anymore maintaining it anyway and even barely looking into issues and prs unfortunately so everything takes really long and then it still needs to be published to pypi and bumped here etc

danielbrunt57 commented 3 days ago

It's not as simple as that since alexapy is a python library that HA imports like httpx, aiohttp, aiofiles, typing, etc, etc, etc. Besides, @alandtse still owns the GitHub repo for alexa_media and the GutLab repo for alexapy in PyPi and manages and reviews the PR's for them. He's just contributing and code or consultation. Good luck finding someone to take on the responsibility of the entire project!

I posted an issue for this in alexapy and Alan has responded there but there's no PR there yet. I just wish the current AMP release of 5.0.0 was 4.13.9 or 4.14.0 until alexapy is updated, merged, then AMP updated, merged and then released as 5.0.0.

pbranly commented 3 days ago

Hi I just used the 5.0.0 with the last HA beta and the issue is still there "Setup failed for custom integration 'alexa_media': Requirements for alexa_media not found: ['alexapy==1.29.4']." Phil

larena1 commented 3 days ago

It's not as simple as that since alexapy is a python library that HA imports like httpx, aiohttp, aiofiles, typing, etc, etc, etc.

It's just about copying the files, adjusting the imports and doing the same also with the auth capture proxy, isn't it? I think both libraries are not used anywhere else either way and the only downside would be updates of the component being a bit bigger but also less maintenance burden for @alandtse who needs to monitor multiple repos, bump and release alexapy, then bump alexapy here and release the component. It would also make it easier to develop stuff when it's all in the component and quick fixes could even be applied by the users as in this case before an official update is available

danielbrunt57 commented 2 days ago

Hi I just used the 5.0.0 with the last HA beta and the issue is still there "Setup failed for custom integration 'alexa_media': Requirements for alexa_media not found: ['alexapy==1.29.4']." Phil

There's been no change yet in alexapy and it's aiofiles>=23.1.0,<24.0.0 requirement and I highly doubt any change will occur before 12.0.0 official is released next week.

If you want to continue using AMP, you'll have to stay on Core 11.x until alexapy is updated unless you are prepared to do the following...

danielbrunt57 commented 2 days ago

If you want to try using AMP & Core 12.x before alexapy is updated, you'll have to edit line 16 in file homeassistant:/usr/local/lib/python3.12/site-packages/alexapy-1.29.4.dist-info/METADATA to read Requires-Dist: aiofiles (>=23.1.0,<25.0.0). Before you can do that, you first have to get HA to install alexapy!

Here are my steps... I upgraded from Core 2024.11.3 to 2024.12.0b2. Then...

pip install alexapy

This will downgrade aiofiles to 23.2.1 and that has to be rectified as other modules depend on aiofiles 24.1.0. Before rectifying though, edit /usr/local/lib/python3.13/site-packages/alexapy-1.29.4.dist-info/METADATA Line 16: Change 24.0.0 to 25.0.0

Than...

pip install aiofiles -U

(this will restore aiofiles 24.1.0)

Since alexawebsocket.py will now fail on from aiohttp.http_websocket import ALLOWED_CLOSE_CODES in Python 3.13, Edit /usr/local/lib/python3.13/site-packages/alexapy/alexwebsocket.py and change Line 26: from aiohttp.http_websocket import ALLOWED_CLOSE_CODES, WSCloseCode To: from aiohttp import http_websocket

Restart Home Assistant and AMP/alexapy should be working in HA Core 2024.12.x.

NOTE: This process will need to be repeated after every HA Core update since updating core redownloads everything and the changes you've made will be lost!

aiofiles History 24.1.0 (2024-06-24)

  • Import os.link conditionally to fix importing on android. #175
  • Remove spurious items from aiofiles.os.all when running on Windows.
  • Switch to more modern async idioms: Remove types.coroutine and make AiofilesContextManager an awaitable instead a > coroutine.
  • Add aiofiles.os.path.abspath and aiofiles.os.getcwd. #174
  • aiofiles is now tested on Python 3.13 too. #184
  • Dropped Python 3.7 support. If you require it, use version 23.2.1
larena1 commented 2 days ago

Or just install this wheel (might need to rename from zip to whl first as GitHub doesn't allow uploading whl files) using pip install alexapy-1.29.4-py3-none-any.whl and restart HA afterwards.

But that's exactly the reason why I think those few alexapy python files should be just moved into this repo.

alexapy-1.29.4-py3-none-any.zip

dreimer1986 commented 1 day ago

Unlikely. AlexaPy is a multi purpose module for Python and not bound to this single use case we have here. So if you would say "copied" as in forked, then yes, might be a nice idea if you want to add even more work to your maintenance workflow, but only then. Otherwise you have to wait until it's fixed over there. We are not talking about hours of work to fix it, so I see no reason to fork anything here. (+ Luckily it's nothing anyone here can decide anyways ^^)

And while we are at it... I use this Addin for years now and NEVER had big downtimes in the release cycle. So where in the name of :putgodlikentitynamehere: comes this never asked for "it's broken for months now!!!!!1eleven" mentality from?! It's your fault that you install the Home Assistant Beta and now complaining that things don't work for a few days is nothing but naive and if I were the developer, I would even call it a direct insult of my work. Betas are not meant for everyday use, but to report bugs. This was done already, so wait until it's fixed!

P.S. Because we live in a world where everyone feels immediately insulted, discriminated etc etc... This one was not against the ppl who came here to rightfully report the issue or help with temporary solutions.

larena1 commented 1 day ago

Unlikely. AlexaPy is a multi purpose module for Python and not bound to this single use case we have here.

@dreimer1986 Thanks for the lesson although you seem to have missed that alexapy was built specifically for this addon to retire the previous NodeJS solution and might not even be used anywhere else than here.

For the rest please read my comments and arguments more thoroughly and save all our time by refraining from posting when you are unable to add anything of value to the discussion

danielbrunt57 commented 1 day ago

As stated, betas are to test code and report issues. If you want an instant fix, go back to core 2024.11.

I am working when I have time to try fix the issue.

I managed to get alexapy 1.29.4 installed into core 2024.12.0b2 and found that alexawebsocket.py's from aiohttp.http_websocket import ALLOWED_CLOSE_CODES, WSCloseCode fails since aiohttp.http_websocket is structured differently in python 3.13 and ALLOWED_CLOSE_CODES is no longer defined where it used to be. This means that a new alexapy 1.29.5 should be released with the requirement that aiofiles is 24.x &/or python version is 3.13, a new AMP version released (6.0.0?) requiring alexapy 1.29.5 and all of that is a major breaking change. I'm inside alexawebsocket.py now to see if I can do conditional importing based on python minor version ('12' or '13). I'm not sure if this approach will pass Alan's scrutiny or not...

danielbrunt57 commented 1 day ago

@dreimer1986 Thanks for the lesson although you seem to have missed that alexapy was built specifically for this addon to retire the previous NodeJS solution and might not even be used anywhere else than here.

If this is accurate then bundling alexapy (and it's required companion authcaptureproxy) inside AMP might be the way to go but that will take a bit of rewriting so that AMP no longer imports from alexapy but from ??? instead...

dreimer1986 commented 1 day ago

@dreimer1986 Thanks for the lesson although you seem to have missed that alexapy was built specifically for this addon to retire the previous NodeJS solution and might not even be used anywhere else than here

For the rest please read my comments and arguments more thoroughly and save all our time by refraining from posting when you are unable to add anything of value to the discussion

You're welcome, more than happy that you appreciate it. I know that too well as I was already here when the split happened. It's a module and was outsourced for a reason. The reason is to provide it's features for more than one use case AND to ease maintenance. Yes, the split was to make things easier and your asked for merge would cause the opposite.

Btw, talking about value... I read your new comment addressing me more thorough than I normally would do, but even when I did that I must admit there was not much more value coming out of it...

I don't even get what your problem is. I mentioned where you provided a good workaround including all problems that will be caused and still you think you are the corpus delicti I talk about?! I said one should just wait and not start madness on false facts. Not more and not less!

But as you already decided to mistakenly project everything onto yourself and confirming my P.S. too well... Claiming that the module is unmaintained and unused otherwise has zero value, too, as it's just some baseless claim.

So it would be too kind of you refrain from posting such "facts" as poisoning the discussion with false claims has not that much value and steals even more of our time...

Last thing here, as this is too much of a Kindergarten already. My text's value was at least honoured by one guy, but to explain it to you:

I said that telling ppl this problem will stay forever as the module is outsourced and unmaintained by the lazy devs and the other false claims is not helping anyone, but causing trouble. That I tried to rectify and as the issue is known to both devs, I recommended to wait for the fix. This fix will come and it will not even cause trouble to release branch users. (If both devs have time to fix it on time and until today they always had)

:mikedrop:

danielbrunt57 commented 1 day ago

If both devs have time to fix it on time and until today they always had

If I'm not mistaken, alexa_media, alexapy and authcaptureproxy repositories are all owned by alandtse...

larena1 commented 1 day ago

If both devs have time to fix it on time and until today they always had

If I'm not mistaken, alexa_media, alexapy and authcaptureproxy repositories are all owned by alandtse...

Better not try to argue with him. He also doesn't seem to have realized yet that Alan is not actively developing anything anymore and only looking into other people's submissions and that alexa_media and authcaptureproxy might not be used by anything else although technically possible.