Transition from Modbus1 to Modbus2. OpenHab2

This is the tutorial I followed when I created the symlinks. And I have check them about hundreds of times now.

But I have an theory that my problems is not regarding the symlinks itself, it more about the RS486 USB stick, cause 3 out of 4 symlinks works just fine…
I have a sligt feeling that the old modbus never actually checked all serial settings, which is why it worked fine. I just cant figure out, what it is… Its an Incircut RS486 USB stick… I need to digger more into this. It´s really driven my mad!!

To keep you posted on this one… I think I just got a step futher…
I changed the Bridge settings parity from “even” to “none”. And now it seems like it accept my RS486 stick, (I had a feeling this might be the case… Dont ask why)…

However, I seem to be stuck on the Modbus Data thing now. This is where I suspected I would run into problems, cause this is where I need to understand modbus for my device (Nilan Comfort 300LR), which I simply dont.
I kinda hoped I could take the old data settings, and just insert the data into the thing configuration… But like with the stick, I fear that these may be wrong as well…

This is my old full setup filled with Input and Holding registers:

poll=3000
serial.pollinterval="6000"
writemultipleregisters=true


serial.nilan_input_device.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_input_device.id=30
serial.nilan_input_device.start=0
serial.nilan_input_device.length=4
serial.nilan_input_device.type=input

serial.nilan_holding_device.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_device.id=30
serial.nilan_holding_device.start=0
serial.nilan_holding_device.length=1
serial.nilan_holding_device.type=holding

serial.nilan_input_discreteio.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_input_discreteio.id=30
serial.nilan_input_discreteio.start=100
serial.nilan_input_discreteio.length=14
serial.nilan_input_discreteio.type=input

serial.nilan_holding_discreteio.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_discreteio.id=30
serial.nilan_holding_discreteio.start=100
serial.nilan_holding_discreteio.length=28
serial.nilan_holding_discreteio.type=holding

serial.nilan_input_analogio.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_input_analogio.id=30
serial.nilan_input_analogio.start=200
serial.nilan_input_analogio.length=23
serial.nilan_input_analogio.type=input

serial.nilan_holding_analogio.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_analogio.id=30
serial.nilan_holding_analogio.start=200
serial.nilan_holding_analogio.length=6
serial.nilan_holding_analogio.type=holding

#serial.nilan_input_time.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
#serial.nilan_input_time.id=30
#serial.nilan_input_time.start=300
#serial.nilan_input_time.length=x
#serial.nilan_input_time.type=input

serial.nilan_holding_time.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_time.id=30
serial.nilan_holding_time.start=300
serial.nilan_holding_time.length=6
serial.nilan_holding_time.type=holding

serial.nilan_input_alarm.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_input_alarm.id=30
serial.nilan_input_alarm.start=400
serial.nilan_input_alarm.length=10
serial.nilan_input_alarm.type=input

serial.nilan_holding_alarm.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_alarm.id=30
serial.nilan_holding_alarm.start=400
serial.nilan_holding_alarm.length=1
serial.nilan_holding_alarm.type=holding

#serial.nilan_input_weekprogram.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
#serial.nilan_input_weekprogram.id=30
#serial.nilan_input_weekprogram.start=500
#serial.nilan_input_weekprogram.length=x
#serial.nilan_input_weekprogram.type=input

serial.nilan_holding_weekprogram.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_weekprogram.id=30
serial.nilan_holding_weekprogram.start=500
serial.nilan_holding_weekprogram.length=1
serial.nilan_holding_weekprogram.type=holding


#serial.nilan_input_user1functions.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
#serial.nilan_input_user1functions.id=30
#serial.nilan_input_user1functions.start=600
#serial.nilan_input_user1functions.length=x
#serial.nilan_input_user1functions.type=input

serial.nilan_holding_user1functions.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_user1functions.id=30
serial.nilan_holding_user1functions.start=600
serial.nilan_holding_user1functions.length=6
serial.nilan_holding_user1functions.type=holding

#serial.nilan_input_user2functions.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
#serial.nilan_input_user2functions.id=30
#serial.nilan_input_user2functions.start=600
#serial.nilan_input_user2functions.length=x
#serial.nilan_input_user2functions.type=input

serial.nilan_holding_user2functions.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_user2functions.id=30
serial.nilan_holding_user2functions.start=610
serial.nilan_holding_user2functions.length=6
serial.nilan_holding_user2functions.type=holding

serial.nilan_input_control.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_input_control.id=30
serial.nilan_input_control.start=1000
serial.nilan_input_control.length=4
serial.nilan_input_control.type=input

serial.nilan_holding_control.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_control.id=30
serial.nilan_holding_control.start=1000
serial.nilan_holding_control.length=8
serial.nilan_holding_control.type=holding

