home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.67k stars 30.42k forks source link

Notify with xmpp are not compatible with Python 3.11 completly, if you use upload function #90465

Closed centertivevier closed 1 year ago

centertivevier commented 1 year ago

The problem

I use notify with xmpp and upload with the message a image. On Python 3.10 is all fine, but with Python 3.11 can´t use the upload for a image

What version of Home Assistant Core has the issue?

2023.3.6

What was the last working version of Home Assistant Core?

2023.3.6

What type of installation are you running?

Home Assistant Core

Integration causing the issue

XMPP

Link to integration documentation on our website

https://www.home-assistant.io/integrations/xmpp/

Diagnostics information

No response

Example YAML snippet

service: notify.xmpp_test
data:
  title: 1. Wetterwarnung
  message: >-
    {{state_attr('sensor.dwd_weather_warnings_current_warning_level',
    'warning_1_headline') }} -
    {{state_attr('sensor.dwd_weather_warnings_current_warning_level',
    'warning_1_description') }} gültig von
    {{state_attr('sensor.dwd_weather_warnings_current_warning_level',
    'warning_1_start') }} bis
    {{state_attr('sensor.dwd_weather_warnings_current_warning_level',
    'warning_1_end') }}
  data:
    url: https://images-webcams.windy.com/69/1649504669/current/full/1649504669.jpg

Anything in the logs that might be useful for us?

