mikakaraila / node-red-contrib-opcua

A Node-RED node to communicate OPC UA. Uses node-opcua library.
Other
208 stars 191 forks source link

Handle Errors / no status #669

Closed Test012345678949 closed 2 months ago

Test012345678949 commented 4 months ago

Hi,

maybe I can't see the solution but how can I handle if there are no items in the opcua client for multiple reading:

grafik

The Error which is thrown is not catchable I think and no bedug messages is sent and the status isn't changed too.

If the error is catchable or the status will change to "Error Nr 123" I can handle an injections of items and the flow would be fail save or am I on the wrong way ??

Greetings

mikakaraila commented 4 months ago

Hmm, latest client node has two output. Second one is for the errors. Test again with the latest version, please.

Test012345678949 commented 4 months ago

Thx for your immediate reply.

Youre right the latest version has 2 outputs, but the "No Items Error" doesn't start a message either:

grafik

Test012345678949 commented 4 months ago

Ok,

I looked at the source: in Line 1507 of 102-opcuaclient.js the problem is handled:

        if (multipleItems.length === 0) {
          node_error(node.name + " no items to read");
          return;

If there is a

    if (multipleItems.length === 0) {
      node_error(node.name + " no items to read");
      set_node_status_to("No items to read");
      return;

Then it could be handled by the "status" node

I think it should be a design question: Make unhandeled erros --> Errors on the second output and kill all "node_errors" in the code which are "normal errors" or bring the errors to the node "status" and make them catchable by the status node

mikakaraila commented 4 months ago

Ack, I will fix this to next release and check other places at the same time.

Just one extra comment: if you clear items then you should not try to read anything as there is no items to read...

At least same with write multiple items.

Test012345678949 commented 4 months ago

Thx.

Yes normally I would say "That's right", but in the flow "programming" I have two or three times seen, that the OPCUA has no item's without been cleared. I think this is from partially restarting the flow.

To solve this issue permanent, my idea was: If no items are there --> add them and start the reading some seconds later.

Therefore the message "No items" has to be readable by the flow.

Or am I wrong ??

mikakaraila commented 4 months ago

OK, this clarifies problem for me. I will be travelling this week. So most probably I will have time next week to fix & test this.

Test012345678949 commented 4 months ago

No problem.... You make great work and it runs stable and flawless.

I'm really happy for your short time reaction and therefore it is no problem waiting 1 week.

mikakaraila commented 4 months ago

I found some other similar cases and fixed other set status cases.

I will do some testing before publishing new version...

Test012345678949 commented 2 months ago

Hi, Do you know, when a new version will be published ???

mikakaraila commented 2 months ago

Thanks to remind me. Have been busy and bit sick.

Test012345678949 commented 2 months ago

Thx for the direct reply.

Get well soon, and I hope your not too sick ?? My children often bring some strange things home.

mikakaraila commented 2 months ago

I just made & published new version. Not fully tested, so I will fix if there is something...

Test012345678949 commented 2 months ago

It runs good.

If status = no items to read --> add items --> start 5 s later new read.

I think there will be no bug within deploying and getting the itemlist cleared, cause then it automatically add the items after the error occurs

Thx

mikakaraila commented 2 months ago

I will close this now...