Events stop being processed after update to items file

Today I added the zwave binding, and installed HABmin to configure the Z-Wave devices.

All was going well until I noticed that none of my rules were firing - the scheduled cron rules were not getting executed, when a state change happened, the rules that should have fired did not.

After a restart everything was working again, so I shrugged it off and started making more changes, and then it happened again.

I was able to figure out that it happens any time that I update my items file, and the refresh triggers, I get this the file that I redirect all the output from starting up openHAB - so not one of the regular log files. I see this:

2015-12-19 21:19:30.753 [INFO ] [c.internal.ModelRepositoryImpl] - Refreshing model ‘default.items’
RXTX fhs_lock() Error: opening lock file: /var/lock/LCK…ttyUSB98: File exists. It is mine

testRead() Lock file failed

ttyUSB98 is an alias created by udev rules for my Aeon Z-Stick Gen5 that I also added today.

The 1.7.1 bindings that I have installed:

  • weather
  • serial
  • myopenhab

I also have installed HABmin 1.7.0, and the 1.8.0 zwave binding - I read somewhere that you need 1.8.0 for Gen5 Aeon Z-Stick, and that was what was also included with HABmin, so I went with it.

The reason that I have the serial binding is for using a MySensors gateway, which is connected at ttyUSB99.

I also have installed a custom action that reads in from a Google calendar, and publishes data from the entries as events - this action does not use the serial ports in any way.

Things that I have tried that have no effect:

  • Update the nrjavaserial jar to 3.11.0
  • Add the param to
  • Downgrade the zwave binding to 1.7.1
  • Configure openhab.cfg to use ttyACM0, instead of ttyUSB98

Things that I have tried that make the problem not happen:

  • Delete the /var/lock/LCK…ttyUSB98 file manually before touching the items file.
  • Don’t ever touch the items file.

Of note is that the LCK…ttyUSB99 file that is created by the serial binding for the MySensors gateway does not cause the same problem.

I do not believe there is a permissions problem, as I am running openhab as root (bad, I know, but I have not been able to make it work properly running as an openhab dedicated service user.)

I noted that the lock file is not re-created after I delete it - maybe this is the best way to fix the problem, just to have a CRON job delete the lock file.

Any suggestions or thoughts are greatly appreciated.

Well, so much for that - apparently manually removing the lock file does NOT fix the problem, it just removes the lock error, so that may be a red herring.

Turns out that I had a dormant bug that had nothing to do with Any of the above.

I had tried out the suggestion made that you should use a Ready type flag in all the rules to allow the persisted values time to be restored. So at system startup, set the Ready item to OFF, and a timer for X seconds to set Ready to ON.

Problem is that when the items file is refreshed because of changes, Ready gets reset to Undefined.

So I changed my Startup rule to set Ready to ON if OFF, do nothing if already ON, and else (undefined) set it to OFF, and then execute said rule via a Cron.

I solved the problem where rules and items get loaded before persistence has loaded by changing the polling period for each file type in openHAB.cfg so that rules don’t get loaded until well after Items and Persistence have finished loading. I found that to be simpler and more reliable than the Ready switch trick.

My values are as follows. You can experiment with times that work better for your setup.