Is there a way to process with the contents of "debug messages"?

Hey, guys.

Raspberry Pi and Azure IoT Hub are connected via MQTT.
Sometimes the connections are bad and the devices disconnect from each other.
If you get disconnected, restart your browser or "restart the flow" and the connection will be restored.

It is a hassle to do it manually each time.
Is it possible to restart the flow automatically?

In the debug messages, the following error is output.

06/02/2020 9:21:34 node: Azure IoT Hub
msg : string[62]
"Error while trying to send message:Error: client disconnecting"

Is it possible to restart the flow if this message is caught?
Thanks.

On which machine is you MQTT broker?

It could be a problem with it too.

Also - but don't ask me - there is a setting somewhere that sets how long it is to keep trying before it says it can't connect. I think.

Another thing could be to do with the MQTT node.

Open the configure node list (top right-ish) of the browser window.

Look for the MQTT node/s.

Screenshot from 2020-06-25 14-27-09

Though I have 2 showing, really there should only be one.
If you have more than one, that could be causing problems.

Thats what the catch node in your palette is for. It can either catch all errors or just listen to a specific node and will output messages on errors for you to act on:
image
you can also use the status node which outputs messages if the text status that is below some nodes in the editor changes for the selected node. The mqtt node has a disconnected status that you could act on this way.

Johannes

If restarting the browser restores the connection then something very odd is going on as the browser only shows the current state, restarting the browser should have no effect on mqtt connections.

Hi, Trying_to_learn.
That's right. Raspberry Pi is the MQTT broker.

If you can set it in the MQTT node, that seems easier.

Should I use the MQTT node that exists by default instead of the Azure IoT Hub node?

Hi, JGKK.

Doesn't the example node mean that it can't be used with Azure IoT Hub nodes?

I'm sorry I didn't understand.

Hi, Colin.

Is it really?

Close your browser, restart your browser and open Node-RED.

It will reconnect.
Is there something wrong with my environment?

I honestly can't say.

However, I would use the one supplied in Node-Red.

Can you describe please exactly the symptom you are seeing that tells you it is disconnected and what changes when you restart the browser, without touching anything else. Restarting the browser should not change anything on the server except UI related stuff.

I understand.
I would like to try to solve it by using the one provided by Node-RED.

Sorry.
It seems I was wrong.
Communication did not recover even after restarting the browser.
There was no recovery other than restarting the flow.

@yossy4,

I don't seem to remember you answering my question I asked a long time back:

Open the configure node list (top right-ish) of the browser window.

Look for the MQTT node/s.

Screenshot from 2020-06-25 14-27-09

How many MQTT nodes do you have and do they have only one host listed?

Are you using https://flows.nodered.org/node/node-red-contrib-azureiothubnode?

Unfortunately there does not seem to be a github (or any other) repository linked so I don't know how you can feed the question to the node's authors or submit an issue against it.

If you want to force a restart when that message appears then if you put a Switch node on the output of the azure node you can detect the specific message using the payload Contains test, then use that to trigger a restart.

How did you install node-red on the Pi? It might be worth restarting node red in a terminal using
node-red-stop && node-red-start
trigger the error, if you can make it fail, and then copy/paste the complete log output here. That will tell us what versions of all the tools you are using and may give further information about the error.
When pasting the log click the </> button and paste it in there, that will stop the forum interpreting the log as markdown text.

I'm sorry I forgot to confirm.
MQTT only exists in captured state, is that okay?c

Yeah, I think that is ok.

The only thing that worries me is HOW you have that node set up.

Open an MQTT node (eg)

Screenshot from 2020-06-29 12-32-49

More importantly the second picture.

What is yours showing?

Actually, you can just double click on the node you showed me in the picture. Sorry. My bad.

I tried to find the same screen.
The only difference is if there are checks to support legacy versions.

I think there may be a problem.

You have IOT devices talking to your MQTT.

I may be wrong, but I think IP addresses are needed before that can work.

I never thought.
Let's try the operation by specifying the IP address.

Hi, @Trying_to_learn.

It was a disappointing result.
I entered the IP address but got the same error.

Which IP address?
(How did you get/find/determine the IP address to enter?)

Did you reboot the computer?
(I say that because I don't know the other tricks that could be done)