Modbus RTU openHAB binding Error

As per your suggestion, I had re-configure configuration, However my configuration is still faulty.
I am trying to read after many attempt it able to read after than it is again fail to read.
Note: I am using single function.

.Items

Switch ACONOFFSTAT "AC" (ALL) {modbus="onoffcmdstat:0"}

sitemaps
sitemap demo label=“HOME”
{
Frame label=“Home” {
Switch item=ACONOFFSTAT
}
}

Openhab.cfg

Air Conditioner Stat AC-1

modbus:serial.onoffcmdstat.connection=COM4:19200:8:even:1:rtu:500:3000:none:none
modbus:serial.onoffcmdstat.id=1
modbus:serial.onoffcmdstat.type=discrete
modbus:serial.onoffcmdstat.start=0
modbus:serial.onoffcmdstat.length=2

Full Logs files
https://pastebin.com/1cgtSt3M

Communication Reconfirmation



Thanks for this. This test confirms that the errors remain even with slow/seldom queries.

If I understand correctly, the read works successfully with “Modbus poll” application?

Best,
Sami

Dear Sami,

Yes, I am able to read data using Radzio Modbus & Modbus Poll modbus master simulator.
their communication’s configuration parameter also i had posted in forum.

Regards

Hitesh Patel

Thanks

This might be a bit far fetched but still worth a try. You have flow control defined in the windows software. Should you define it in the binding as well?

Could you try with different flow control settings? I am sorry but not too familiar what the alternatives actually mean in practice and what would correspond to the windows application…

Best
Sami

Maybe it is not that far fetched. hitesh.patel didn’t mention what kind of RS485 converter is used. Nowadays one would use something like an ftdi chip (ft232 or similiar) + RS485 transceiver. The transmit enable signal for the RS485 transceiver is automatically generated by the ftdi chip and there is no need to take care of that in software. BUT some rather simple RS232 to RS485 converters just use the RTS line of the RS232 interface as a transmit enable signal for the RS485 transceiver. In that case you need to enable that in the software you are using - just like it’s done in the screenshot…

I don’t have any datasheet to share but i am using USB to Rs485 converter same as above.

I haven’t done any flow control in both software. It is default software’s configuration. If it necessary to configure, I will configure it and respond back.

How ever my understating of configuration require is as follows

modbus:serial.onoffcmdstat.connection=COM4:19200:8:even:1:rtu:500:3000:rts/cts in:rts/cts out

please confirm opernHAB configuration.

With this kind of adaptor you don’t need that anyway.

This should do the trick.

Dear mbs38,

Output is same even, after setting flow controls

modbus:serial.onoffcmdstat.connection=COM4:19200:8:even:1:rtu:500:3000:rts/cts in:rts/cts out
modbus:serial.onoffcmdstat.id=1
modbus:serial.onoffcmdstat.type=discrete
modbus:serial.onoffcmdstat.start=0
modbus:serial.onoffcmdstat.length=2

Please check error logs logs

Regards

Hitesh Patel

You don’t need flow control.

Just this: modbus:serial.onoffcmdstat.connection=COM4:19200:8:even:1:rtu:500:3000

But, Sami had suggested so I configure it with flow control. I check with/without but result are same.

Interesting. I’ve got a strange feeling: has anyone ever tested the binding with even parity? I haven’t.

here’s an example

1 Like

Thx.

Any other ideas?

@hitesh.patel can you sniff the bus with another adaptor? It would be interesting to find out whether the requests actually appear on the line.

Working some suggests you don’t have anything fundamental wrong. Are you really sure you are using twisted pair for RS485 bus, really sure it is terminated properly?

He was able to poll data from the device with modpoll and radzio modbus master so hardware is probably not an issue here.

He is reportedly able to poll data with OH as well, albeit with some communication errors. It’s something marginal - timing or line quality. Crappy wiring really does show up in this kind of way.

Sami will tell us, but I don’t think the binding currently reports CRC errors, which could be helpful in this situation.

EDIT - thinking on it, in this case noisy data incoming would be more likely to give parity errors at the serial level.
Outgoing noisy data would return a NACK or simply nothing/timeout, depending what the slave feels like. A NACK could itself get garbled of course,

Actually, the CRC errors are reported in a different way, e.g. Modbus RTU Drexel & Weiss <> openHAB

The EOF exception in this thread means that the message could not be read fully, and the underlying serial library reported end-of-stream. Thus, the binding does not even check the CRC in this case…

How often does the read fail, and how often does it succeed?

Sami

Interesting note on the parity errors. I wonder if those could explain the EOF, why bother reading rest of the bytes if there is a parity error…

It looks like I might be able to log out parity errors, perhaps that could be good indication of serial line quality…

Best
Sami

That might well be very useful sometimes. i expect Windows and *nix environments might behave differently here.

Of course, many other serial users won’t use parity, but then we would get CRC errors.

Thanks for input
However, I have only one USB-Rs485 converter.