Plugins and Python 3.10

Python and python framework

Moderator: leecollings

Post Reply
meyland
Posts: 35
Joined: Wednesday 03 January 2018 16:39
Target OS: Linux
Domoticz version: 2020.2
Location: Denmark
Contact:

Plugins and Python 3.10

Post by meyland »

Hi

Right now I'm running Domoticz version 2022.1 (build 14268) on Fedora 35 and Phyton 3.10.2. I have installed some plug-ins in my Domoticz environment and the most of them are working without problems. But two of them says "Python exception set prior to callback 'onMessage'", which results in no input from the plug-ins.
The two plug-ins are:
  • Domoticz-deCONZ
  • yamaha-av-receiver
I have, of course, checked for newer versions of the plug-ins

Can anyone give me at hint to a solution?
regards

Peter
User avatar
waltervl
Posts: 5711
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Plugins and Python 3.10

Post by waltervl »

Python 3.10 support in Domoticz beta is still experimental. Fedora is also not very common.
Can you post some more logging?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
meyland
Posts: 35
Joined: Wednesday 03 January 2018 16:39
Target OS: Linux
Domoticz version: 2020.2
Location: Denmark
Contact:

Re: Plugins and Python 3.10

Post by meyland »

I would like to give more information, but the text "Python exception set prior to callback 'onMessage'" is the only message I get. Can you maybe tell me how I can enable more logging.
regards

Peter
User avatar
waltervl
Posts: 5711
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Plugins and Python 3.10

Post by waltervl »

Sometimes you can set extra debug logging on in the plugin (through menu setup - hardware).
What happens if you only update the plugin without changing anything through menu setup - hardware (it will/should restart).
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
meyland
Posts: 35
Joined: Wednesday 03 January 2018 16:39
Target OS: Linux
Domoticz version: 2020.2
Location: Denmark
Contact:

Re: Plugins and Python 3.10

Post by meyland »

I have now tried to turn on debug info in the Yamaha Plug-in and there are a lot of info, but no extra info about the error, only the text "Python exception set prior to callback 'onMessage'". Before I upgraded my server to Fedora 35 (and Python 3.10) everything was working.
regards

Peter
meyland
Posts: 35
Joined: Wednesday 03 January 2018 16:39
Target OS: Linux
Domoticz version: 2020.2
Location: Denmark
Contact:

Re: Plugins and Python 3.10

Post by meyland »

I've tried to do some debugging in det code. I've modified the function ProcessInbound in class CPluginProtocolLine (PluginProtocols.cpp, line 101), so I got som debug information:

Code: Select all

	void CPluginProtocolLine::ProcessInbound(const ReadEvent* Message)
	{
		CConnection* pConnection = Message->m_pConnection;    //pm
		CPlugin* pPlugin = pConnection->pPlugin;              //pm
      pPlugin->Log(LOG_ERROR, "(%s) entry", __func__);      //pm

		//
		//	Handles the cases where a read contains a partial message or multiple messages
		//
		std::vector<byte>	vData = m_sRetainedData;										// if there was some data left over from last time add it back in
		vData.insert(vData.end(), Message->m_Buffer.begin(), Message->m_Buffer.end());		// add the new data

		std::string		sData(vData.begin(), vData.end());
		int iPos = sData.find_first_of('\r');		//  Look for message terminator
      pPlugin->Log(LOG_ERROR, "(%s) iPos  : %d", __func__, iPos);  //pm
      pPlugin->Log(LOG_ERROR, "(%s) string: %s", __func__, sData.c_str());  //pm

		while (iPos != std::string::npos)
		{
			Message->m_pConnection->pPlugin->MessagePlugin(new onMessageCallback(Message->m_pConnection, std::vector<byte>(&sData[0], &sData[iPos])));

			if (sData[iPos + 1] == '\n') iPos++;				//  Handle \r\n
			sData = sData.substr(iPos + 1);
			iPos = sData.find_first_of('\r');
         pPlugin->Log(LOG_ERROR, "(%s) iPos  : %d", __func__, iPos);  //pm
         pPlugin->Log(LOG_ERROR, "(%s) string: %s", __func__, sData.c_str());  //pm
		}
      pPlugin->Log(LOG_ERROR, "(%s) string: %s", __func__, sData.c_str());  //pm

		m_sRetainedData.assign(sData.c_str(), sData.c_str() + sData.length()); // retain any residual for next time
      pPlugin->Log(LOG_ERROR, "(%s) exit", __func__);       //pm
	}
