MQTT Connectors disconnect

siclark
Posts: 2356
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: MQTT Connectors disconnect

Post by siclark »

Cheers Joe. This has been impacting me too.


Sent from my iPhone using Tapatalk
User avatar
mundmc
Posts: 1068
Joined: Fri Sep 14, 2012 4:34 pm

Re: MQTT Connectors disconnect

Post by mundmc »

Not all heroes wear capes. Thanks, Joe, this fix the problem I was having too with the local broker.
siclark
Posts: 2356
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: MQTT Connectors disconnect

Post by siclark »

Hi Joe,

I have 3 connector devices running, and I got this error until I set the delay on all 3.

Started plugin "MQTT Connector 2022.1.0"
MQTT Connector MQTT local broker: Starting Device
MQTT Connector Shelly connector: Starting Device
MQTT Connector Shelly NG connector: Starting Device
MQTT Connector Shelly connector: Subscribing to: shellies/# (0)
MQTT Connector Shelly NG connector: Subscribing to: shellies-ng/# (0)
Trigger Shelly Broker
MQTT Connector Error Error in plugin execution GetUiDynamicList:

File "plugin.py", line 844, in getProtocolList
type: name 'err' is not defined

Simon
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: MQTT Connectors disconnect

Post by FlyingDiver »

Huh. Interesting bug there. It's been there since the first release of the Python3 version. Why it started showing up now, and goes away when you add the delay, is the interesting part.

https://github.com/FlyingDiver/Indigo-M ... g/2022.1.1
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
siclark
Posts: 2356
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: MQTT Connectors disconnect

Post by siclark »

Thanks.

Got this error on install, but a reload seems to have cleared it.

Code: Select all

 Stopped plugin MQTT Connector
   Upgrading plugin MQTT Connector to newer version 2022.1.1 (previous version moved to trash)
   Loading plugin "MQTT Connector 2022.1.1" using API v3.0
   Starting plugin "MQTT Connector 2022.1.1" (pid 44258)
   Started plugin "MQTT Connector 2022.1.1"
   MQTT Connector                  MQTT local broker: Starting Device
   MQTT Connector                  Shelly connector: Starting Device
   MQTT Connector                  Shelly NG connector: Starting Device
   MQTT Connector                  Shelly connector: Subscribing to: shellies/# (0)
   MQTT Connector                  Shelly NG connector: Subscribing to: shellies-ng/# (0)
   MQTT Connector Warning          getPluginList: Unable to parse plist, skipping: /Library/Application Support/Perceptive Automation/Indigo 2022.1/Plugins/PingSensor.indigoPlugin/Contents/Info.plist, err = not well-formed (invalid token): line 21, column 61

7 Feb 2023 at 08:16:02
   Reloading plugin "MQTT Connector 2022.1.1" using API v3.0
   Stopping plugin "MQTT Connector 2022.1.1" (pid 44258)
   MQTT Connector                  MQTT local broker: Stopping Device
   MQTT Connector                  MQTT local broker: Disconnecting
   MQTT Connector                  Shelly connector: Stopping Device
   MQTT Connector                  Shelly connector: Disconnecting
   MQTT Connector                  Shelly NG connector: Stopping Device
   MQTT Connector                  Shelly NG connector: Disconnecting
   Stopped plugin "MQTT Connector 2022.1.1"
   Starting plugin "MQTT Connector 2022.1.1" (pid 44328)
   Started plugin "MQTT Connector 2022.1.1"
   MQTT Connector                  MQTT local broker: Starting Device
   MQTT Connector                  Shelly connector: Starting Device
   MQTT Connector                  Shelly NG connector: Starting Device
   MQTT Connector                  Shelly connector: Subscribing to: shellies/# (0)
   MQTT Connector                  Shelly NG connector: Subscribing to: shellies-ng/# (0)

User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: MQTT Connectors disconnect

Post by FlyingDiver »

That's not an error. It's a warning about some other plugin. Not sure why you would only get it sometimes though.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
siclark
Posts: 2356
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: MQTT Connectors disconnect

Post by siclark »

True hadn't seen it was for the ping sensor, but it's listed against MQQT Connector Warning.
Not sure how it got muddled between the 2 plugins.


Sent from my iPhone using Tapatalk
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: MQTT Connectors disconnect

Post by FlyingDiver »

The MQTT Connector plugin reads the plist files for all the other plugins, so it can build a list of devices that can be published. It reports a warning whenever it encounters a plist file that's mis-formatted.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
siclark
Posts: 2356
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: MQTT Connectors disconnect

Post by siclark »

Thank you. That makes sense. Yes not sure why it was just the one time.
User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Re: MQTT Connectors disconnect

Post by berkinet »

Back to the original post in this thread: MQTT Connectors disconnect

