Modbus RTU Drexel & Weiss <> openHAB

You mean ethernet?
How is the Pi powered - you have added a new device load (serial port).
Where is the Pi located, not in amongst electrical noisy heating switching cabling.
Is it better if you disconnect the serial cable to the heating - there may be some earth loop via the ground wire.

removing modbus.cfg was all i did to get the pi working as usual
i really missed the equal signs :blush:
now there are different errors and warnings…

2017-03-29 20:50:39.949 [WARN ] [.binding.modbus.internal.ModbusSlave] - ModbusSlave (slave1): Error getting a new connection for endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1]. Error was: Unable to validate object 2017-03-29 20:50:39.950 [WARN ] [.binding.modbus.internal.ModbusSlave] - ModbusSlave (slave1) not connected -- aborting read request net.wimpi.modbus.msg.ReadInputRegistersRequest@9dd0ca. Endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1] 2017-03-29 20:50:40.152 [ERROR] [et.wimpi.modbus.net.SerialConnection] - Could not get port identifier, maybe insufficient permissions. null 2017-03-29 20:50:40.154 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/3 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@18aa26d[portName=/dev/tty1,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1] 2017-03-29 20:50:40.190 [ERROR] [et.wimpi.modbus.net.SerialConnection] - Could not get port identifier, maybe insufficient permissions. null 2017-03-29 20:50:40.191 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 2/3 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@18aa26d[portName=/dev/tty1,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1] 2017-03-29 20:50:40.228 [ERROR] [et.wimpi.modbus.net.SerialConnection] - Could not get port identifier, maybe insufficient permissions. null 2017-03-29 20:50:40.229 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 3/3 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@18aa26d[portName=/dev/tty1,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1] 2017-03-29 20:50:40.230 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - re-connect reached max tries 3, throwing last error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@18aa26d[portName=/dev/tty1,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1] 2017-03-29 20:50:40.231 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - Error connecting connection SerialConnection@18aa26d[portName=/dev/tty1,port=<null>] for endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1]: Could not get port identifier, maybe insufficient permissions. null 2017-03-29 20:50:40.232 [WARN ] [.binding.modbus.internal.ModbusSlave] - ModbusSlave (slave1): Error getting a new connection for endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1]. Error was: Unable to validate object 2017-03-29 20:50:40.233 [WARN ] [.binding.modbus.internal.ModbusSlave] - ModbusSlave (slave1) not connected -- aborting read request net.wimpi.modbus.msg.ReadInputRegistersRequest@17bbfef. Endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1] 2017-03-29 20:50:40.435 [ERROR] [et.wimpi.modbus.net.SerialConnection] - Could not get port identifier, maybe insufficient permissions. null 2017-03-29 20:50:40.435 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/3 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@1892005[portName=/dev/tty1,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1] 2017-03-29 20:50:40.471 [ERROR] [et.wimpi.modbus.net.SerialConnection] - Could not get port identifier, maybe insufficient permissions. null 2017-03-29 20:50:40.472 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 2/3 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@1892005[portName=/dev/tty1,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1] 2017-03-29 20:50:40.509 [ERROR] [et.wimpi.modbus.net.SerialConnection] - Could not get port identifier, maybe insufficient permissions. null 2017-03-29 20:50:40.510 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 3/3 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@1892005[portName=/dev/tty1,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1] 2017-03-29 20:50:40.510 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - re-connect reached max tries 3, throwing last error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@1892005[portName=/dev/tty1,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1] 2017-03-29 20:50:40.511 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - Error connecting connection SerialConnection@1892005[portName=/dev/tty1,port=<null>] for endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1]: Could not get port identifier, maybe insufficient permissions. null 2017-03-29 20:50:40.512 [WARN ] [.binding.modbus.internal.ModbusSlave] - ModbusSlave (slave1): Error getting a new connection for endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1]. Error was: Unable to validate object 2017-03-29 20:50:40.512 [WARN ] [.binding.modbus.internal.ModbusSlave] - ModbusSlave (slave1) not connected -- aborting read request net.wimpi.modbus.msg.ReadInputRegistersRequest@1a4a17e. Endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1] 2017-03-29 20:50:40.714 [ERROR] [et.wimpi.modbus.net.SerialConnection] - Could not get port identifier, maybe insufficient permissions. null 2017-03-29 20:50:40.714 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/3 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@195ee2d[portName=/dev/tty1,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@11b2f2e[portName=/dev/tty1]
yay

I’m pretty sure i’m having a problem with the serial device…
this is what i get after a clean jessie install and following http://spellfoundry.com/2016/05/29/configuring-gpio-serial-port-raspbian-jessie-including-pi-3/#Using_the_serial_port_with_other_hardware

pi@raspberrypi:~ $ ls -l /dev lrwxrwxrwx 1 root root 7 Mar 29 18:29 serial0 -> ttyAMA0 lrwxrwxrwx 1 root root 5 Mar 29 18:29 serial1 -> ttyS0

but with my openHABian image there’s no serial …

Might be permissions issue, i have no idea about unix, you need someone else’s help.
There are quite a few threads touching on this here if you search.

OpenHAB2 seems to have an unpleasant habit of caching config, ‘removing’ things does not remove them.

posted my problem in openHABian related threat. i hope to resolve this issue and be back soon!
thank you very much in the meantime!

Mind you, your config asks for tty1 and you don’t have one … ttyS0 ?

1 Like

sadly there’s no tty* :frowning:

i think i got it working =)
(not with my operating installation but with a clean raspian jessie and manual install openHABian)

