Page 1 of 1

python exception set prior to callback 'onConnect'

Posted: Wednesday 11 October 2023 9:20
by AchilleTalon
Hello all.

I recently updated to bullseye because I needed the latest version of zigbeefordomoticz.
I updated (instead of a clean install) and everything seemed ok.

But I am now facing an error with plugins I wrote (mostly based on ShellyMQTT plugin). These three plugins use an MQTT connection to interact with object (3G usb stick, TPLink cameras and a Sonoff RF gateway), combining mqtt for external control, notification and devices for control within domoticz.
They used to work nicelly with buster.


But in bullseye and python3.9.2, I get an error from domoticz:

Code: Select all

MyPlugin: Python exception set prior to callback 'onConnect'
Error: MyPlugin: Call to function 'onConnect' failed, exception details:
Error: MyPlugin: Exception: 'TypeError'. No traceback available.
MQTT works fine outside domoticz, both in publication and subscription. For instance, "MQTT autodiscovery" works just fine (it is not a python plugin though).

I was able to identify where the error was triggered: during a call to method "Connect" of the Domoticz.Connection object, the connection to the MQTT broker. Commenting out this connection gets rid of the error, allowing the plugin to function with internal notifications and all, but onbviously without mqtt.

raspberry 3B+ - bullseye (32b)
python 3.9.2
tested both domoticz 2023.2 and build 15597 (latest beta)
mosquitto V2.0.11

I suspect a conflict between python versions, but how do I narrow it down and fix it?
Thanks a lot for your help.

Re: python exception set prior to callback 'onConnect'

Posted: Wednesday 11 October 2023 14:22
by waltervl
What python version is Domoticz using? See menu Setup - About.
It could be it is still using the old version. (3.7.x)

Re: python exception set prior to callback 'onConnect'

Posted: Wednesday 11 October 2023 17:54
by AchilleTalon
It is using the system's default: 3.9.2. I also have a python2.7 installed, but it doesn't seem to be used by domoticz ("about" menu or message in log at startup).

Re: python exception set prior to callback 'onConnect'

Posted: Wednesday 11 October 2023 22:37
by waltervl
Perhaps also update the additional libraries you have to install as indicated on the using Python plugin wiki page. It could be some are not updated by the upgrade to bullseye?

Re: python exception set prior to callback 'onConnect'

Posted: Thursday 12 October 2023 19:57
by AchilleTalon
I have looked into that. Haven't found anything yet.

I'll look some more, but I think I will end up recompiling my version of domoticz to add explicit error reporting of the python framework, just like in this post.

I'll keep you posted.

Re: python exception set prior to callback 'onConnect'

Posted: Saturday 14 October 2023 16:36
by AchilleTalon
Recompiling gave me access to more error messages :

Code: Select all

MonPlugin: Socket Shutdown Error: 107, Noeud final de transport n'est pas connect�  (French for "Transport endpoint is not connected")
MonPlugin: Async Read Exception (127.0.0.1:1883): 104, Connexion r魩nitialis饠par le correspondant (French for "Connection reset by peer")
followed by a 'UnicodeDecodeError'.

Not sure what to do with that...