Serial units on bus


I am working with several (20) virtual com ports. Each port has a few (2 to 6) units which give sensor info every second.

So from every unit I am getting info like:


I somehow want to notice when I 'loose' a unit on the serial line.

Currently I have two options:

Count the amount of messages per second, if it drops below the set amount give an alert.
With this i have some timing issues. Since the units are not synced from time to time i get false positives.

Otheroption is to write all info to a DB, read the last update time and if it is more then 'x' seconds give an alert but this is quiet a lot of work for a simple check

Does anyone have nodes / flows that do something similar?

If what you need to do is to trigger an action when there is a gap in incoming messages on one of the units, you can do that with a Trigger node set to send Nothing then wait for a timeout and then send the error signal. Set the Trigger node to Extend delay if new message arrives. The result will be that the node sends nothing provided the messages keep coming in, but if there is a gap longer than the timeout then it will send a message.

Sounds easy enough. To make my flow more simple (20x4 = 100 nodes to add) is there a way to set the trigger not on a msg.topic basis? So if the topic is HUM01 / HUM02 etc. It will act as a trigger for each topic separately?

From the help text for the Trigger node:
Optionally, the node can be configured to treat messages as if they are separate streams, using a msg property to identify each stream. Default msg.topic .

Possibly that is new in Node Red 2.x, I am not sure. If you don't see the "Handling" field in the node and you are not on node red 2 then you could upgrade.

1 Like

Great, thanks!!!

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