This page last changed on Aug 12, 2014 by gheinert.
This may be useful for people who are using a lot of Rules as part of their design.
As far as I know there is no easy way to debug rules. When editing rules within the designer it takes some time to download the rules to your controller and to restart the controller as all of your pictures etc are downloaded. Sometimes I've found that I edited rules in the designer and for some reason the downloaded copy was not updated. So I've found it easier to edit, write and test the rules on my own computer (running windows) rather than the designer. Once the rules are working on your windows machine you can copy them to your openremote setup on the Raspberry Pi etc..
Here is also a short script that helps with the writing of rules. Once the script is running you can just pressed "Alt" and "x" together and the controller restarts and the "boot.log" file is opened so you can see whether the rule engine has started normally or whether there are any syntax problems etc.
Another tip for rules: the rule engine is case sensitive and any small typos in the names of sensors or commands means that the rule will not work. To avoid this from happening I found it's best to copy and paste the sensor name etc from designer into my rule file.
The other tip for rules in to include the following line in your rule after "then":
This will print out the name of the rule in your TomCat window when it is fired.
Similarly you can use the following line after the then statement to display the values of variables, in this case $Ist.getValue()
So here is what I've done to make it easier to develop rules for your design. I am assuming Openremote is installed in C:\OpenRemote
1. Don't use the rules editor inside the Designer. Keep this blank
2. Place your rule file e.g. "rules.drl" into the directory: "C:\OpenRemote\webapps\controller\rules" The name of your file does not matter as long as it has the extension .drl. You can have your rules even in multiple *.drl file
3. Go to the directory C:\OpenRemote\bin. Create a shortcut to openremote.bat by right clicking on the file. Right click on the created "openremote.bat - Shortcut". Click on properties and change "Target" from "C:\OpenRemote\bin\openremote.bat" to "C:\OpenRemote\bin\openremote.bat start"
4. Download and Install SciTE4AutoHotkey from http://fincs.ahk4.net/scite4ahk/
5. Start the following Script in AutoHotKey:
run, "c:\OpenRemote\bin\openremote.bat - Shortcut.lnk"
run, notepad.exe C:\OpenRemote\logs\boot.log
Now you can edit your rule file "rules.drl" in Notepad. Once you have made your changes you just need to save the file "rules.drl" to the directory "C:\OpenRemote\webapps\controller\rules", you don't even need to close "rules.drl" in Notepad. Then press "Alt" and "x" together. The controller restarts and 10 seconds later the file "boot.log" is opened in notepads. You can check whether the rules engine has started and whether there are any syntax errors. Then you can test your rules.
If your controller takes longer than 10.000ms to start change the line sleep, 10000 as necessary in the AutoHot Key Script.
Maybe it helps somebody...