Timestamp in modbus binding

Hi @ssalonen,
I am using your binding to access my Huawei inverter via modbus TCP.
As it happens that the poller is not able to read data for a while, is there a way to record the timestamp of the last successful data retrieval?
So I would know how old the information displayed is.


Look at channels available in modbus data thing. It has last succesful read channel which is a date time.

Also, if you face troubles with Huawei inverter please read through recent posts here: Reading data from Huawei inverter SUN 2000 (3KTL-10KTL) via modbus TCP and RTU - #118 by splatch
TL;DR some Huawei inverters/SDongle do not like frequent reconnects.

1 Like

Thanks @splatch . That is what I was looking for.

I have several errors with Huawei.
Could you share your working configuration?

I applied your configuration:

UID: modbus:tcp:huawei_1
label: Huawei 1
thingTypeUID: modbus:tcp
  timeBetweenTransactionsMillis: "250"
  connectMaxTries: "-1"
  reconnectAfterMillis: "-1"
  port: "1502"
  timeBetweenReconnectMillis: "10000"
  connectTimeoutMillis: "10000"
  afterConnectionDelayMillis: "2000"  # new parameter available in OH 3.3
  id: "1"
  enableDiscovery: "false"

but I have hundreds of errors still every 10-15 minutes.
Most of them are like this one:

2022-05-24 18:15:14.745 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 1 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=37760, length=7, maxTries=1]). Aborting. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID af7e15a5-92a8-4b64-b187-98f5f34b3bd9]

Do you have any clue?

If you go over SDongle then its probably busy answering other request. Try increasing time between transactions and adjusting polling frequency to something more sensible. 250 ms was lowest I could get, but might be too fast.

Dongle itself must finish processing earlier request before you submit next. If space between requests is to small it can give you troubles. FYI, I see some sporadic errors too, but I just ignore them.