Transition from Modbus1 to Modbus2. OpenHab2

Tags: #<Tag:0x00007fc8f75c4758> #<Tag:0x00007fc8f75c4690>

I get an error in the Bridge settings (.things file).

This is the thing file:

Bridge modbus:serial:myNilan [ port="ttyUSB-RS486", id=30, baud=19200, stopBits=1, parity="even", dataBits=8, encoding="rtu" ] {
   // here will go any pollers
}

This is the error:

018-12-16 00:01:18.434 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'nilan.things'
==> /var/log/openhab2/events.log <==
2018-12-16 00:01:18.541 [hingStatusInfoChangedEvent] - 'modbus:serial:myNilan' changed from UNINITIALIZED to INITIALIZING
==> /var/log/openhab2/openhab.log <==
2018-12-16 00:01:18.542 [WARN ] [me.config.core.internal.ConfigMapper] - Could not set field value for field 'stopBits': Can not set java.lang.String field org.openhab.binding.modbus.internal.config.ModbusSerialConfiguration.stopBits to java.math.BigDecimal
java.lang.IllegalArgumentException: Can not set java.lang.String field org.openhab.binding.modbus.internal.config.ModbusSerialConfiguration.stopBits 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.ModbusSerialThingHandler.configure(ModbusSerialThingHandler.java:38) [274:org.openhab.binding.modbus:2.4.0.M8]
	at org.openhab.binding.modbus.internal.handler.AbstractModbusEndpointThingHandler.initialize(AbstractModbusEndpointThingHandler.java:65) [274:org.openhab.binding.modbus:2.4.0.M8]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	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 00:01:18.555 [hingStatusInfoChangedEvent] - 'modbus:serial:myNilan' changed from INITIALIZING to OFFLINE (CONFIGURATION_ERROR): Exception during initialization: port, baud, flowControlIn, flowControlOut, stopBits, parity, encoding all must be non-null! (ModbusConfigurationException)

Ahh found the error… stopBits was missing “”

1 Like

Yep, that’s in the documentation


I think it’s the possibility of 1.5 that makes that numeric parameter an oddball.

You´re right…
And thanks alot for all your help… This has given me alot more to go for now.

See how you get on with the writable registers. I think you’ll need
writeMultipleEvenWithSingleRegisterOrCoil
to reproduce your old setup.

Keep us posted on any docu suggestions. Modbus is odd, everyone’s setup is very different so examples are not always helpful, but a working setup at the end would be god to share here.

Thats my worse problem, cause I really know very little about modbus. My previous setup was a copy from the OpenHAB1/2 Nilan heatpump. And I really struggle to understand how things works…
This new modbus did not make things any better for my understanding :face_with_raised_eyebrow:

I can see from you help, I was actually on the right track regarding setting up the USB stick… What I was missing and doing wrong was the commas… And second, I was using full path to the device ie /dev/ttyUSB-RS486…
An example in the doc´s would be a great help to others, I would say.

Hmm… I believe I have some USB/symlinks problems here…
When I add an poller, I get an error:

2018-12-16 12:04:54.816 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/1 error: Modbus serial device ttyUSB-RS486 doesn't exist!. Connection SerialConnection@6295d1[portName=ttyUSB-RS486,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@354c92[portName=ttyUSB-RS486]
==> /var/log/openhab2/events.log <==
2018-12-16 12:04:54.818 [hingStatusInfoChangedEvent] - 'modbus:poller:myNilan:inputRegisters' changed from INITIALIZING to ONLINE
==> /var/log/openhab2/openhab.log <==
2018-12-16 12:04:54.820 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - re-connect reached max tries 1, throwing last error: Modbus serial device ttyUSB-RS486 doesn't exist!. Connection SerialConnection@6295d1[portName=ttyUSB-RS486,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@354c92[portName=ttyUSB-RS486]
2018-12-16 12:04:54.822 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - Error connecting connection SerialConnection@6295d1[portName=ttyUSB-RS486,port=<null>] for endpoint ModbusSerialSlaveEndpoint@354c92[portName=ttyUSB-RS486]: Modbus serial device ttyUSB-RS486 doesn't exist!
2018-12-16 12:04:54.824 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusSerialSlaveEndpoint@354c92[portName=ttyUSB-RS486] -- aborting request ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@19a2231[slaveId=30,functionCode=READ_INPUT_REGISTERS,start=0,length=4,maxTries=3] [operation ID 10e406f6-337a-4da5-9d63-68296dfb0e90]
==> /var/log/openhab2/events.log <==
2018-12-16 12:04:54.831 [hingStatusInfoChangedEvent] - 'modbus:poller:myNilan:inputRegisters' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Error with read: org.openhab.io.transport.modbus.ModbusConnectionException: Error connecting to endpoint ModbusSerialSlaveEndpoint@354c92[portName=ttyUSB-RS486]
2018-12-16 12:04:54.874 [hingStatusInfoChangedEvent] - 'modbus:data:myNilan:inputRegisters:inp00' changed from UNINITIALIZED to INITIALIZING

I´m getting really tired of this USB/Linux stuff. :face_with_symbols_over_mouth:
With 2.3 setup and the old modbus, it was working rock steady!! (config showed in earlier msg). Then I added a new USB stick (WirelessMbus) and things went bananas… I had to create symlinks to get things working again…
Since then, I´ve struggled with the symlinks. First the Wireless Mbus stick wouldn´t connect. And now this RS486 stick is given a problem as well.
But my Zigbee and a z-wave stick´s are working just fine, just as well as my USB SSD.

This is really killing me!

Well at least we get a clear message!
I know nowt about symlinks. Might be help here

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.