Problems connecting LG Modbus via Modbus-Binding

Hello to all,
I have an airconditioning from LG. All indoor devices got a modbus interface with the following specification

My modbus config file looks like

poll=10000
writemultipleregisters=true
serial.lg3coil.connection=/dev/ttyUSB0:9600:8:none:1:rtu:50:1500:none:none
serial.lg3coil.id=3
serial.lg3coil.start=0
serial.lg3coil.length=1
serial.lg3coil.type=coil

serial.lg3holding.connection=/dev/ttyUSB0:9600:8:none:1:rtu:50:1500:none:none
serial.lg3holding.id=3
serial.lg3holding.type=holding
serial.lg3holding.start=0
serial.lg3holding.length=16

the item definition is

Group gModbusKlimaanlage   "Modbus Klimaanlage"      (gModbus)

Switch LG_Schlaf_Operation "Klimagerät Schlafzimmer" (gModbusKlimaanlage) {modbus="lg3coil:0"}

Number LG_Schlaf_Temp "Schlafzimmer Temperatur [%d °C]" <temperature> (gModbusKlimaanlage) {modbus="LG3Holding:1"}

The connection is working well in case of my switch. I’am able to switch the device on and off.
But I’am not able to connect to the input register 30003 or to the holding registers 40001/400002

At the moment I’am testing to read/write the setpoint of the device, but I get the following log

2017-04-03 22:29:04.666 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 03 03 00 00 00 10 45 e4
2017-04-03 22:29:04.668 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: CRC Error in received frame: 0 bytes: 
2017-04-03 22:29:04.671 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@12ca80c (unit id 3 & transaction 169). Serial parameters: SerialParameters@1e92bdb[portName=/dev/ttyUSB0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2017-04-03 22:29:04.747 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 03 03 00 00 00 10 45 e4
2017-04-03 22:29:04.749 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: CRC Error in received frame: 0 bytes: 
2017-04-03 22:29:04.753 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 2/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@12ca80c (unit id 3 & transaction 169). Serial parameters: SerialParameters@1e92bdb[portName=/dev/ttyUSB0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2017-04-03 22:29:04.830 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 03 03 00 00 00 10 45 e4
2017-04-03 22:29:04.832 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: CRC Error in received frame: 0 bytes: 
2017-04-03 22:29:04.836 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 3/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@12ca80c (unit id 3 & transaction 169). Serial parameters: SerialParameters@1e92bdb[portName=/dev/ttyUSB0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2017-04-03 22:29:04.840 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute reached max tries 3, throwing last error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@12ca80c. Serial parameters: SerialParameters@1e92bdb[portName=/dev/ttyUSB0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2017-04-03 22:29:04.843 [ERROR] [.binding.modbus.internal.ModbusSlave] - ModbusSlave (lg3holding): Error getting modbus data for request net.wimpi.modbus.msg.ReadMultipleRegistersRequest@12ca80c. Error: I/O exception - failed to read. Endpoint ModbusSerialSlaveEndpoint@d0e75a[portName=/dev/ttyUSB0]. Connection: SerialConnection@15f5cb6[portName=/dev/ttyUSB0,port=/dev/ttyUSB0]

Has anybody an idea, what am I doing wrong?

Might be a count from 0 / count from 1 issue.
As your switch that LG call coil 1 is found by the Modbus binding at 0 …
Try looking for LG input register 3 (30003) at Modbus address 2

Also please note that input (Modbus 30xxx) and holding (Modbus 40xxx) are quite distinct and use different Modbus commands.
You must define them in separate binding ‘slaves’

Also please note that to read one 16-bit Modbus input register, the length=1

I now have changed to

serial.lg3coil.connection=/dev/ttyUSB0:9600:8:none:1:rtu:50:1500:none:none
serial.lg3coil.id=3
serial.lg3coil.start=0
serial.lg3coil.length=1
serial.lg3coil.type=coil


serial.lg3input.connection=/dev/ttyUSB0:9600:8:none:1:rtu:50:1500:none:none
serial.lg3input.id=3
serial.lg3input.type=input
serial.lg3input.start=2
serial.lg3input.length=1


serial.lg3holding.connection=/dev/ttyUSB0:9600:8:none:1:rtu:50:1500:none:none
serial.lg3holding.id=3
serial.lg3holding.type=holding
serial.lg3holding.start=1
serial.lg3holding.length=1

Nothing happened, but after a new save of the .items file with this settings

Switch LG_Schlaf_Operation "Klimagerät Schlafzimmer"                           (gModbusKlimaanlage) {modbus="lg3coil:0"}

Number LG_Schlaf_Temp      "Schlafzimmer Temperatur [%d °C]"     <temperature> (gModbusKlimaanlage) {modbus="lg3input:0"}

Number LG_Schlaf_TempSW    "Schlafzimmer SollTemperatur [%d °C]" <temperature> (gModbusKlimaanlage) {modbus="lg3holding:0"}

//Number LG_Schlaf_TempSW    "Schlafzimmer SollTemperatur [%.1f]" <temperature> {modbus=">[lg3holding:0:transformation=JS(multiply10.js)], <[lg3holding:0:transformation=JS(divide10.js)]"}

it is running.

But the last line with the transformation does not work. Does this work with 1.9.0 Binding or do I have to change to the 1.10.0 Binding Version to get the extended format.

With the last line active I get the follwing error log

2017-04-04 12:50:36.885 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'LG.items'
2017-04-04 12:50:36.914 [ERROR] [el.item.internal.GenericItemProvider] - Binding configuration of type 'modbus' of item 'LG_Schlaf_TempSW' could not be parsed correctly.
org.eclipse.smarthome.model.item.BindingConfigParseException: Register references should be either :X or :<X:>Y
	at org.openhab.core.binding.internal.BindingConfigReaderDelegate.processBindingConfiguration(BindingConfigReaderDelegate.java:50)[182:org.openhab.core.compat1x:2.0.0]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:312)[123:org.eclipse.smarthome.model.item:0.9.0.b4]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:284)[123:org.eclipse.smarthome.model.item:0.9.0.b4]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.processBindingConfigsFromModel(GenericItemProvider.java:167)[123:org.eclipse.smarthome.model.item:0.9.0.b4]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.modelChanged(GenericItemProvider.java:347)[123:org.eclipse.smarthome.model.item:0.9.0.b4]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:207)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:120)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:272)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.access$1(FolderObserver.java:265)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver$WatchQueueReader.processWatchEvent(FolderObserver.java:146)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
	at org.eclipse.smarthome.core.service.AbstractWatchQueueReader.run(AbstractWatchQueueReader.java:122)[98:org.eclipse.smarthome.core:0.9.0.b4]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]

Extended format is from 1.10.0 onwards.

Refer to docs for more info

http://docs.openhab.org/addons/bindings/modbus1/readme.html

Sami

Thank you for your answer.

I’am using the haslefree raspberry pi setup of openhab.

There I get at the moment only binding with version1.9.0.

how do I upgrade?

hey,

you should be fine following instructions in this thread:

Best,
Sami

Hi peaeater,
I plan to buy a new air conditioning. What type of LG devices do you have? Where did you find the modbus configuration?
Thank you

Hello,
I found the configuration in the documentation

I tried to find that document again on the lg pages, but it seem to be gone.