core: Notify with xmpp are not compatible with Python 3.11 completly, if you use upload function
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:
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (7 by maintainers)
@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 . 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 😃