#serial.nilan_input_airflow.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
#serial.nilan_input_airflow.id=30
#serial.nilan_input_airflow.start=1100
#serial.nilan_input_airflow.length=x
#serial.nilan_input_airflow.type=input

serial.nilan_holding_airflow.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_airflow.id=30
serial.nilan_holding_airflow.start=1100
serial.nilan_holding_airflow.length=2
serial.nilan_holding_airflow.type=holding

serial.nilan_input_airtemp.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_input_airtemp.id=30
serial.nilan_input_airtemp.start=1200
serial.nilan_input_airtemp.length=7
serial.nilan_input_airtemp.type=input

serial.nilan_holding_airtemp.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_airtemp.id=30
serial.nilan_holding_airtemp.start=1200
serial.nilan_holding_airtemp.length=6
serial.nilan_holding_airtemp.type=holding

#serial.nilan_input_airbypass.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
#serial.nilan_input_airbypass.id=30
#serial.nilan_input_airbypass.start=1300
#serial.nilan_input_airbypass.length=x
#serial.nilan_input_airbypass.type=input

#serial.nilan_input_airheat.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
#serial.nilan_input_airheat.id=30
#serial.nilan_input_airheat.start=1400
#serial.nilan_input_airheat.length=x
#serial.nilan_input_airheat.type=input

#serial.nilan_input_compressor.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
#serial.nilan_input_compressor.id=30
#serial.nilan_input_compressor.start=1500
#serial.nilan_input_compressor.length=x
#serial.nilan_input_compressor.type=input

#serial.nilan_input_defrost.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
#serial.nilan_input_defrost.id=30
#serial.nilan_input_defrost.start=1600
#serial.nilan_input_defrost.length=x
#serial.nilan_input_defrost.type=input

#serial.nilan_input_hotwater.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
#serial.nilan_input_hotwater.id=30
#serial.nilan_input_hotwater.start=1700
#serial.nilan_input_hotwater.length=x
#serial.nilan_input_hotwater.type=input

serial.nilan_holding_hotwater.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_hotwater.id=30
serial.nilan_holding_hotwater.start=1700
serial.nilan_holding_hotwater.length=2
serial.nilan_holding_hotwater.type=holding

#serial.nilan_input_centheat.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
#serial.nilan_input_centheat.id=30
#serial.nilan_input_centheat.start=1800
#serial.nilan_input_centheat.length=1
#serial.nilan_input_centheat.type=input

serial.nilan_holding_centheat.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_centheat.id=30
serial.nilan_holding_centheat.start=1800
serial.nilan_holding_centheat.length=1
serial.nilan_holding_centheat.type=holding

#serial.nilan_input_airqualrh.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
#serial.nilan_input_airqualrh.id=30
#serial.nilan_input_airqualrh.start=1900
#serial.nilan_input_airqualrh.length=x
#serial.nilan_input_airqualrh.type=input

serial.nilan_holding_airqualrh.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_airqualrh.id=30
serial.nilan_holding_airqualrh.start=1910
serial.nilan_holding_airqualrh.length=4
serial.nilan_holding_airqualrh.type=holding

#serial.nilan_input_airqualco2.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
#serial.nilan_input_airqualco2.id=30
#serial.nilan_input_airqualco2.start=1900
#serial.nilan_input_airqualco2.length=x
#serial.nilan_input_airqualco2.type=input

serial.nilan_holding_airqualco2.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_airqualco2.id=30
serial.nilan_holding_airqualco2.start=1920
serial.nilan_holding_airqualco2.length=3
serial.nilan_holding_airqualco2.type=holding

serial.nilan_input_userpanel.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_input_userpanel.id=30
serial.nilan_input_userpanel.start=2000
serial.nilan_input_userpanel.length=12
serial.nilan_input_userpanel.type=input

serial.nilan_holding_userpanel.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
serial.nilan_holding_userpanel.id=30
serial.nilan_holding_userpanel.start=2000
serial.nilan_holding_userpanel.length=1
serial.nilan_holding_userpanel.type=holding

#serial.nilan_input_preheat.connection=/dev/ttyUSB-RS486:19200:8:even:1:rtu
#serial.nilan_input_preheat.id=30
#serial.nilan_input_preheat.start=2100
#serial.nilan_input_preheat.length=x
#serial.nilan_input_preheat.type=input


New update - Problems with the RS486 stick is not solved. As soon as I add data, i get the same error again, USB-RS486 doesnt exsist…
I guess there isn´t any real check to this beeing online and working correct.

Just to clear, modbus bindings v1 & v2 won’t coexist and share the RS485 dongle.

Serial Modbus is usually run without parity these days, but as usual every device is different and its the Nilan you need to enquiring of.

Not trying to…
I updated to openhab 2.4 Milestone the other day, and the old modbus binding is gone. Now I´m just trying to get the new modbus binding to work. Beside the Data thing, this should be a peace of cake!

I think I have tried all sorts of combination now… I cant get modbus v2 to read the USB stick
As you could see from the old config (modbus v1). That configuration worked fine in openhab 2.3 with the modbus v1…
I didn´t change the stick. SO I would assume the USB port would be the same. But this new modbus v2 simply cant read the stick using the same settings…

When modbus v2 can´t read the stick, I get problems with the Poller as well as the Data, Sending me right back to scratch!!!

Some how I need to get modbus to read the damn stick!! I´m not good at Linux, så I dont even know how to find the port. Sure I can do lsusb as well as list available tty´s… But this is not helping much, since it should work on UBS-RS486 or USB0 or USB1. But none seems to work…
I have now spend hours trying to get this cleared… I´m really desperate!!!

You’re going to have to help us out, and show your work clearly (as we’ve been round the houses a bit on the end of another thread).

May we see the results, please.
Also the failing modbus Things, and the failure log message

[21:22:57] openhabian@openHABianPi:~$ lsusb
Bus 001 Device 007: ID 152d:9561 JMicron Technology Corp. / JMicron USA Technology Corp.
Bus 001 Device 006: ID 0658:0200 Sigma Designs, Inc.
Bus 001 Device 005: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[21:23:00] openhabian@openHABianPi:~$

Device 004 is the In-Circuit USB<->RS485 stick.

[21:23:16] openhabian@openHABianPi:~$ ls /dev/tty*
/dev/tty    /dev/tty14  /dev/tty20  /dev/tty27  /dev/tty33  /dev/tty4   /dev/tty46  /dev/tty52  /dev/tty59  /dev/tty8       /dev/ttyUSB-RS486
/dev/tty0   /dev/tty15  /dev/tty21  /dev/tty28  /dev/tty34  /dev/tty40  /dev/tty47  /dev/tty53  /dev/tty6   /dev/tty9       /dev/ttyUSB-ZStick
/dev/tty1   /dev/tty16  /dev/tty22  /dev/tty29  /dev/tty35  /dev/tty41  /dev/tty48  /dev/tty54  /dev/tty60  /dev/ttyACM0
/dev/tty10  /dev/tty17  /dev/tty23  /dev/tty3   /dev/tty36  /dev/tty42  /dev/tty49  /dev/tty55  /dev/tty61  /dev/ttyAMA0
/dev/tty11  /dev/tty18  /dev/tty24  /dev/tty30  /dev/tty37  /dev/tty43  /dev/tty5   /dev/tty56  /dev/tty62  /dev/ttyprintk
/dev/tty12  /dev/tty19  /dev/tty25  /dev/tty31  /dev/tty38  /dev/tty44  /dev/tty50  /dev/tty57  /dev/tty63  /dev/ttyS0
/dev/tty13  /dev/tty2   /dev/tty26  /dev/tty32  /dev/tty39  /dev/tty45  /dev/tty51  /dev/tty58  /dev/tty7   /dev/ttyUSB0
[21:24:33] openhabian@openHABianPi:~$

I have changed some, and going back to my original communication settings with a small change though…
This is my .thing file as it looks right now: Notice holding registers.

Bridge modbus:serial:myNilan [ port="/dev/ttyUSB-RS486", id=30, baud=19200, stopBits="1", parity="even", dataBits=8, encoding="rtu" ] {
  Bridge poller holdingRegisters [ start=200, length=2, refresh=6000, type="holding" ] {
      Thing data h200 [ readStart=0, readValueType="uint16" ]
      Thing data h201 [ readStart=1, readValueType="uint16" ]

      // inp02, inp03 similar
   }
}

But the Data thing isn´t really working.

And I dont get any errors with this one… It just doesn´t work.

This is a snip from the Nilan modbus protocol:


I believe this is the way to sat up the modbus data thing?

If I change to input registers I get some communication errors or CRC errors.

The Nilan communication setup parameters:

Just to rule out typo trubble, it needs to be like xxxx.things

If you’ve set up a poller and see no errors in the log, you may be jumping to conclusions. I think it may be polling. Are there any twinkly lights on your equipment?
I’m not sure that a data Thing initializes unless someone actually uses it i.e. you bind an Item to it.

Aside - modbus holding registers are read/write, it’s fine to set up a read only data thing so let’s go with it prove functionality, but you’ll want to change that later.

Just a short note… After hours of playing around with possibly all kind of settings. I managed to get the communication running by setting all up from within PaperUI:

