[SOLVED] Many(+100) modbus pollers, is it slowing down the binding?

In the doc’s there is written:

Modbus binding by default is not updating the item and channel state every time new data is polled from a slave, for performance reasons. Instead, the state is updated whenever it differs from previously updated state

Which means that without the parameter it should update only on change? Is this a error in the doc’s? Or do I misinterpret this? Should I try to not use the parameter ’ updateUnchangedValuesEveryMillis’ and see what is happen?

I browsed through the source code of both version:

The difference looks like is in ModbusDataThingHandler.java - whenExpired

The version PR4701 which is working:

        if (lastUpdatedMillis > 0L && lastState != null && this.updateUnchangedValuesEveryMillis > 0L && millisSinceLastUpdate <= this.updateUnchangedValuesEveryMillis) {
            if (lastState.equals(state)) {
                return;
            }
        }

in the snapshot which is not working:

        if (lastUpdatedMillis <= 0L || lastState == null || this.updateUnchangedValuesEveryMillis <= 0L || millisSinceLastUpdate > this.updateUnchangedValuesEveryMillis || !lastState.equals(state)) {
            action.accept(uid, state);
        }

Maybe this will help?

Thank you @HomeAutomation for your persistence. I think you now have the correct binding installed.

The code looks a bit different actually in PR 4701.

Anyway, there is indeed an issue - I made a sloppy modification based on code review comment from a maintainer, which lead to situation that “time of last update” was not kept up-to-date.

Will introduce fix for this. UPDATE: PR introduced for the fix: https://github.com/openhab/openhab2-addons/pull/4802

If the PR is inside of the new snapshot please tell me, then I can test again.

Another remark:
I made an SHA256 compare of:

.kar-file from https://ci.openhab.org/job/openHAB-Distribution/ and extract .jar-file from the subfolder repository/org/openhab .

and

https://ci.openhab.org/job/openHAB2-Bundles/org.openhab.binding$org.openhab.binding.modbus/

Both are the same version. One is inside the .kar file one is the single file if just this one is needed.

1 Like

Thanks @HomeAutomation for the help – I will post when I have something to test.

Please note that openHAB-distribution seems more recent than openHAB2-Bundles. In fact, openHAB2-Bundles is currently disabled, that is it’s not building anything new.

Perhaps something you want to raise in the FAQ thread and ask? :slight_smile:

@HomeAutomation the fix was just merged but the build system is having issues, I am not sure if there is new snapshot available yet…

Last build snapshot is from 2019-01-30. I will wait until they fixed this issue.

1 Like

I made a test with snapshot 1519. My first basic tests show that now it is fully working.

Great job.

1 Like