This page last changed on Aug 01, 2013 by mcfanda.


I'm trying the following :

global org.openremote.controller.statuscache.CommandFacade execute;
global org.openremote.controller.statuscache.SwitchFacade switches;
import org.openremote.controller.protocol.Event;

import java.lang.String 
import org.openremote.controller.utils.Logger;
import org.openremote.controller.Constants;

function void setAlarm()

with no luck. Error is

setAlarm : Function Compilation error setAlarm (line:25): execute cannot be resolved]

execute.command("MyCommand") works fine in normal rules.

I'm not sure if the globals are visible from functions. Would need to investigate.

Posted by juha at Aug 24, 2013 14:48

Can execute.command be called in a different way from the inside of a function to get the example above working?

Posted by drolli at Nov 22, 2013 17:07

Instead of writing a function, write a rule for the set of tasks that you want to perform.

Posted by atamariya at Nov 24, 2013 08:41

Eventually it's all java, so I believe you could write

private void setAlarm()
instead, defining a method and call that from your rule.

Posted by ebariaux at Nov 24, 2013 09:02

The problem is function resolves to a static method in Java which doesn't have access to instance variables (execute in this case).

Posted by atamariya at Nov 24, 2013 12:39
Document generated by Confluence on Jun 05, 2016 09:41