Slave communication: /dev/ttyUSB0 - working!
Regular Poll on adresse 200 bind to the slave - Working
Modbus Data read one register (201) - Working… (though BasicUI doesnt seem to refresh the value… But that issue will have to wait for now).

I have no idea why /dev/ttyUSB0 works fine when setting is done from within PaperUI. I´m 100% possitive I tried that as well when going for manual thing file…
Anyway… Now I know how this thing works, I´ll have another go at the manual created thing file, cause using PaperUI is really not something one want to do for this kind of device (Nilan or any other kind of ventilation/climate/whatever, which have lots of adresses… At least thats my opinion…

And now i´m back to errors again…
This is the errors I get after setting the nilan.things file up manually:

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)

This is the 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" ]

   }
}

This is really bad :rage:

I believe there is a problem with the binding… according to my nilan.things file above I have set the stopBits=“1”
But this is how it looks like, when I look at it from PaperUI: (notice stopBits is empty)
Note to @ssalonen about this issue.

@rossko57 Do you know, how to set up the slave communication from PaperUI, and the poller and modbus Data from a manual .thing file… How would that look? I tried but I didn´t succeded.

Nope; I stick to Things files. The binding does work for many other users.

Beware if you change settings in PaperUI it does not get recorded back into any xxx.things file, I don’t know how/if conflicts get resolved, or how to flush out any lingering PaperUI settings.

EDIT - turned out to be conflict with PaperUI representation of “1” and “1.0”, either works in text setups.

Thats what I´m trying to and prefere too.

I do not doubt that. But if my discovery is correct, only serial users will have this problem.

I´ll start a new thread, as this is not really related to transistion from modbus1 to modbus2. Thx for all your help @rossko57 without I would probably still be pulling my hair off in frustration :slightly_smiling_face:

Serial Modbus users are thinner on the ground.

I expect we can come back here for Nilan register specifics later…

Sure, I will return in this thread with full setup!

It´s me again… :slight_smile:

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 :wink:

No reply the writeMultipleEvenWithSingleRegisterOrCoil. needed anyway… I found an example from another in this thread…

And it works for me as well…

This is my data thing:

 Bridge poller controlRegisters [ start=1001, length=7, refresh=6000, type="holding" ] {
      Thing data hol1001 [ readStart="1001", readValueType="int16", writeStart="1001", writeValueType="int16", writeType="holding", writeMultipleEvenWithSingleRegisterOrCoil="true" ]
      Thing data hol1002 [ readStart="1002", readValueType="int16", writeStart="1002", writeValueType="int16", writeType="holding", writeMultipleEvenWithSingleRegisterOrCoil="true"  ]
      Thing data hol1003 [ readStart="1003", readValueType="int16", writeStart="1003", writeValueType="int16", writeType="holding", writeMultipleEvenWithSingleRegisterOrCoil="true"  ]
      Thing data hol1004 [ readStart="1004", readValueType="int16", writeStart="1004", writeValueType="int16", writeType="holding", writeMultipleEvenWithSingleRegisterOrCoil="true", readTransform="JS(divide100.js)"  ]
      Thing data hol1005 [ readStart="1005", readValueType="int16" ]
      Thing data hol1006 [ readStart="1006", readValueType="int16", readTransform="JS(divide100.js)" ]
      Thing data hol1007 [ readStart="1007", readValueType="int16" ]

   }

But its a bit pain to read the doc about this setting, cause it never actually explain “true” to be an option.

I see you’re getting adventurous with Transforms and all :wink:

The docs for data thing writeMultipleEvenWithSingleRegisterOrCoil does suggest that it is a boolean with value of true, rather than string "true"
I think we’d better summon @ssalonen for confirmation

I tryed both true and “true” and found no difference. Both work.
cheers

Yeah… Actually I was using transforms with the old modbus binding too. They were placed in the items file within the channel section. So this part was a peace of cake :slight_smile:

It takes what seem forever to get through all these registers (adresses) for the Nilan device I have. But I get the picture now, and understand the most of it. So it´s just hard work creating all those data things. (I havn´t counted, but I guess I have something like 40-50 data things now, and still quite a few to go).

About the things file…
I think there may be some timing issues resulting in errors and data things going offline when editing the things file. Sometimes when I edit the file adding data, when I save the file, I suddenly get an error in another data thing, and not the one I´m editing. The data thing will go offline and I cant get it back online, except if I restart openhab. Then it comes back to online and working fine again, without any changes.
This has turned into quite some confusions when it happened and taking abit of a time to realise. I think I recall something simular with the old modbus setup. Each time I changed something, I could end up gettting an error. But after restart it works just fine.
I wonder if this could be due to the huge amount of data things, or is this just a “side effect” of modbus?