This page last changed on Mar 02, 2015 by berndl.

I have made some timer rules for my KNX Installation.
This works only from time to time, if any.
There is an information on the openeremote webpage that one should re-boot the controller after every change of rules.
But what does this mean - rebooting?
I have tried to close the controller and restart it - no result
Then I have reboot my QNAP Server - the same result.
So my question is. What does it mean to re-boot the controller and how is it done?

Thank you in advance
Bernd

For a NAS rebooting of the controller is equivalent to restart the package, i.e. stop Openremote -> start Openremote.

Posted by aktur at Mar 03, 2015 11:40

Thank you for your answer, but it did not work.
Then I have reinstalled the controller and restart ist and reboot it some times - it did not work, although the devices and command I can control from my Iphone.
May be there is something wrong in the rule?
Here is the simple rule:

package org.openremote.controller.protocol

global org.openremote.controller.statuscache.CommandFacade execute;
global org.openremote.controller.statuscache.SwitchFacade switches;

rule "AZ Lampe an 17:00 Uhr"

timer (cron: 0 0 17 * * ?) when eval (true) then

execute.command("Lampe AZ (ON)");

end

Posted by berndl at Mar 03, 2015 16:02

1. Check if the rule file is compiled without any errors by inspecting boot.log;
2. In case 1 is OK, check if the rule is executed, either by adding print statement to the rule and examine the console output or adding log function and inspecting for example dev.log.

  • adding print statement - include following line in rule body (between then and end)
      System.out.println("Drools rule:\""+drools.getRule().getName()+"\"");
    
  • adding log fuction
    import org.openremote.controller.utils.Logger;
    import org.openremote.controller.Constants;
    
    function void log(String msg)
    {
      Logger.getLogger(Constants.RUNTIME_EVENTPROCESSOR_LOG_CATEGORY + ".drools").debug(msg);
    }
    
    // and use it in the rule:
    rule "foo"
      timer (cron: 0 0 17 * * ?)
    then
      log("bar");
    end
    

    3. In case the rule is executed OK then inspect the command: execute.command("Lampe AZ (ON)");

  • check the spelling of the command name if it indeed matches the command which is executed - spelling errors here would be invisible;
  • if the spelling is OK and command is executed unreliably, for example the switch is operated by some radio protocol and you are in a noisy environment, then perhaps you need to take a special treatements of sending a radio command reliably as described in the blog.
Posted by aktur at Mar 04, 2015 05:44

Thank you again.
I tried but nothing happens.
I think that the problem is the synchronization.
Whereas all the switches and commands are synchronized this is not valid for the rules.

So I search on my QNAP System for the file modeler_rules.drl
I found it by:
/share/50014EE208740008_DATA/.qpkg/OpenRemote/OpenRemote/webapps/controller/rules/modeler_rules.drl

When I open it with vi modeler_rules.drl
it is empty only ∾ 's and the text: modeler-rules.drl 100% 0,00-01
What can I do?
Is it possible to edit the drl file directly without synchronization via the designer?

Thank you again

Bernd

Posted by berndl at Mar 05, 2015 14:29

Which version Java you use on your Qnap? At the forum wrote that the rules are working with version Java6 only.

Posted by aleksey_z at Mar 05, 2015 18:47

Thank you for help. I have Java 6.
But I have found a workaround
I edit the modeler_rules.drl directly on the NAS with vi
Then I restart the controller (off - on)

Then I found out that there was a time delay between the real time and the "cron" time of 1 hour
When I programmed 17:00 it starts at 18:00
(Whatever is the reason?). As I was too impatient I found out this very late.

Kind regards
Bernd

Posted by berndl at Mar 05, 2015 19:34

This has probably to do with file permissions. Openremote is unable to overwrite the modeler_rules.drl. You can fix it witch chown or/and with chmod command. Anyway, locally editing the modeler_rules.drl will work too, unless it is overwritten with the next design syncing.

Posted by aktur at Mar 05, 2015 20:29
Document generated by Confluence on Jun 05, 2016 09:33