Modbus Log -> Erro Item that doesn´t exists anymore


in Debug Log i get an error on an item that doesn´t exists anymore. I delete that item after i got the first error. After deleting the error is stillt there.

11:25:20.823 [ERROR] [.binding.modbus.internal.ModbusSlave] - ModbusSlave (watt): Error getting modbus data for request net.wimpi.modbus.msg.ReadMultipleRegistersRequest@1c5c9f6. Error: Error Code = 3. Endpoint ModbusTCPSlaveEndpoint@194e467[address=,port=502]. Connection: TCPMasterConnection@1d31809[socket=Socket[addr=/,port=502,localport=50874]]

In modbus.cfg the tcp.watt… doesn´t exist.

What can be the problem here ?

Thanks in advance

OH2 maintains its own internal config, and suffers from “Ghost” items when you edit files.

This really needs to be a FAQ, with appropriate corrective action described (I don’t know what that is)


that´s it. But how can i clean it ? -dosgi.clean doesn´t work.

Even after a reinstallation of the binding I get the error message. How can I delete the missing items?

Next try in Karaf:

smarthome:things clear
smarthome:items clear
smarthome:links clear

No chance. I get still the Error Message from Modbus an the messed items.

Next try with WinSCP. I delete the configuration in /var/lib/openhab2/config/org/openhab. Doesn´t work.
At the moment I am a little frightened. Stable is openhab2 yes but the configuration a pain

@watou In another post I read that you have already occupied with it. Can you help me?

If you installed via apt-get (otherwise the paths are different but the advice is the same):

Have a look if you have a file /var/lib/openhab2/config/org/openhab/modbus.config, see if it has incorrect contents. If it does, stop openHAB, delete the file, start openHAB. When /etc/openhab2/services/modbus.cfg is then re-read, the contents of /var/lib/openhab2/config/org/openhab/modbus.config will be re-created with matching contents.

Strange. I did what you wrote. I stopped openhab2.service -> removed modbus.config and restart the service. And the messed items are back again :frowning:

Then i looked in my modbus.cfg and the items are correct, no non existing items. So i think i look at the wrong folder of configuration. I use openhabian as image.

Even if i uninstall the binding and reinstall it with default modbus.cfg the modbus.config in /var/lib … is created with old configuration :fearful:

My item Config is in /etc/openhab2/items
My services config is in /etc/openhab2/services

The modbus.config in /var/lib/openhab2/config/org/openhab

It’s got to be coming from somewhere! :slight_smile:


cd /etc/openhab2
grep -R watt *

to see if you can spot some other bit of configuration.

No output :frowning:

To be sure that i config the correct file i did another test. In my /etc/openhab2/services/modbus.cfg i put another configuration called tester in. In /var/lib/openhab2/config/org/openhab/modbus.config it appears. I delete the tester in modbus.cfg and stopped openhab2.service. Then i removed the modbus.config file and restart the openhab2.service. In the “new” generated modbus.config the tester still appears.

Good test with “tester” but a bit of awful results!

Any chance your text editor is saving a backup copy of your .cfg file?

ls -al /etc/openhab2/services
[12:56:13] pi@openHABianPi:/etc/openhab2$ ls -al /etc/openhab2/services
total 44
drwxrwxr-x  2 openhab pi      4096 Feb 12 11:42 .
drwxrwxr-x 13 openhab pi      4096 Feb  2 16:35 ..
-rw-rw-r--  1 openhab pi      2194 Jan 22 21:40 addons.cfg
-rw-r--r--  1 openhab openhab  465 Jan 29 20:08 http.cfg
-rw-r--r--  1 pi      pi      2499 Feb 12 11:42 modbus.cfg
-rw-rw-r--  1 openhab pi       328 Jan 22 21:40 readme.txt
-rw-rw-r--  1 openhab pi      2390 Jan 22 21:40 runtime.cfg
-rw-r--r--  1 pi      pi      1714 Feb  1 19:25 tcp.cfg
-rw-r--r--  1 pi      pi       306 Dec 25 12:01 telegram.cfg
-rw-r--r--  1 openhab openhab  236 Jan 29 22:00 voicerss.cfg
-rw-r--r--  1 pi      pi       224 Feb 11 08:57 weather.cfg

There is only one modbus.cfg. I could of course openhab freshly install, but then I still do not know what the error was.

I suggest correcting the file ownership differences you find, so all files are owned by the user under which the openHAB server is running. While these files can be read by “other,” there may be others that cannot, or cannot be written.

I use a little shell alias:

$ cat ~pi/.bash_aliases
alias oh='sudo -u openhab'

and then prefix every command I want to do as the openhab user with oh, like

oh vi /etc/openhab2/services/mqtt.cfg

As for the source of the “ghost” entries in the configuration, I have no further suggestions at the moment, but would of course love to hear what the root cause is.


It works :slight_smile:

Following helps:

In Karaf Console config:del org.openhab.modbus. Then I made a small change in the modbus.cfg so that karaf noticed that has changed a bit. Karaf “read” the file and generate a new modbus.config. And tadaaaaa … no error.

Thanks for your help

1 Like