Modbus RTU Drexel & Weiss <> openHAB

That is OH Modbus binding attempting to write registers 5016 and 5017 (hex 1398,1399) consecutively, using FC16.
The D&W slave doesn’t like it.

and that’s nothing we could fix with more infos from d&w?
the seller has good connection to the manufacturer… :neutral_face:

The problem is only partly with D&W.

Modbus specification happily allows writing of individual registers. Modbus spec knows nothing about 32-bit paired registers. It’s just a way of interpreting two lumps transported over Modbus, which only knows 16-bit registers…
So in theory any writable register should be writable individually.

In practice however, many real world Modbus devices do pair up standard registers to be handled as 32-bit units, a de facto addition to the spec.
Clearly it would be a Bad Thing to write half ofsuch a unit at a time.
Modbus spec does allow to write several registers at a time - so it is a reasonable design decision by D&W to insist that happens and so avoid the two halves of your 32-bit unit getting out of step.

You could argue that D&W should strictly adhere to Modbus spec, but there is a good technical reason why they do not.
They are not alone - hardly any real world Modbus devices do implement the spec exactly, there is a lot of variation. For any example, a lot of devices will NOT accept the multi-write we want here.

The real solution here (and probably in other situations as well) would be to have the OH binding write 32-bit units (which OH does know about from your config) in multi-register write mode in one operation.

I’ve opened an enhancement request on your behalf, as your heating system is unusable with OH

But any effort put into that might be better spent developing a real OH2 version Modbus binding. That would I guess be a way off though. How desperate are you?. Which would you prioritise?

I’m not desperate, but it would be reeeaally nice being able to also write to the device.
i think putting effort in a OH2-Binding would be better for the OH community so that’s what i’d prioritise. but since i’m only a user (and at that not very good as this thread shows) i don’t think that i’m in a position to prioritise anything :slight_smile:

for now: what can i do to remove this error:

2017-05-13 12:42:49.334 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 03 13 98 00 02 41 60
2017-05-13 12:42:49.336 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: Error reading response (EOF)
2017-05-13 12:42:49.338 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@27f2f8 (unit id 1 & transaction 2180). Serial parameters: SerialParameters@1b0c9aa[portName=/dev/ttyAMA0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]

altough i get my item values, my openhab log is full of these messages :frowning:

Don’t know what your modbus.cfg has ended up like, but many slaves like a rest between successive reads.
Use the interTransactionDelayMillis optional Advanced addition to (all) your serial parameters to set a gap of 150 or so.
http://docs.openhab.org/addons/bindings/modbus1/readme.html#advanced-connection-parameters

these are my connection parameters

serial.info1.connection=/dev/ttyAMA0:9600:8:none:1:rtu
serial.slave1.connection=/dev/ttyAMA0:9600:8:none:1:rtu
serial.slave2.connection=/dev/ttyAMA0:9600:8:none:1:rtu
serial.slave3.connection=/dev/ttyAMA0:9600:8:none:1:rtu

and if i change it to

serial.info1.connection=/dev/ttyAMA0:9600:8:none:1:rtu:150
serial.slave1.connection=/dev/ttyAMA0:9600:8:none:1:rtu:150
serial.slave2.connection=/dev/ttyAMA0:9600:8:none:1:rtu:150
serial.slave3.connection=/dev/ttyAMA0:9600:8:none:1:rtu:150

i get this error:

2017-05-14 19:33:12.311 [ERROR] [inding.modbus.internal.ModbusBinding] - Exception when parsing configuration parameter serial.info1.id =   --  java.lang.NumberFormatException For input string: ""
2017-05-14 19:33:12.318 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedService, org.osgi.service.event.EventHandler, id=311, bundle=201/mvn:org.openhab.binding/org.openhab.binding.modbus/1.9.0]: Updating property serial.info1.id of configuration org.openhab.modbus caused a problem: Exception when parsing configuration parameter serial.info1.id =   --  java.lang.NumberFormatException For input string: ""
org.osgi.service.cm.ConfigurationException: serial.info1.id : Exception when parsing configuration parameter serial.info1.id =   --  java.lang.NumberFormatException For input string: ""
        at org.openhab.binding.modbus.internal.ModbusBinding.updated(ModbusBinding.java:627)[201:org.openhab.binding.modbus:1.9.0]
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1772)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)[3:org.apache.felix.configadmin:1.8.12]
        at java.lang.Thread.run(Thread.java:748)[:1.8.0_131]

Hi,

based on error message

Exception when parsing configuration parameter serial.info1.id = – java.lang.NumberFormatException For input string: “”

you have fault with seriol.info.1.id=... line…

Best,
Sami

That part of the error message looks very suspicious, Modbus ids are limited to 0-247 or so

UPDATE: after clearing the modbus conf (via karaf) AND reboot i’m back with the “old error”.
time to go to bed, i’ll try again the next days…

original post:
now i changed it back to the original setup and have a new error…

2017-05-14 22:28:27.644 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/3 error: open port failed: Modbus Serial Master. Connection SerialConnection@cc4821[portName=/dev/ttyAMA0,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@1ed0df6[portName=/dev/ttyAMA0]
2017-05-14 22:28:44.902 [WARN ] [g.dispatch.internal.ConfigDispatcher] - Could not parse line 's'

what is line s?!

on this line i added only “:150” at the end and nothing else.

serial.info.1.id=

ah, modbus is the strangest binding…

Okeydoke, take another look at the documentation with a view that you only have to add the interTransactionDelayMillis to the lines with connection
Those are the lines that specify the serial connection parameters

i did just that, didn’t touch the other lines. just like i mentioned in the post above…
strangest things happen here. i’ll be in touch as soon as i have some spare time :slight_smile:

Yeah, I’m sorry you are suffering from this openHAB2 issue (cached configuration).

To workaround the bug, you should always clear the cache after changing configuration, steps are here: https://github.com/openhab/openhab1-addons/issues/5084#issuecomment-279293325 . I guess you figured this our already…

open port failed: Modbus Serial Master

It seems that you are using nonstandard serial port. See tips on serial binding docs for the help how make opehab work with ttyAMA0. With openHAB2, you can edit the openHAB java options using /etc/default/openhab2 file, and adding the following (or editing the existing EXTRA_JAVA_OPTS line)

EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0"

Best,
Sami

just got home and did this:
add “:150” again to the conn. parameters.
delete cache via karaf
reboot

…and: ta-daaaa. no more error and values are coming!
yesterday i did the same except for the reboot…

anything new here?
have there been changes, so i could also write values?

cheers

Hi @narf27!

If you check the github issue opened by @rossko57 you can see it’s still open. This means that writing 32bit values with single modbus request is not possible using the binding.

However, I invite you to try out the new binding for openHAB2:

The new version supports 32bit writes out of the box, among other things.

Best,
Sami

i probably should deactivate the 1.x addon before, right?
could i count on your support with my config? (as this thread shows perfectly i’m an absolute beginner!)

Peter

Sure, just put the questions to the new binding thread.

Best
Sami

Hello Peter

I have also a Drexel & Weiss machine. I recently bought the modbus adapter and I am struggling to intrgrate it to my software, not openhab. Could you share with me the config of your modbus for the RBG and for your software?

Tx

Antoine

hey there! i’m probably late - very late…
setup on drexel weiss was not done by me, if you tell me which settings you need i’d be happy to help you out.
setup of “my software”? not sure what you mean. i bought a “Serial Pi Plus” and configured it with openhabian on my pi. the rest is done in openHAB

This might help some of you: https://community.openhab.org/t/drexel-weiss-device-integration/94604