Modbus cfg ignored from OH2.0.0b3

Hi

Having installed OH2.0.0.b3 on a Raspbian (FullImage) - I used the paperUI for installation of the bindings. I installed modbus 1.9.0-snapshoot.

I entered sometimes some fake data into a cfg file in the conf folder like “serial.u25.connection” and “/dev/ttyS” for the modbus rtu serial binding. Even the baud rate was wrong. After studie of the wiki setup, the OH doesn’t load the openhab.cfg file with my modbus:*** settings. I got error openhab.log like:

2016-08-29 17:28:08.474 [ERROR] [inding.modbus.internal.ModbusBinding] - Exception when parsing configuration parameter serial.u25.connection = /dev/ttyS=:28800:8:none:1:rtu:150  --  java.lang.IllegalArgumentException invalid baud rate: 28800
2016-08-29 17:28:08.479 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedService, org.osgi.service.event.EventHandler, id=318, bundle=199/mvn:org.openhab.binding/org.openhab.binding.modbus/1.9.0-SNAPSHOT]: Updating property serial.u25.connection of configuration org.openhab.modbus caused a problem: Exception when parsing configuration parameter serial.u25.connection = /dev/ttyS=:28800:8:none:1:rtu:150  --  java.lang.IllegalArgumentException invalid baud rate: 28800
org.osgi.service.cm.ConfigurationException: serial.u25.connection : Exception when parsing configuration parameter serial.u25.connection = /dev/ttyS=:28800:8:none:1:rtu:150  --  java.lang.IllegalArgumentException invalid baud rate: 28800
	at org.openhab.binding.modbus.internal.ModbusBinding.updated(ModbusBinding.java:589)[199:org.openhab.binding.modbus:1.9.0.201608010110]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1444)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1400)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:143)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:110)[7:org.apache.felix.configadmin:1.8.8]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_65]

I tried:

  1. deleting /tmp and /cash -> cash gone, items in paperUI gone
  2. uninstall in papaerUI the binding and re-installed agaiin
  3. used modbus.cfg for settings (directly with poll:1000
  4. used openhab.cfg for settings (with “modbus:” in front)
  5. setting the permission and chmod to 0777 and root:root of the ttyUSB0 (USB0 recognized in dmsg at startup)
  6. openhab running as service (with root permissions)

What is the approach to reset the openhab binding from my installation (including moddb data)?
How do I reset the osgi?

Cheers, Markus

Hi Markus,

I don’t really understand your question, but I will give you some suggestions anyway:

  1. Don’t use the openhab.cfg, remove all modbus: lines in your openhab.cfg. In OH2 each binding has its own config file in conf/services/
  2. Your conf/services/modbus.cfg should look like this:
modbus:serial.slave123.connection=/dev/ttyUSB0:28800:8:none:1:rtu:150

BUT that is not going to work either.

java.lang.IllegalArgumentException invalid baud rate: 28800

This suggests that a baudrate of 28800 is simply not supported by the binding (or the underlying java libs). You will have to set your Modbus device to some other baudrate - if possible.

Best regards,
Max

Solved!

I got it worked: the modbus binding seems to load its default cfg data. This can be found here:
./userdata/cache/org.eclipse.osgi/7/data/config/org/openhab/modbus.config

  1. remove modbus binding over paperUI
  2. remove the mentioned modbus.config
  3. setup modbus.cfg in your service folder
  4. install modbus (by paperUI)
  5. have fun!

Best regards,
Markus

2 Likes