Closed torhelge02 closed 7 months ago
Can you please write down your setup? I wasn't able to reproduce the issue. Thanks
EDIT: I think I get it. It happens on new installations, because when executing dockerfile it build the image with the new version (2.0) of paho-mqtt. Otherwise if the image was already builded, the paho-mqtt version included is the 1.6 At the moment I will simply declare the version of paho-mqtt to install in the dockerfile. I will fix this in the beta that I'm going to release in a few days.
Don't know if it matters, but I am using a different MQTT broker than the one in Home Assistant (I'm using the Mosquito broker for Unraid). Also, after a bit of back and forth yesterday, I figured out that the CallbackAPIVersion had to be VERSION1 (which is deprecated) and not VERSION2, to work. When I used VERSION2, it said "Connected", but wasn't actually able to publish or subscribe to anything. That's why I closed the pull request.
The fix you are mentioning with forcing an old version will probably work just as well. There might be more than just this that broke in version 2 of paho-mqtt, but my fix seems to be working so far.
Added callback_api_version to main.py, to fix the following fatal error during startup of the add-on, after setting up MQTT:
[2024-02-10 20:51:29] STATUS: Starting MQTT
Traceback (most recent call last):
File "/simplescheduler/main.py", line 861, in <module>
mqttclient = mqtt.Client(client_id="SimpleScheduler", clean_session=False)
TypeError: __init__() missing 1 required positional argument: 'callback_api_version'
[20:51:30] WARNING: example 2 crashed, halting add-on