python exception set prior to callback 'onConnect'

Python and python framework

Moderator: leecollings

Post Reply
AchilleTalon
Posts: 14
Joined: Wednesday 17 February 2021 9:28
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Contact:

python exception set prior to callback 'onConnect'

Post 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.
User avatar
waltervl
Posts: 5844
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: python exception set prior to callback 'onConnect'

Post 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)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
AchilleTalon
Posts: 14
Joined: Wednesday 17 February 2021 9:28
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Contact:

Re: python exception set prior to callback 'onConnect'

Post 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).
Last edited by AchilleTalon on Thursday 12 October 2023 19:55, edited 1 time in total.
User avatar
waltervl
Posts: 5844
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: python exception set prior to callback 'onConnect'

Post 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?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
AchilleTalon
Posts: 14
Joined: Wednesday 17 February 2021 9:28
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Contact:

Re: python exception set prior to callback 'onConnect'

Post 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.
AchilleTalon
Posts: 14
Joined: Wednesday 17 February 2021 9:28
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Contact:

Re: python exception set prior to callback 'onConnect'

Post 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...
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest