Using Rpi and a In-Circuit RS485 USB stick.
Nilan Comfort 300LR modbus device (ventilation system).
Openhab (apt-get) 2.4.0 M8.
Modbus version 2.4.M8 (provided in the M8 release)
Note for @ssalonen
Problem:
I believe there is a problem with the binding using serial connection and manual thing file. And I believe this could be related to the stopBits parameter.
I can get the communication to work when setting all up from PaperUI. Modbus serial slave, Regular Poll and Thing Data are all online, and I receive data just fine from the Nilan device.
Using the exact same settings in a thing file fails. Thing Data throws an error.
2018-12-16 22:54:04.722 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'nilan.things'
==> /var/log/openhab2/events.log <==
2018-12-16 22:54:04.853 [hingStatusInfoChangedEvent] - 'modbus:serial:myNilan' changed from UNINITIALIZED to INITIALIZING
2018-12-16 22:54:04.857 [hingStatusInfoChangedEvent] - 'modbus:serial:myNilan' changed from INITIALIZING to ONLINE
2018-12-16 22:54:04.872 [hingStatusInfoChangedEvent] - 'modbus:poller:myNilan:holdingRegisters' changed from UNINITIALIZED to INITIALIZING
2018-12-16 22:54:04.879 [hingStatusInfoChangedEvent] - 'modbus:poller:myNilan:holdingRegisters' changed from INITIALIZING to ONLINE
2018-12-16 22:54:04.886 [hingStatusInfoChangedEvent] - 'modbus:data:myNilan:holdingRegisters:hol201' changed from UNINITIALIZED to INITIALIZING
==> /var/log/openhab2/openhab.log <==
2018-12-16 22:54:04.880 [WARN ] [me.config.core.internal.ConfigMapper] - Could not set field value for field 'readStart': Can not set java.lang.String field org.openhab.binding.modbus.internal.config.ModbusDataConfiguration.readStart to java.math.BigDecimal
java.lang.IllegalArgumentException: Can not set java.lang.String field org.openhab.binding.modbus.internal.config.ModbusDataConfiguration.readStart to java.math.BigDecimal
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) ~[?:?]
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) ~[?:?]
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81) ~[?:?]
at java.lang.reflect.Field.set(Field.java:764) ~[?:?]
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:523) ~[38:org.apache.commons.lang:2.6.0]
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:500) ~[38:org.apache.commons.lang:2.6.0]
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:560) ~[38:org.apache.commons.lang:2.6.0]
at org.eclipse.smarthome.config.core.internal.ConfigMapper.as(ConfigMapper.java:102) [97:org.eclipse.smarthome.config.core:0.10.0.oh240M8]
at org.eclipse.smarthome.config.core.Configuration.as(Configuration.java:85) [97:org.eclipse.smarthome.config.core:0.10.0.oh240M8]
at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.getConfigAs(BaseThingHandler.java:274) [109:org.eclipse.smarthome.core.thing:0.10.0.oh240M8]
at org.openhab.binding.modbus.internal.handler.ModbusDataThingHandler.initialize(ModbusDataThingHandler.java:327) [242:org.openhab.binding.modbus:2.4.0.M8]
at sun.reflect.GeneratedMethodAccessor32.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [102:org.eclipse.smarthome.core:0.10.0.oh240M8]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [102:org.eclipse.smarthome.core:0.10.0.oh240M8]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
==> /var/log/openhab2/events.log <==
2018-12-16 22:54:04.903 [hingStatusInfoChangedEvent] - 'modbus:data:myNilan:holdingRegisters:hol201' changed from INITIALIZING to OFFLINE (CONFIGURATION_ERROR)
2018-12-16 22:54:04.910 [hingStatusInfoChangedEvent] - 'modbus:data:myNilan:holdingRegisters:hol202' changed from UNINITIALIZED to INITIALIZING
==> /var/log/openhab2/openhab.log <==
2018-12-16 22:54:04.908 [WARN ] [me.config.core.internal.ConfigMapper] - Could not set field value for field 'readStart': Can not set java.lang.String field org.openhab.binding.modbus.internal.config.ModbusDataConfiguration.readStart to java.math.BigDecimal
java.lang.IllegalArgumentException: Can not set java.lang.String field org.openhab.binding.modbus.internal.config.ModbusDataConfiguration.readStart to java.math.BigDecimal
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) ~[?:?]
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) ~[?:?]
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81) ~[?:?]
at java.lang.reflect.Field.set(Field.java:764) ~[?:?]
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:523) ~[38:org.apache.commons.lang:2.6.0]
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:500) ~[38:org.apache.commons.lang:2.6.0]
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:560) ~[38:org.apache.commons.lang:2.6.0]
at org.eclipse.smarthome.config.core.internal.ConfigMapper.as(ConfigMapper.java:102) [97:org.eclipse.smarthome.config.core:0.10.0.oh240M8]
at org.eclipse.smarthome.config.core.Configuration.as(Configuration.java:85) [97:org.eclipse.smarthome.config.core:0.10.0.oh240M8]
at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.getConfigAs(BaseThingHandler.java:274) [109:org.eclipse.smarthome.core.thing:0.10.0.oh240M8]
at org.openhab.binding.modbus.internal.handler.ModbusDataThingHandler.initialize(ModbusDataThingHandler.java:327) [242:org.openhab.binding.modbus:2.4.0.M8]
at sun.reflect.GeneratedMethodAccessor32.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [102:org.eclipse.smarthome.core:0.10.0.oh240M8]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [102:org.eclipse.smarthome.core:0.10.0.oh240M8]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
==> /var/log/openhab2/events.log <==
2018-12-16 22:54:04.924 [hingStatusInfoChangedEvent] - 'modbus:data:myNilan:holdingRegisters:hol202' changed from INITIALIZING to OFFLINE (CONFIGURATION_ERROR)
2018-12-16 22:54:04.933 [hingStatusInfoChangedEvent] - 'modbus:data:myNilan:holdingRegisters:hol203' changed from UNINITIALIZED to INITIALIZING
==> /var/log/openhab2/openhab.log <==
2018-12-16 22:54:04.935 [WARN ] [me.config.core.internal.ConfigMapper] - Could not set field value for field 'readStart': Can not set java.lang.String field org.openhab.binding.modbus.internal.config.ModbusDataConfiguration.readStart to java.math.BigDecimal
java.lang.IllegalArgumentException: Can not set java.lang.String field org.openhab.binding.modbus.internal.config.ModbusDataConfiguration.readStart to java.math.BigDecimal
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) ~[?:?]
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) ~[?:?]
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81) ~[?:?]
at java.lang.reflect.Field.set(Field.java:764) ~[?:?]
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:523) ~[38:org.apache.commons.lang:2.6.0]
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:500) ~[38:org.apache.commons.lang:2.6.0]
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:560) ~[38:org.apache.commons.lang:2.6.0]
at org.eclipse.smarthome.config.core.internal.ConfigMapper.as(ConfigMapper.java:102) [97:org.eclipse.smarthome.config.core:0.10.0.oh240M8]
at org.eclipse.smarthome.config.core.Configuration.as(Configuration.java:85) [97:org.eclipse.smarthome.config.core:0.10.0.oh240M8]
at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.getConfigAs(BaseThingHandler.java:274) [109:org.eclipse.smarthome.core.thing:0.10.0.oh240M8]
at org.openhab.binding.modbus.internal.handler.ModbusDataThingHandler.initialize(ModbusDataThingHandler.java:327) [242:org.openhab.binding.modbus:2.4.0.M8]
at sun.reflect.GeneratedMethodAccessor32.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [102:org.eclipse.smarthome.core:0.10.0.oh240M8]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [102:org.eclipse.smarthome.core:0.10.0.oh240M8]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
==> /var/log/openhab2/events.log <==
2018-12-16 22:54:04.949 [hingStatusInfoChangedEvent] - 'modbus:data:myNilan:holdingRegisters:hol203' changed from INITIALIZING to OFFLINE (CONFIGURATION_ERROR)
nilan.things file:
Bridge modbus:serial:myNilan [ port="/dev/ttyUSB0", id=30, baud=19200, stopBits="1", parity="even", dataBits=8, encoding="rtu" ] {
Bridge poller holdingRegisters [ start=201, length=3, refresh=2000, type="holding" ] {
Thing data hol201 [ readStart=201, readValueType="uint16" ]
Thing data hol202 [ readStart=202, readValueType="uint16" ]
Thing data hol203 [ readStart=203, readValueType="uint16" ]
}
}
Setting up the things file and looking at the Modbus serial slave inside PaperUI, it seems to be lacking the stopBits parameter. I would expect it to show the exact same settings according to the thing file.
Setting up the Modbus serial slave from within PaperUI, it´s not missing the stopBits parameter.
This is the only differences I can find.
If the binding fails to read the stopBits from a .things file I would assume Thing Data will throw an error, as it cant readstart, ofcouse.