Indigo 2022.1.2
MacOS 13.2
Apple Silicon
MQTT Connector v2022.1.1
MQTT Broker plugin v2022.10

I am seeing random Connector disconnects. I have also found the following message in the Log
MQTT Connector Error CM MQTT Connector: Disconnected with result code 1
However, restarting the Broker plugin also throws the same error in the log, but does not seem to actually leave the Connector in a disconnected state.

So far I have just been restarting the plugin to clear the problem. So, other than what I have reported here, I don't have a lot of information.

Ideas on the cause or troubleshooting?

UPDATE: I have added a trigger to catch any MQTT Connector disconnects and restart the plugin and send me a log snippet.
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: MQTT Connectors disconnect

Post by FlyingDiver »

It's possible it's a problem with the Broker plugin. Unfortunately, due to the way that asyncio works, errors in the async code doesn't get reported via the Indigo log. If you think there's an issue there, you should run the plugin in an interactive shell. To do that, you need to check the "Enable debugging menus" in the Plugins panel of the Indigo preferences.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Re: MQTT Connectors disconnect

Post by berkinet »

berkinet wrote:...UPDATE: I have added a trigger to catch any MQTT Connector disconnects and restart the plugin and send me a log snippet.
I have not yet tried running the plugin in debug mode. But, I did find an issue with the trigger I wrote to trap the plugin failure. I could not figure out a specific state to trigger on, so I just chose not equal to "Connected 0" (image below). But, that did not catch a failure. Unfortunately, I absent mindedly restarted the plugin before looking to see what status state it was in -- and it may well have still been "Connected 0" Any ideas on how to trap the problem? And, yes, next time it happens I will printout the device before doing a plugin restart.

Thanks
Attachments
Screenshot 2023-03-04 at 13.38.15.png
Screenshot 2023-03-04 at 13.38.15.png (47.83 KiB) Viewed 2816 times
User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Re: MQTT Connectors disconnect

Post by berkinet »

FlyingDiver wrote:It's possible it's a problem with the Broker plugin. Unfortunately, due to the way that asyncio works, errors in the async code doesn't get reported via the Indigo log. If you think there's an issue there, you should run the plugin in an interactive shell. To do that, you need to check the "Enable debugging menus" in the Plugins panel of the Indigo preferences.
Ok. I have been running the Broker in an interactive shell...

Code: Select all

Starting shell for plugin MQTT Broker.indigoPlugin.
To access the plugin instance use the global named self.

Python 3.10.2 (v3.10.2:a58ebcc701, Jan 13 2022, 14:50:16) [Clang 13.0.0 (clang-1300.0.29.30)]
Connected to Indigo Server v2022.2.0, api v3.2 (localhost:1176)
Started Plugin MQTT Broker v2022.1.0
>>>
But, when the MQTT Connector failed...

Code: Select all

 MQTT Connector Error            CM MQTT Connector: Disconnected with result code 1
  Trigger                         Monitor MQTT Connector
  Reloading plugin "MQTT Connector 2022.1.1" using API v3.0
  Stopping plugin "MQTT Connector 2022.1.1" (pid 4355)
  Email+                          sending email 'MQTT Connector plugin' to '[email protected]' using Google SMTP+
  MQTT Connector                  CM MQTT Connector: Stopping Device
  MQTT Connector                  CM MQTT Connector: Disconnecting
  Stopped plugin "MQTT Connector 2022.1.1"
  Starting plugin "MQTT Connector 2022.1.1" (pid 74487)
  Started plugin "MQTT Connector 2022.1.1"
  MQTT Connector                  CM MQTT Connector: Starting Device
  MQTT Connector                  CM MQTT Connector: Subscribing to: cm/LinkTap_reply/down (0)
  MQTT Connector                  CM MQTT Connector: Subscribing to: cm/LinkTap/up/# (0)
  MQTT Connector                  CM MQTT Connector: Subscribing to: # (0)
  Schedule                        trigger "Monitor MQTT Connector" (delayed action)
Nothing appeared in the interactive shell window.

At least I am now trapping the failure and restarting the plugin. Any other ideas on tracking down the cause of this problem?
User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Re: MQTT Connectors disconnect

Post by berkinet »

I am still seeing this problem on a regular, like every two days or so, but not on any exact schedule. Do you have any more ideas on how I can collect some useful information on what is causing the failure? The only thing I am seeing in the log is the execution of the trigger that is watching for a Connector failure

Code: Select all

MQTT Connector Error            CM MQTT Connector: Disconnected with result code 1
As noted before, running in the interactive shell shows nothing at all.
siclark
Posts: 2356
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: MQTT Connectors disconnect

Post by siclark »

It’s certainly easy using the plug-in broker but I had similar issues and switching to mosquito installed on my server Mac was very simple and I have had none of these connection problems since.
Post Reply

Return to “MQTT”