Modbus RTU Drexel & Weiss <> openHAB

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: [Modbus] Requests to removed (from config) units · Issue #5084 · openhab/openhab1-addons · GitHub . 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