Modbus update of items make poller go offline, item cache?

Took some time to look into the modbus item caching but it still makes my mind go in circles. Hope you guys can help.

I have a SMA Tripower solar inverter which I connect to in OpenHAB via Modbus TCP, all is fine after a reboot. all items do their thing in the right way. But after I edit the things file to change the poll interval for instance a couple of items stop working. Some poll items stop completely other items inside one poll item stop updating.

Also if I connect to a LAN IOT RS485 to a modbus slave I have the same issue. Items going offline. It is working fine at first, after a change in the item file the poller or the items goes offline.

After some searching I discovered items cache which could be an issue. Not sure how it works and why this only happens on my modbus items

I have a snapshot of today where I changed the refresh time from 15000 to 10000. There is a flat line on some items after the change of the file.

SMA things file

Bridge modbus:tcp:endpointSMA [ host="", port=502, id=3 ] {

	Bridge poller SMA_Yield [ start=30531, length=2, refresh=10000, type="input" ] {
		Thing data SMA_Yield [ readStart="30531", readValueType="uint32"]

	Bridge poller SMA_DC1 [ start=30769, length=6, refresh=10000, type="input" ] {
		Thing data SMA_DC_A_1 [ readStart="30769", readValueType="int32", readTransform="JS(divide1000.js)"]
		Thing data SMA_DC_V_1 [ readStart="30771", readValueType="int32", readTransform="JS(divide100.js)"]
		Thing data SMA_DC_P_1 [ readStart="30773", readValueType="int32", readTransform="JS(normalize.js)"]
	Bridge poller SMA_DC2 [ start=30957, length=6, refresh=10000, type="input" ] {
		Thing data SMA_DC_A_2 [ readStart="30957", readValueType="int32", readTransform="JS(divide1000.js)"]
		Thing data SMA_DC_V_2 [ readStart="30959", readValueType="int32", readTransform="JS(divide100.js)"]
		Thing data SMA_DC_P_2 [ readStart="30961", readValueType="int32", readTransform="JS(normalize.js)"]

	Bridge poller SMA_ACV [ start=30783, length=6, refresh=10000, type="input" ] {
		Thing data SMA_AC_V_L1 [ readStart="30783", readValueType="uint32", readTransform="JS(divide100.js)"]
		Thing data SMA_AC_V_L2 [ readStart="30785", readValueType="uint32", readTransform="JS(divide100.js)"]
		Thing data SMA_AC_V_L3 [ readStart="30787", readValueType="uint32", readTransform="JS(divide100.js)"]

	Bridge poller SMA_ACAMPERE [ start=30977, length=6, refresh=10000, type="input" ] {
		Thing data SMA_AC_A_L1 [ readStart="30977", readValueType="int32", readTransform="JS(divide1000.js)"]
		Thing data SMA_AC_A_L2 [ readStart="30979", readValueType="int32", readTransform="JS(divide1000.js)"]
		Thing data SMA_AC_A_L3 [ readStart="30981", readValueType="int32", readTransform="JS(divide1000.js)"]
	Bridge poller SMA_Power [ start=30775, length=2, refresh=10000, type="input" ] {
		Thing data SMA_Power [ readStart="30775", readValueType="int32", readTransform="JS(normalize.js)"]
	Bridge poller SMA_Temperature [ start=30953, length=2, refresh=10000, type="input" ] {
		Thing data SMA_Temperature [ readStart="30953", readValueType="int32", readTransform="JS(divide10.js)"]


Errors in the log file

2019-04-10 13:57:51.806 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'SMA_ModBus.things'

2019-04-10 13:57:52.244 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Unregistering regular poll task BasicPollTaskImpl@1f5cd31[request=ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@1a96b4f[slaveId=3,functionCode=READ_INPUT_REGISTERS,start=30783,length=6,maxTries=3],endpoint=ModbusTCPSlaveEndpoint@1a0e45a[address=,port=502],callback=org.openhab.binding.modbus.internal.handler.ModbusPollerThingHandlerImpl$ReadCallbackDelegator@1f7ccc78] (interrupting if necessary)

2019-04-10 13:57:52.248 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Poll task BasicPollTaskImpl@1f5cd31[request=ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@1a96b4f[slaveId=3,functionCode=READ_INPUT_REGISTERS,start=30783,length=6,maxTries=3],endpoint=ModbusTCPSlaveEndpoint@1a0e45a[address=,port=502],callback=org.openhab.binding.modbus.internal.handler.ModbusPollerThingHandlerImpl$ReadCallbackDelegator@1f7ccc78] canceled

==> /var/log/openhab2/events.log <==

2019-04-10 13:57:52.257 [hingStatusInfoChangedEvent] - 'modbus:poller:endpointSMA:SMA_ACV' changed from ONLINE to OFFLINE

2019-04-10 13:57:52.265 [hingStatusInfoChangedEvent] - 'modbus:data:endpointSMA:SMA_ACV:SMA_AC_V_L1' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)

2019-04-10 13:57:52.273 [hingStatusInfoChangedEvent] - 'modbus:data:endpointSMA:SMA_ACV:SMA_AC_V_L3' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)

2019-04-10 13:57:52.278 [me.event.ThingUpdatedEvent] - Thing 'modbus:poller:endpointSMA:SMA_ACV' has been updated.

==> /var/log/openhab2/openhab.log <==

2019-04-10 13:57:52.281 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Unregistering regular poll task BasicPollTaskImpl@1fbbdb2[request=ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@13c44fd[slaveId=3,functionCode=READ_INPUT_REGISTERS,start=30977,length=6,maxTries=3],endpoint=ModbusTCPSlaveEndpoint@1a0e45a[address=,port=502],callback=org.openhab.binding.modbus.internal.handler.ModbusPollerThingHandlerImpl$ReadCallbackDelegator@70dafaea] (interrupting if necessary)

==> /var/log/openhab2/events.log <==

2019-04-10 13:57:52.282 [hingStatusInfoChangedEvent] - 'modbus:data:endpointSMA:SMA_ACV:SMA_AC_V_L2' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)

==> /var/log/openhab2/openhab.log <==

2019-04-10 13:57:52.286 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Poll task BasicPollTaskImpl@1fbbdb2[request=ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@13c44fd[slaveId=3,functionCode=READ_INPUT_REGISTERS,start=30977,length=6,maxTries=3],endpoint=ModbusTCPSlaveEndpoint@1a0e45a[address=,port=502],callback=org.openhab.binding.modbus.internal.handler.ModbusPollerThingHandlerImpl$ReadCallbackDelegator@70dafaea] canceled

==> /var/log/openhab2/events.log <==

2019-04-10 13:57:52.294 [hingStatusInfoChangedEvent] - 'modbus:poller:endpointSMA:SMA_ACAMPERE' changed from ONLINE to OFFLINE

2019-04-10 13:57:52.300 [hingStatusInfoChangedEvent] - 'modbus:data:endpointSMA:SMA_ACAMPERE:SMA_AC_A_L1' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)

2019-04-10 13:57:52.304 [hingStatusInfoChangedEvent] - 'modbus:data:endpointSMA:SMA_ACAMPERE:SMA_AC_A_L2' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)

2019-04-10 13:57:52.307 [hingStatusInfoChangedEvent] - 'modbus:data:endpointSMA:SMA_ACAMPERE:SMA_AC_A_L3' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)

2019-04-10 13:57:52.310 [me.event.ThingUpdatedEvent] - Thing 'modbus:poller:endpointSMA:SMA_ACAMPERE' has been updated.

Is there any news about this topic? Did you fix the problem?

It is an observed behaviour of Modbus binding. When it starts up, it reads your Thing config and schedules a bunch of poller jobs. If you later come along and edit Things, it gets messy… Always restart the binding after editing Things.

Thanks for this report. I created in github to track this issue.

Fix proposal in . I appreciate if you can confirm this fixes the issue.

Here’s a jar with the fix: