Generate modbus flex sequence

I have a few registers to read using modbus flex:
To avoid modbus congestion,can anyone help me generate a sequence of registers/quantity to have as little queries as possible ?

For example :
numbers = [10,11,12,18,500,501,505]

should generate only 2 queries :
address 10 quantity 9
address 500 quantity 6

Are you asking for a general algorithm that will work with a random set of registers? If so that is more of a maths question than node red I think.

Yes. Exactly.

If the difference between the registers is higher than say 20, generate different a request. Otherwise combine them all in one read.

I tried a few things, didn't succeed just yet, hence the post here.

For now I make the all requests manually, and filter the output with the registers I need.

nevermind.figured it out :slight_smile:

Is it general enough to share ? Others may find it useful.

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