Node-red-contrib-modbus stop execution in case of connection issue

Hello All,

I have to implement a flow where if node-red-copntrib-modbus cannot connect to a MOXA device, then I need to interrupt the flow execution and send back a http failure result.
So far, I couldn't reach the point, in case if I am setting an invalid IP, which of course unreachable, the nodes stuck in initialize state forever, and the catch node didn't log anything in my test flow.


Is it possible to setup this scenario with node-red-contrib-modbus?

Thank you!

Rp

The status node can be used to "watch" the status of the flex-getter nodes.

Hello Steve,

Thank you for your answer, I tried to set it up, probably I missed something, but it doesn't seem so reliable:


As you can see, it's in initialize state, but on the debug window you can see the status is green. Based on the debug logs, even if I can see yellow and initialize on the screen, and it's not changing, the last status reported by the status node is always green. I guess in one point of time it will change, and maybe then it will follow the actual state, but till that it's not works properly.
Did you also experienced this issue, or I set something incorrectly?
Is there any more advanced way to handle it?

Thanks,

Rp

The status node may not pick up the first status following a restart (or if the modbus node is re-deployed). Could that be the situation here?

Hello @Newmann

A more reliable way of catching errors with the Modbus nodes (instead of using Status or Catch nodes)
is by enabling the option "Empty msg on Modbus Fail" on the Modbus Flex Getter.

image

In case of a failure this will produce a msg with a property error and empty payload
that you can then look for and handle appropriately.

image

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.