Openhab doesn’t seem to notice the rules in my case. When buttons are pushed and so, no openhab rules are executed, even if I see them being loaded in openhab.log at startup:
2016-07-23 20:10:14.827 [INFO ] [.o.io.habmin.HABminApplication] - Started HABmin REST API at /services/habmin
2016-07-23 20:10:19.292 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'zzz_Alles.rules’
2016-07-23 20:10:19.506 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'AT_Bureau.rules’
2016-07-23 20:10:19.531 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'WO_badkamer.rules’
2016-07-23 20:10:19.551 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'zzz_SpecifiekeTijden.rules’
2016-07-23 20:10:19.610 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'WO_Inkom.rules’
2016-07-23 20:10:19.624 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'WO_Hal.rules’
2016-07-23 20:10:19.638 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'AT_Polyvalent.rules’
2016-07-23 20:10:19.662 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'WO_kelder.rules’
2016-07-23 20:10:19.694 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'WO_Leefruimte.rules’
2016-07-23 20:10:19.708 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'zzz_Specialekes.rules’
2016-07-23 20:10:19.736 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'zzz_Bezoek.rules’
2016-07-23 20:10:19.767 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'WO_ouderkamer.rules’
2016-07-23 20:10:19.789 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model ‘WO_Kinderkamer.rules’
I found a small workaround to get this working:
Move all rules to /tmp/
Restart the service openhab
Copy the rules back from /tmp/ to /etc/openhab/configuration/rules/
Not sure why, but it seems to me that the rules are loaded to fast.
Which version of OH are you using? It looks like OH 1.x but I’m not super familiar with OH2 logs so can’t be sure.
Add some logInfo statements to your rules, as the first line. If you don’t see these logging statements in the log then you know the rule isn’t running. If you see the logging statement you know that the rule is failing.
You can probably do this more simply but just running sudo touch /etc/openhab/configurations/rules/*.rules
I’d like to revive his old thread. Running OH 2.5.6
After a reboot everything seemed to work fine. However, one of my rules files only worked partially. Some events triggerd, others didn’t.
The really strange this is, this worked:
Member of gLights changed to ON
while this did not:
Member of gLights_TIMER received command OFF
As the very first line inside my rules does always run “logInfo” I know this didn’t trigger at all.
Only when I opened and saved the *.rules file, the rule triggered successfully. Known issue?
It’s going to be one of the horrid file loading race issues openHAB is plagued by.
I would guess your rule was originally loaded before the Group Item was fully populated. Behind the scenes, the Member of triggers build a list of individual Items, so it relies on all members being present at rule load time.
You’ll find several threads about techniques to “touch” rule files after a delay, and openhabian includes a copy-away-and-back function.
These are just circumventions of course.
That would have been a better choice. Any post that isn’t a tutorial and you are asking about that tutorial or a post that is more than a couple months since the last post should go into a new thread. We actually enabled thread aging where a thread will be closed one month after the last activity, but we couldn’t apply it retroactively.
As rossko57 indicates, there are lots of posts and there is an menu option in openhabian-config if you are running openHABian to apply a fix.
If running the Next Gen-Rules Engine (which will become just “The Rules Engine” in OH 3 does not have this problem.
Probably your best place to start is [beta testers wanted!] Jython addon w/ helper libraries (requires OH 2.5.x) which will get you started in Jython. If you want to use the web UI for rules development, I would probably wait until OH 3 stabilizes and is released. According to the latest announcement, that should be by the end of the year.