I’m going to bed now and will investigate these beautiful think later =)

Thank you again, i’ll be back

Result! Hard part done.
That doesn’t look much like a temperature in expected “x100” form (XX.XX as XXX without the decimal) though.
You may need to play with wordswap or register numbers yet.

1 Like

format is exactly like it’s descibred in the parameters section.
Where do i need to play with wordswap (?) or register numbers (?) - modbus.cfg or item(s)?

Yep you are right, temperature is reported x1000 not x100 as I wrongly recalled.
If you are expecting temperature around 15C, it is sorted.

the display showed 14.7 °C so it’s right!
conversion must be done with rules/openhab?

You mean converting the x1000 integer to decimal degrees?
I think you could do that now with a transform in the Modbus binding.

I’ve no experience of that, an alternative approach is to create a proxy item (unbound to any device) and have a rule triggered on a change to the Modbus Item that calculates as needed and updates the proxy Item.

1 Like

By the way, you can now use standard development version of the modbus binding, it includes the transformation support.

The thread linked by @rossko57 contains example of scaling.

Best,
Sami

i can’t get 1.10 to work, so i’ll probably stick with proxy items!
cheers

@narf27, could you please elaborate what kind of issues you were facing with 1.10.0 version?

Best,
Sami

@ssalonen putting the .jar file in the addons folder didn’t do the trick i already gave up.
so it’s problably not a problem of the binding but my fault!

@rossko57 today i tried to implement a r/w register, but it won’t work:

modbus.cfg:

writemultipleregisters=true

serial.slave2.connection=/dev/ttyAMA0:9600:8:none:1:rtu
serial.slave2.id=1
serial.slave2.type=holding
serial.slave2.start=200
serial.slave2.length=2
serial.slave2.valuetype=int32

item:

Number Raum_MB "Innentemperatur IST" (Modbus) {modbus="slave2:0"}

it’s on page 102 of the parameter pdf posted above…

here’s what the openhab log says:

2017-04-17 20:05:11.483 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 04 00 ca 00 02 51 f5
2017-04-17 20:05:11.484 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: Error reading response (EOF)
2017-04-17 20:05:11.486 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@a43d6c (unit id 1 & transaction 849). Serial parameters: SerialParameters@4e760e[portName=/dev/ttyAMA0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]

Btw, you probably had similar issues than @nickma82 on this thread : Modbus support for transformations, roller shutter items, read-only items, write-only items, and others
. The solution is given there.

Regarding the error you receive, did it work out eventually after retries? The log you output is the first try out of three.

Best
Sami

My German is not good enough with the product manuals to tell if you should now be using modbus id=1 when it worked with id=2 before.

On page 5 of the register guide, 202 is shown as read-only.

No matter, the failing Modbus function code is 04, read input register, for address CA (202). The error is not a write error.
The config for “slave2” you show us should use FC 03 for read holding.
This error command must come from somewhere else. Perhaps a cached config from before your last edit.

Maybe this slave doesn’t like being hit with two successive polls too quickly. There is an inter-transaction gap parameter to play with for that.


However: my German is not good enough to understand the documentation - you will need to understand it yourself if you want success - But from what I can see on pages 10 & 11
http://gasserenergy.ch/wp-content/uploads/2015/09/900.6660_01_TI_Modbus_RTU_DE.pdf
this devices supports only FC04 (read input) and FC10 (write multiple holding).
Oddly it does not seem to support reading of holding types, but lets see if FC03 errors arise yet. Perhaps it will read in reality.