The Yamaha plugin sends these commands to the receiver when started:

Code: Select all

@MAIN:PWR=?
@MAIN:VOL=?
@MAIN:INP=?
@MAIN:MUTE=?
@MAIN:SOUNDPRG=?
@MAIN:STRAIGHT=?
and the modificed code gives this result:

Code: Select all

2022-03-20 14:19:33.149  Error: AVR Yamaha: (ProcessInbound) entry
2022-03-20 14:19:33.149  Error: AVR Yamaha: (ProcessInbound) iPos  : 12
2022-03-20 14:19:33.149  Error: AVR Yamaha: (ProcessInbound) string: @MAIN:PWR=On

2022-03-20 14:19:33.149  Error: AVR Yamaha: (ProcessInbound) iPos  : -1
2022-03-20 14:19:33.149  Error: AVR Yamaha: (ProcessInbound) string:
2022-03-20 14:19:33.149  Error: AVR Yamaha: (ProcessInbound) string:
2022-03-20 14:19:33.149  Error: AVR Yamaha: (ProcessInbound) exit
2022-03-20 14:19:33.149  Error: AVR Yamaha: (ProcessInbound) entry
2022-03-20 14:19:33.149  Error: AVR Yamaha: (ProcessInbound) iPos  : 15
2022-03-20 14:19:33.149  Error: AVR Yamaha: (ProcessInbound) string: @MAIN:VOL=-50.0
@MAIN:INP=TUNER
@MAIN:MUTE=Off
@MAIN:SOUNDPRG=2ch Stereo
@MAIN:STRAIGHT=Off

2022-03-20 14:19:33.149  Error: AVR Yamaha: (ProcessInbound) iPos  : 15
2022-03-20 14:19:33.149  Error: AVR Yamaha: (ProcessInbound) string: @MAIN:INP=TUNER
@MAIN:MUTE=Off
@MAIN:SOUNDPRG=2ch Stereo
@MAIN:STRAIGHT=Off

2022-03-20 14:19:33.150  Error: AVR Yamaha: (ProcessInbound) iPos  : 14
2022-03-20 14:19:33.150  Error: AVR Yamaha: (ProcessInbound) string: @MAIN:MUTE=Off
@MAIN:SOUNDPRG=2ch Stereo
@MAIN:STRAIGHT=Off

2022-03-20 14:19:33.150  Error: AVR Yamaha: (ProcessInbound) iPos  : 25
2022-03-20 14:19:33.150  Error: AVR Yamaha: (ProcessInbound) string: @MAIN:SOUNDPRG=2ch Stereo
@MAIN:STRAIGHT=Off

2022-03-20 14:19:33.150  Error: AVR Yamaha: (ProcessInbound) iPos  : 18
2022-03-20 14:19:33.150  Error: AVR Yamaha: (ProcessInbound) string: @MAIN:STRAIGHT=Off

