This page last changed on May 31, 2015 by garitron.

****Using command "Get Fan1 T" with 1-wire, DS18B20, temperature, F, 1s poll.
****Using Sensor: "Fan1 T" invoking "Get Fan1 T" command with custom & no Custom State items.

****This does not work:

package org.openremote.controller.protocol
global org.openremote.controller.statuscache.CommandFacade execute;
global org.openremote.controller.statuscache.SwitchFacade switches;
import org.openremote.controller.protocol.*;
import org.openremote.controller.model.event.*;
import java.lang.Float;

rule "Fan1 ON by T"
when
CustomState(source == "Fan1 T",
Float.valueOf(value) > 100f && Float.valueOf(value) < 150f)
then
execute.command("Sw Fan1 ON");
end

****Produces these errors:

ERROR 2015-05-30 15:51:06,697 : ERR 101 Line 11:21 no viable alternative at input 'value' in rule "Fan1 ON by T" in pattern CustomState
ERROR 2015-05-30 15:51:06,697 : ERR 101 Line 11:59 no viable alternative at input ')' in rule "Fan1 ON by T" in pattern CustomState in pattern Float.valueOf

****What does "no viable alternative" mean??

****This works:

package org.openremote.controller.protocol
global org.openremote.controller.statuscache.CommandFacade execute;
global org.openremote.controller.statuscache.SwitchFacade switches;
import org.openremote.controller.protocol.*;
import org.openremote.controller.model.event.*;
import java.lang.Float;

rule "Fan1 ON by T"
when
CustomState(source == "Fan1 T",
eval(Float.valueOf(value) > 100f) && eval(Float.valueOf(value) < 150f))
then
execute.command("Sw Fan1 ON");
end

****I'm not a Java programmer, but my 1098 page Java book (Thinking In Java; Eckel) does not describe an "eval" function.
****Neither can I find an example/requirement for its use in the OR documentation... I found an example after extensive
****perusal of the forum posts....

****Apparently the Drools rules are just Java in disguise. True? ... except for some "extras"... where are the "extras" documented?

Document generated by Confluence on Jun 05, 2016 09:33