Sync Modbus Polling Nodes

#1

Hi there,

Is there a way to sync the polling of modbus nodes so when the data is stored in the columns they stay the same for each poll?

Can you assign them by each the payload for each individual msg.topic?

0 Likes

#2

Trying to manage the timing of a polling loop does not sounds like a very robust (or fun to maintain) solution. Instead, have each modbus node pass along its data with a different topic, and use an aggregator node to assemble the pieces into a single object (if you need them together) – you can try a join node in manual mode, look for a contrib node, or even write your own inside a function node. It really just depends upon your requirements.

Another technique is to have separate flows for polling the data, which all push the data into a common place (database, mqtt, context, etc). Then whenever the data is required for display or processing, just pull the values you need from that common area. This way, updates can come into the system at any rate or time, and the data is always the latest when you need to use it.

If you choose to push each piece of data to an MQTT broker, and you set it up to retain messages, the latest values will even persist over a node-red restart. Each time the system is started, it reconnects to the broker and receives the latest value for each topic. Good luck.

0 Likes