This page last changed on Jan 27, 2016 by pierre2302.

Hi !

If I understand this function displays a phrase to the screen. I tried this rule but nothing is happening yet there is no load error in the log



package org.openremote.controller.protocol

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


import org.openremote.controller.utils.Logger;
import org.openremote.controller.Constants;
import org.openremote.controller.model.event.*;
import java.util.Date;
import java.text.SimpleDateFormat;


import java.lang.Float;
import java.sql.Timestamp;
import java.util.concurrent.TimeUnit;
import java.io.*;


rule "affichage"

 when

   Event( source == "chauffage_atelier_status" , value == "off" )

 then

   System.out.println ( "Chauffage eteint");

  end

There is an error in my rule ( I am sure of chauffage_atelier_status ) ?

Thank You

Hi,

Does rules work ?
You can test the rules by adding a test rule.
40 secs after starting the controller (or after redeploy) "Hello world." should be printed.

Succes.


rule "Print Timer"
timer (int: 40s)
when eval(true)
then
System.out.println("Hello World.");
end

Posted by sek at Jan 30, 2016 08:57

Hello

Thank you for your reply.

I tried the rule nothing is displayed and yet I have no error in the log.

What version of Java you use?

I'm using version 1.7 with drool modified file.

Posted by pierre2302 at Jan 30, 2016 17:43

Hi

I am using Java 1.8 on a Raspberry Pi.
What os do you use ?

The output is displayed on std out.

If you are running openremote in the background ("openremote.sh start")
you should find the line in logs/container/stderrout.log.
(there are so many logs

Otherwise on your screen (if started in the foreground ("openremote.sh run")).

I did also find out that the rules are not synchronised unless something else is changed within the Moduler.
(changing only rules and "Submit" them (on the right) (with or whithout using "Save") seems not be enough to sync with controller.)

The synced drl file is located in webapps/controller/rules/
Check if your file is indeed synced.

I also read somewhere that you have to restart the controller after changing rules.
So maybe rebooting everything will help ?
I don't seem to have that problem.

My rule with all the globals and whatever ...


package org.openremote.controller.model.event

global org.openremote.controller.statuscache.CommandFacade execute;
global org.openremote.controller.statuscache.SwitchFacade switches;
global org.openremote.controller.statuscache.LevelFacade levels;
global org.openremote.controller.statuscache.RangeFacade ranges;
import org.openremote.controller.protocol.*;

// just for test purpose
rule "Print Timer"

timer (int: 40s)

when eval(true)

then

System.out.println("Hallo Wereld!");

end

Posted by sek at Jan 30, 2016 19:09

Thank you for all the advice.

I use a raspberry with java 1.7 and drool modified file.

The rule works I found in logs/container/stderrout.log. I thought a message is displayed on the webconsole. ^^

Thank you

( I still have problems with the timer szene but I will open a new post )

Posted by pierre2302 at Jan 31, 2016 01:17
Document generated by Confluence on Jun 05, 2016 09:34