Hi,
I am running OH2 on a RPi3 with Rasbian Jessie. I would like to use the Modbus binding.
First I tried the Modbus binding 1.9.0 with a serial connection but the binding is not able to open the serial port.
2017-04-21 10:54:05.574 [ERROR] [et.wimpi.modbus.net.SerialConnection] - Could not get port identifier, maybe insufficient permissions. null
2017-04-21 10:54:05.576 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/3 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@19862c[portName=/dev/ttyAMA0,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@74355a[portName=/dev/ttyAMA0]
2017-04-21 10:54:05.615 [ERROR] [et.wimpi.modbus.net.SerialConnection] - Could not get port identifier, maybe insufficient permissions. null
2017-04-21 10:54:05.616 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 2/3 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@19862c[portName=/dev/ttyAMA0,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@74355a[portName=/dev/ttyAMA0]
2017-04-21 10:54:05.655 [ERROR] [et.wimpi.modbus.net.SerialConnection] - Could not get port identifier, maybe insufficient permissions. null
2017-04-21 10:54:05.657 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 3/3 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@19862c[portName=/dev/ttyAMA0,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@74355a[portName=/dev/ttyAMA0]
It suggests that this is a permission problem. The default settings for the serial port are as follows:
$ ls -l /dev/ttyAMA0
crw-rw---- 1 root dialout 204, 64 apr 20 15:43 /dev/ttyAMA0
So I tried to add user openhab
to the dialout
group, so I get:
$ groups openhab
openhab : openhab dialout
As this didn’t make any difference I changed the ownership of the serial port to openhab
:
$ ls -l /dev/ttyAMA0
crw-rw---- 1 openhab openhab 204, 64 apr 21 10:35 /dev/ttyAMA0
I restarted OpenHAB but I still get the above error messages. What am I doing wrong?
Rather frustrated with this experience I thought I’d I try a tcp connection but I get an error here as well:
2017-04-21 11:07:28.205 [ERROR] [inding.modbus.internal.ModbusBinding] - Exception when parsing configuration parameter tcp.slave1.connection = 192.168.0.158:5001:60:0:0:3:100 -- java.lang.IllegalArgumentException invalid baud rate: 5001
2017-04-21 11:07:28.210 [ERROR] [org.apache.felix.configadmin ] - [org.osgi.service.cm.ManagedService, org.osgi.service.event.EventHandler, id=294, bundle=189/mvn:org.openhab.binding/org.openhab.binding.modbus/1.9.0.RC1]: Updating property tcp.slave1.connection of configuration org.openhab.modbus caused a problem: Exception when parsing configuration parameter tcp.slave1.connection = 192.168.0.158:5001:60:0:0:3:100 -- java.lang.IllegalArgumentException invalid baud rate: 5001
org.osgi.service.cm.ConfigurationException: tcp.slave1.connection : Exception when parsing configuration parameter tcp.slave1.connection = 192.168.0.158:5001:60:0:0:3:100 -- java.lang.IllegalArgumentException invalid baud rate: 5001
Why do I get “invalid baud rate: 5001” error when I have defined a tcp connection ?
The configuration on modbus.cfg seems correct:
tcp.slave1.connection=192.168.0.158:5001:60:0:0:3:100
Can anyone here help me to get serial or tcp Modbus connections to work?