Mär 29 18:48:13 openhab hass[5881]:               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mär 29 18:48:13 openhab hass[5881]:   File "/srv/homeassistant/lib/python3.11/site-packages/slixmpp/plugins/xep_0363/http_upload.py", line 107, in find_upload_service
Mär 29 18:48:13 openhab hass[5881]:     results = await self.xmpp['xep_0030'].get_info_from_domain(
Mär 29 18:48:13 openhab hass[5881]:               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mär 29 18:48:13 openhab hass[5881]:   File "/srv/homeassistant/lib/python3.11/site-packages/slixmpp/plugins/xep_0030/disco.py", line 326, in get_info_from_domain
Mär 29 18:48:13 openhab hass[5881]:     info_futures, _ = await asyncio.wait(
Mär 29 18:48:13 openhab hass[5881]:                       ^^^^^^^^^^^^^^^^^^^
Mär 29 18:48:13 openhab hass[5881]:   File "/usr/lib/python3.11/asyncio/tasks.py", line 415, in wait
Mär 29 18:48:13 openhab hass[5881]:     raise TypeError("Passing coroutines is forbidden, use tasks explicitly.")
Mär 29 18:48:13 openhab hass[5881]: TypeError: Passing coroutines is forbidden, use tasks explicitly.

Additional information

With Pyhton 3.10 all fine. I found this issue with same problem:

https://github.com/home-assistant/core/issues/88990

home-assistant[bot] commented 1 year ago

Hey there @fabaff, @flowolf, mind taking a look at this issue as it has been labeled with an integration (xmpp) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `xmpp` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign xmpp` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


xmpp documentation xmpp source (message by IssueLinks)

fabaff commented 1 year ago

This is an issue in slixmpp, please report at https://lab.louiz.org/poezio/slixmpp/-/issues.

centertivevier commented 1 year ago

Hmm. On this instance is not a opinion to sign up a account. Only sign in with a existing account.

rallep71 commented 1 year ago

@fabaff @flowolf the same here, #

`Logger: slixmpp.basexmpp Source: components/xmpp/notify.py:301 First occurred: 10:43:06 (15 occurrences) Last logged: 10:50:45

Passing coroutines is forbidden, use tasks explicitly. Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/slixmpp/xmlstream/xmlstream.py", line 1106, in handler_callback_routine await cb(data) File "/usr/src/homeassistant/homeassistant/components/xmpp/notify.py", line 175, in start await self.send_file(timeout=timeout) File "/usr/src/homeassistant/homeassistant/components/xmpp/notify.py", line 190, in send_file url = await self.upload_file(timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/xmpp/notify.py", line 246, in upload_file url = await self.upload_file_from_url(data[ATTR_URL], timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/xmpp/notify.py", line 301, in upload_file_from_url url = await self["xep_0363"].upload_file( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/slixmpp/plugins/xep_0363/http_upload.py", line 163, in upload_file info_iq = await self.find_upload_service( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/slixmpp/plugins/xep_0363/http_upload.py", line 107, in find_upload_service results = await self.xmpp['xep_0030'].get_info_from_domain( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/slixmpp/plugins/xep_0030/disco.py", line 326, in get_info_from_domain infofutures, = await asyncio.wait( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/tasks.py", line 415, in wait raise TypeError("Passing coroutines is forbidden, use tasks explicitly.") TypeError: Passing coroutines is forbidden, use tasks explicitly.`

rallep71 commented 1 year ago

@fabaff @flowolf "https://lab.louiz.org/poezio/slixmpp/-/issues."

Only sign in with a existing account.!!!

rallep71 commented 1 year ago

slixmpp https://lab.louiz.org/poezio/slixmpp/-/releases/slix-1.8.4 since two weeks ago. support 3.11 and 3.7!!!

i think it must be corect implemented. THX

rallep71 commented 1 year ago

Ok, good. With about 60 installations using the XMMP addon the urgency doesn't seem to be that high to adapt it. that's a pity!!!! However, I can control my Notify's thanks to self-hosted XMPP server, not so with other cloud services that are here at HA partly much better integrated instead of the original xmpp and its possibilities. I am not able to change the code myself.

epenet commented 1 year ago

Please stop pinging me. I have never used this integration.

rallep71 commented 1 year ago

@centertivevier

es scheint keiner dafür zuständig zu sein, es ist einfach zum kotzen! Musste jetzt leider auf Telegram umsteigen. Bei XMPP konnte ich meinen Server privat zuhause hosten. Alles bauen auf XMPP auf, ob whatapp, telegram usw, nur das Original wird Stiefmütterilch behandelt, in Node Red ist es das Selbe. Schade das isch kein Python kann und auch schon zu alt bin um das jetzt noch zu lernen. Na vielleicht tut sich ja her noch was, aber bei nur 60 Installationen wird das hier keine Priorität haben. MfG

flowolf commented 1 year ago

I'd like to weigh in here:

Please remember that Home Assistant is 'Free Software' as in 'Free Beer' but it's also 'Free Software' as in 'Free Speech' - you can adapt it to your liking at any point. It comes with great documentation. You can fork it, patch it and run it in any configuration you want; and you don't have to pay for anything. In return there are no guarantees!

And please remember that most of the code is maintained by volunteers! we do that in our spare time. I, personally, currently don't find the time to do much next to my day job and family.

Please volunteer if you have the time.

centertivevier commented 1 year ago

@rallep71 . Ich habe mich mal versucht mit einem Pull Request, siehe https://github.com/home-assistant/core/pull/94944 und hoffe das Ganze ist so korrekt. Wenn mal mehr Zeit ist, kann ich mehr beitragen zu Homeassistant.

@flowolf I hope i can do that with this pull request :-)

rallep71 commented 1 year ago

Super!!!

rallep71 commented 1 year ago

@centertivevier ich hab mir das jetzt mal durch gesehen, Du hast praktisch, "requirements" also das was benötigt oder Voraussetzung ist auf "slixmpp==1.8.4", das wollte ich auch schon machen, bei mir in der HA Installation, nur leider finde ich den Pfad dorthin nicht, gut, sei es drum. Aber ich denke es muss noch mehr getan werden als nur die Version hoch zu pumpen, ich denke da muss an dieser notify.py noch was umgeschrieben werden, oder geht das automatisch? LG

I've looked through this now, you've practically set "requirements" to "slixmpp==1.8.4", I wanted to do that too, in my HA installation, but unfortunately I can't find the path to it, well, so be it. But I think there is more to be done than just pumping up the version, I think something has to be rewritten in this notify.py, or is it done automatically? LG

centertivevier commented 1 year ago

@rallep71

Das Log hat mir damals folgendes ausgespuckt wie oben zusehen: File "/srv/homeassistant/lib/python3.11/site-packages/slixmpp/plugins/xep_0363/http_upload.py", line 107, in find_upload_service Mär 29 18:48:13 openhab hass[5881]: results = await self.xmpp['xep_0030'].get_info_from_domain( Mär 29 18:48:13 openhab hass[5881]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mär 29 18:48:13 openhab hass[5881]: File "/srv/homeassistant/lib/python3.11/site-packages/slixmpp/plugins/xep_0030/disco.py", line 326, in get_info_from_domain Mär 29 18:48:13 openhab hass[5881]: info_futures, _ = await asyncio.wait( Mär 29 18:48:13 openhab hass[5881]: ^^^^^^^^^^^^^^^^^^^

Hier scheint es ein Problem bei Python 3.11 und dem XEP-0030 zugeben, nämlich das er über Disco keinen Dienst bekommt, wo er die Dateien hochladen soll. Genau hier hat man das Ganze gefixt im Changelog:

XEP-0030 (Service Discovery):

Allow passing extra Iq arguments (e.g. timeout, etc) Python 3.11 compatibility (asyncio.wait only accept tasks) Get_items(): always set a 'from' attribute for ComponentXMPP Get_items(): fix local calls

Das Problem ist nicht die notify.py, sondern dass die Anwendung vom Server keinen Pfad mehr bekommt, wo der Upload hin soll. Jingle File Transfer geht ja nicht, da die Clients nicht live online sind. Es sollte wie gesagt reichen die Abhängigkeiten zu ändern.

Kann leider auch kein Python richtig, aber sollte diese Änderung nicht reichen, dann würde ich mich mal versuchen an der notify.py und weiter eingrenzen. Das Problem ist immer nur Zeit, wie auch die anderen hier schreiben. Deswegen teste ich immer am Livesystem, was aktiv im Dauereinsatz ist :-).

Here there seems to be a problem with Python 3.11 and the XEP-0030, namely that he gets over Disco no service, where he should upload the files. Exactly here one has the whole thing fixed in the Changelog:

XEP-0030 (Service Discovery):

Allow passing extra Iq arguments (e.g. timeout, etc) Python 3.11 compatibility (asyncio.wait only accept tasks) Get_items(): always set a 'from' attribute for ComponentXMPP Get_items(): fix local calls

The problem is not the notify.py, but that the application does not get a path from the server where the upload should go. Jingle file transfer does not work, because the clients are not live online. It should be enough to change the dependencies.

Can unfortunately also no Python correctly, but should this change not be enough, then I would try me times at the notify.py and further narrow down. The problem is always only time, as also the others write here. That's why I always test on the live system, which is actively in continuous use :-).

rallep71 commented 1 year ago

Ok, das habe ich jetzt verstanden ;) dann wollen wir hoffen das es beim nächsten update mit drinnen ist :D

Ok, I have understood that now ;) then let's hope that it will be included in the next update :D

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

centertivevier commented 1 year ago

The problem was solved with https://github.com/home-assistant/core/pull/94944