Hello,
I have a VMC from Unelvent with a modbus interface. On computer side, I use a FTDI USB modbus adpater.
I have a snipnet of python code working using pymodbus
# cat test2.py
#!/usr/bin/python
from pymodbus.client.sync import ModbusSerialClient
import pprint
pp = pprint.PrettyPrinter(indent=4)
client = ModbusSerialClient(method='rtu', port='/dev/ttyUSB0', baudrate=19200, bytesize=8, stopbits=1, parity='E')
client.connect()
result = client.read_input_registers(address=0x00, count=41, unit=0x01)
print "current airflow : ",result.registers[16]
# python test2.py
current airflow : 4
#
Now, I would like to read this register from Openhab, here is the corresponding configuration in openhab.cfg :
modbus:poll=10000
modbus:serial.vmc.connection=/dev/ttyUSB0:19200:8:even:1:rtu
modbus:serial.vmc.id=1
modbus:serial.vmc.start=16
modbus:serial.vmc.length=1
modbus:serial.vmc.type=input
modbus:serial.vmc.valuetype=int16
Log :
11:44:33.840 [DEBUG] [o.b.m.internal.ModbusActivator:30 ] - Modbus binding has been started.
11:44:33.865 [DEBUG] [b.m.internal.ModbusSerialSlave:41 ] - overriding modbus port: null by: /dev/ttyUSB0but there is currently only one port supported
11:44:33.867 [DEBUG] [.modbus.internal.ModbusBinding:352 ] - config looked good, proceeding with slave-connections
11:44:33.867 [DEBUG] [b.m.internal.ModbusSerialSlave:117 ] - connection was null, going to create a new one
11:44:33.931 [INFO ] [.service.AbstractActiveService:169 ] - Modbus Polling Service has been started
11:44:33.964 [ERROR] [i.modbus.io.ModbusRTUTransport:166 ] - Last request: 01 04 00 10 00 01 30 0f
11:44:33.964 [ERROR] [i.modbus.io.ModbusRTUTransport:167 ] - failed to read: CRC Error in received frame: 0 bytes:
11:44:33.967 [ERROR] [w.m.io.ModbusSerialTransaction:197 ] - execute try 1 error: I/O exception - failed to read
11:44:33.987 [ERROR] [i.modbus.io.ModbusRTUTransport:166 ] - Last request: 01 04 00 10 00 01 30 0f
11:44:33.988 [ERROR] [i.modbus.io.ModbusRTUTransport:167 ] - failed to read: CRC Error in received frame: 0 bytes:
11:44:33.988 [ERROR] [w.m.io.ModbusSerialTransaction:197 ] - execute try 2 error: I/O exception - failed to read
11:44:33.995 [ERROR] [i.modbus.io.ModbusRTUTransport:166 ] - Last request: 01 04 00 10 00 01 30 0f
11:44:33.995 [ERROR] [i.modbus.io.ModbusRTUTransport:167 ] - failed to read: CRC Error in received frame: 0 bytes:
11:44:33.996 [DEBUG] [.b.modbus.internal.ModbusSlave:342 ] - ModbusSlave:I/O exception - failed to read
11:44:34.001 [INFO ] [.b.modbus.internal.ModbusSlave:310 ] - ModbusSlave error getting responce from slave
...
I tried to read coils, discretes, holdings and input, I tried different type of parity (even if it works with EVEN with python lib), I tried differents typevalue without success.
If someone could help me, it would be very great !!!
Thanks
Denis