OpenHAB 2 Rule warmup Script (Raises the WAF)

Hi I came up with an idea to “precompile” rule files after openHAB was started or a rules file was refreshed. This is working for OH2 only, because OH2 is “compiling” a complete rules file, if one rule was triggered. In OH1 each single rule was compiled separately. With OH1 I used to trigger each rule once, after editing it, to be sure my girlfriend has a good experience with our home automation setup and each button press will result in an immediate response. As a result I was running 10 minutes through our house to press every single wall switch combination.
With OH2 it takes a huge amount of time if you trigger a rule from a big rules file, but you have to trigger only a single rule to compile all at once.

Now in OH2 all you have to do is creating a rule in each rules file which triggers itselfs and voila, all rules are “precompiled”. System started event is triggered in every rule if openHAB starts or a rule file was touched. That’s it. Works very well and full automatic. Never ever worry about bad first response times anymore.

//### Rule warmup
rule "default.rules loaded Event"
when
	System started
then
	logInfo("Warmup","default.rules warmup completed")
end
6 Likes

Hey,

I just found this hint and tried it. Sadly, I did not notice any improvment.
Rules always take their time for the first time they run.

I’m on Openhab2 2.2 stable.

I noticed this too. I think something was changed. Because I have sirious problems that openhab service freezing with current version I gone back to the previous one, which is 2.0 I think.

For me in version 2.1 warmup script is working as intended. I had installed everything from startup (openhabian).