The document says, that it makes all Modbus devices accessible from within a single (main if you want) Modbus-Connection (in that case the RS232, page 8).
That means, if id==2 worked, use that.

IMHO that’s correct.

I would suggest: try to bring the connection up with a small modbus software (e.g. pythons minimalmodbus), but a fully fledged home automation integration. This makes debugging much easier and gives you the ability to expulse some fault cases (e.g. the timing constraint you mentioned).
For an example see: nilan_communication_bringup/src/nilan.py at master · nickma82/nilan_communication_bringup · GitHub

Best

argh, i just checked the log with my initial (working) setup for 202 register…
first of all: it didn’t work with id2, but with id1, so that should not be the problem!

events.log

2017-04-18 07:40:46.624 [ItemStateChangedEvent     ] - Aussen_MB changed from 12503 to 12648
2017-04-18 07:40:46.663 [ItemStateChangedEvent     ] - Aussen_MB_kr changed from 12.50300000 to 12.64800000
2017-04-18 07:42:28.396 [ItemStateChangedEvent     ] - Aussen_MB changed from 12648 to 11645
2017-04-18 07:42:28.421 [ItemStateChangedEvent     ] - Aussen_MB_kr changed from 12.64800000 to 11.64500000
2017-04-18 07:44:10.142 [ItemStateChangedEvent     ] - Aussen_MB changed from 11645 to 10802
2017-04-18 07:44:10.167 [ItemStateChangedEvent     ] - Aussen_MB_kr changed from 11.64500000 to 10.80200000
2017-04-18 07:45:51.904 [ItemStateChangedEvent     ] - Aussen_MB changed from 10802 to 10251
2017-04-18 07:45:51.930 [ItemStateChangedEvent     ] - Aussen_MB_kr changed from 10.80200000 to 10.25100000
2017-04-18 07:47:33.662 [ItemStateChangedEvent     ] - Aussen_MB changed from 10251 to 10112
2017-04-18 07:47:33.688 [ItemStateChangedEvent     ] - Aussen_MB_kr changed from 10.25100000 to 10.11200000

BUT!!! openhab.log:

2017-04-18 07:40:46.503 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 04 00 ca 00 02 51 f5
2017-04-18 07:40:46.504 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: Error reading response (EOF)
2017-04-18 07:40:46.506 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@15fac32 (unit id 1 & transaction 654). Serial parameters: SerialParameters@d1b2c[portName=/dev/ttyAMA0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2017-04-18 07:42:28.253 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 04 00 ca 00 02 51 f5
2017-04-18 07:42:28.254 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: Error reading response (EOF)
2017-04-18 07:42:28.256 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@e7c6a3 (unit id 1 & transaction 656). Serial parameters: SerialParameters@d1b2c[portName=/dev/ttyAMA0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2017-04-18 07:44:10.013 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 04 00 ca 00 02 51 f5
2017-04-18 07:44:10.014 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: Error reading response (EOF)
2017-04-18 07:44:10.016 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@1fb12df (unit id 1 & transaction 658). Serial parameters: SerialParameters@d1b2c[portName=/dev/ttyAMA0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2017-04-18 07:45:51.773 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 04 00 ca 00 02 51 f5
2017-04-18 07:45:51.774 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: Error reading response (EOF)
2017-04-18 07:45:51.776 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@1c5c295 (unit id 1 & transaction 660). Serial parameters: SerialParameters@d1b2c[portName=/dev/ttyAMA0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2017-04-18 07:47:33.523 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 04 00 ca 00 02 51 f5
2017-04-18 07:47:33.525 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: Error reading response (EOF)
2017-04-18 07:47:33.527 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@1dbd3a3 (unit id 1 & transaction 662). Serial parameters: SerialParameters@d1b2c[portName=/dev/ttyAMA0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]

so i get the values but openhab still has errors in the log.

modbus.cfg:

serial.slave1.connection=/dev/ttyAMA0:9600:8:none:1:rtu
serial.slave1.id=1
serial.slave1.type=input
serial.slave1.start=202
serial.slave1.length=2
serial.slave1.valuetype=int32

item(s) where 2nd item is my proxy item:

Group Modbus
Number Aussen_MB "Außentemperatur" (Modbus) {modbus="slave1:0"}
Number Aussen_MB_kr "Außentermperatur korrigiert" (Modbus)

as you spoke of cache problems i tried a reboot but that didn’t help!