It´s me again…
I have gone as far as to writing holding registers. And just as you say, I might run into troubble… Well I did… And now I´m trying to understand how to use this writeMultipleEvenWithSingleRegisterOrCoil.
This is my data thing for this specific holding register:
Bridge poller controlRegisters [ start=1001, length=7, refresh=6000, type="holding" ] {
Thing data hol1001 [ readStart="1001", readValueType="int16", writeStart="1001", writeValueType="int16", writeType="holding" ]
Thing data hol1002 [ readStart="1002", readValueType="int16", writeStart="1002", writeValueType="int16", writeType="holding" ]
Thing data hol1003 [ readStart="1003", readValueType="int16", writeStart="1003", writeValueType="int16", writeType="holding" ]
Thing data hol1004 [ readStart="1004", readValueType="int16", writeStart="1004", writeValueType="int16", writeType="holding" ]
Thing data hol1005 [ readStart="1005", readValueType="int16" ]
Thing data hol1006 [ readStart="1006", readValueType="int16" ]
Thing data hol1007 [ readStart="1007", readValueType="int16" ]
}
When trying to write to register 1002, I get this error:
2018-12-19 00:00:34.426 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 1e 06 03 eb 00 02 7a 14
2018-12-19 00:00:34.430 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: CRC Error in received frame: 0 bytes:
2018-12-19 00:00:34.435 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/1 error: I/O exception: IOException CRC Error in received frame: 0 bytes: . Request: net.wimpi.modbus.msg.WriteSingleRegisterRequest@b7ddc3 (unit id 30 & transaction 41751). Serial parameters: SerialParameters@18b01b9[portName=/dev/ttyUSB0,baudRate=19200,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=even,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2018-12-19 00:00:34.440 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute reached max tries 1, throwing last error: I/O exception: IOException CRC Error in received frame: 0 bytes: . Request: net.wimpi.modbus.msg.WriteSingleRegisterRequest@b7ddc3 (unit id 30 & transaction 41751). Serial parameters: SerialParameters@18b01b9[portName=/dev/ttyUSB0,baudRate=19200,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=even,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2018-12-19 00:00:34.444 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (BasicModbusWriteRegisterRequestBlueprint@4aaa96[slaveId=30,reference=1003,functionCode=WRITE_SINGLE_REGISTER,registers=ModbusRegisterArrayImpl(00 02),maxTries=3]). Aborting. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException CRC Error in received frame: 0 bytes: [operation ID adec7eb6-1b06-45e4-9d5f-a7f3168910cc]
2018-12-19 00:00:34.462 [ERROR] [ernal.handler.ModbusDataThingHandler] - Thing modbus:data:myNilan:controlRegisters:hol1003 'Modbus data' had ModbusSlaveIOExceptionImpl error on write: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: IOException CRC Error in received frame: 0 bytes: ', cause2=null)
I believe I should use the writeMultipleEvenWithSingleRegisterOrCoil, but I have no idea how to use it… And the doc doesn´t give an example either…
Beside that, things are going forward, and I have what seems to be a billion data things now