2022-03-20 14:19:33.150  Error: AVR Yamaha: (ProcessInbound) iPos  : -1
2022-03-20 14:19:33.150  Error: AVR Yamaha: (ProcessInbound) string:
2022-03-20 14:19:33.150  Error: AVR Yamaha: (ProcessInbound) string:
2022-03-20 14:19:33.150  Error: AVR Yamaha: (ProcessInbound) exit
2022-03-20 14:19:33.150  Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.162  Error: AVR Yamaha: Exception: 'SystemError'.  No traceback available.
2022-03-20 14:19:33.162  AVR Yamaha: (AVR Yamaha) Python exception set prior to callback 'onMessage'
2022-03-20 14:19:33.162  Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.162  Error: AVR Yamaha: Exception: 'TypeError'.  No traceback available.
2022-03-20 14:19:33.162  Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.162  Error: AVR Yamaha: Exception: 'SystemError'.  No traceback available.
2022-03-20 14:19:33.162  AVR Yamaha: (AVR Yamaha) Python exception set prior to callback 'onMessage'
2022-03-20 14:19:33.162  Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163  Error: AVR Yamaha: Exception: 'TypeError'.  No traceback available.
2022-03-20 14:19:33.163  Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163  Error: AVR Yamaha: Exception: 'SystemError'.  No traceback available.
2022-03-20 14:19:33.163  AVR Yamaha: (AVR Yamaha) Python exception set prior to callback 'onMessage'
2022-03-20 14:19:33.163  Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163  Error: AVR Yamaha: Exception: 'TypeError'.  No traceback available.
2022-03-20 14:19:33.163  Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163  Error: AVR Yamaha: Exception: 'SystemError'.  No traceback available.
2022-03-20 14:19:33.163  AVR Yamaha: (AVR Yamaha) Python exception set prior to callback 'onMessage'
2022-03-20 14:19:33.163  Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163  Error: AVR Yamaha: Exception: 'TypeError'.  No traceback available.
2022-03-20 14:19:33.163  Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163  Error: AVR Yamaha: Exception: 'SystemError'.  No traceback available.
2022-03-20 14:19:33.163  AVR Yamaha: (AVR Yamaha) Python exception set prior to callback 'onMessage'
2022-03-20 14:19:33.163  Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163  Error: AVR Yamaha: Exception: 'TypeError'.  No traceback available.
2022-03-20 14:19:33.163  Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163  Error: AVR Yamaha: Exception: 'SystemError'.  No traceback available.
2022-03-20 14:19:33.163  AVR Yamaha: (AVR Yamaha) Python exception set prior to callback 'onMessage'
2022-03-20 14:19:33.163  Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163  Error: AVR Yamaha: Exception: 'TypeError'.  No traceback available.
2022-03-20 14:19:37.234  Status: AVR Yamaha: Stop directive received.
regards

Peter
jzapater
Posts: 2
Joined: Tuesday 16 July 2013 0:40
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plugins and Python 3.10

Post by jzapater »

I have the same problem with Domoticz-Tuya-Thermostat-Plugin

Any solution ?
jzapater
Posts: 2
Joined: Tuesday 16 July 2013 0:40
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plugins and Python 3.10

Post by jzapater »

Thanks, @dnpwwo.

Resolved in your commit 0c099e19745c6440dd86446509516ce2947eb9a5
User avatar
epierre
Posts: 522
Joined: Wednesday 05 March 2014 13:16
Target OS: Linux
Domoticz version:
Location: France
Contact:

Re: Plugins and Python 3.10

Post by epierre »

seems the Linky plugin has some issue also on 3.10, though through alternatives I am unable to force 3.8 as domoticz always use 3.10 and I don't know why (even with strace...)
ImperiHome & MyDomoAtHome on top of:
868.42Mhz - Vera Lite - Fibaro SS-101, S-211, K-101, FWP - Fortress SSA2
433Mhz - Cubie Domoticz + RFXtrx + Oregon || Foscam 9821W
2,4Ghz - Cubie MySensors Gateway + COV + TempHumidity + Pressure + WaterMeter
Barberousse
Posts: 140
Joined: Wednesday 02 December 2015 21:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Plugins and Python 3.10

Post by Barberousse »

epierre wrote: Wednesday 24 August 2022 13:46 seems the Linky plugin has some issue also on 3.10, though through alternatives I am unable to force 3.8 as domoticz always use 3.10 and I don't know why (even with strace...)
To be more specific, there are troubles with the Configuration object, giving the message "Error: (JSONtoPython) failed to add item '-1', to list for string." for each Domoticz.Configuration(Config) call.

I will check if I'm able to reproduce on a very simple test plugin.

Domoticz V2022.1 (build 14479)
Python 3.10.4
Ubuntu 22.10
User avatar
epierre
Posts: 522
Joined: Wednesday 05 March 2014 13:16
Target OS: Linux
Domoticz version:
Location: France
Contact:

Re: Plugins and Python 3.10

Post by epierre »

for me working since yesterday, updating toward the git !
ImperiHome & MyDomoAtHome on top of:
868.42Mhz - Vera Lite - Fibaro SS-101, S-211, K-101, FWP - Fortress SSA2
433Mhz - Cubie Domoticz + RFXtrx + Oregon || Foscam 9821W
2,4Ghz - Cubie MySensors Gateway + COV + TempHumidity + Pressure + WaterMeter
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest