caronc / apprise

Apprise - Push Notifications that work with just about every platform!
https://hub.docker.com/r/caronc/apprise
BSD 2-Clause "Simplified" License
11.7k stars 410 forks source link

Sending notifications to mqtt(s) doesn't work #1078

Closed Red96Baron closed 6 months ago

Red96Baron commented 6 months ago

:mega: Notification Service(s) Impacted mqtt/mqtts

:lady_beetle: Describe the bug sending a notification to mqtt(s) leads to an error

:bulb: Screenshots and Logs

$ pip3 list|grep apprise
apprise                1.7.3
ls|apprise  --body='{"Test":"Test"}' mqtts://changedetection:***@mqtt.***.com:8883/changedetection
Exception ignored in: <function Client.__del__ at 0x7f1756036170>
Traceback (most recent call last):
  File "/usr/local/paho/mqtt/client.py", line 874, in __del__
    self._reset_sockets()
  File "/usr/local/paho/mqtt/client.py", line 1133, in _reset_sockets
    self._sock_close()
  File "/usr/local/paho/mqtt/client.py", line 1119, in _sock_close
    if not self._sock:
AttributeError: 'Client' object has no attribute '_sock'
2024-03-09 14:54:58,571 - ERROR - Could not load MQTT Notification URL: mqtt://changedetection:U...k@1...8:1883/changedetection
2024-03-09 14:54:58,572 - ERROR - There are no service(s) to notify

:computer: Your System Details:

:crystal_ball: Additional context relates to changedetection issue 2241

caronc commented 6 months ago

This is related to the version of mqtt being installed under the hood. The new version was released (v2.0) and not backwards compatible with its previous. See here.

Your Change detection instance just needs to include the previous version of paho-mqtt and it will work fine.

dgtlmoon commented 6 months ago

@caronc thanks as always <3 this can be closed https://github.com/dgtlmoon/changedetection.io/pull/2242

caronc commented 6 months ago

Will do!