package org.openremote.controller.protocolglobal org.openremote.controller.statuscache.CommandFacade execute;global org.openremote.controller.statuscache.SwitchFacade switches;import java.util.*;import java.util.regex.*;
rule "Forward Mood Switch Turn Devices On" when Event( source == "Node 16 On/Off", value == "on" ) then execute.command("Node 15 (ON)"); end
rule "Forward Mood Switch Turn Chandelier Off" when Event( source == "Node 16 On/Off", value == "off" ) then execute.command("Node 15 (OFF)"); end
rule "Forward Mood Switch Match Dim Level" when Event( source == "Node 16 On/Off", value == "on" ) Event( source == "Node 16 Dimmer", $val : value ) then String valStr = $val.toString(); if (valStr != null ) { execute.command( "Node 15 Dimmer", valStr ); } end
Would this work ???
rule "Forward Mood Switch Match Dim Level"
when
rule "Forward Mood Switch Match Dim Level"
when
Event( source == "Node 16 Dimmer", $val : value )
then
String valStr = $val.toString();
if (valStr != null )
{
execute.command( "Node 15 Dimmer Set", valStr );
}
end
rule "Forward Mood Switch Match Dim Level" when
Event( source == "Node 16 On/Off", value == "on" )
Event( source == "Node 16 Dimmer", $val:value ) then String valStr = $val.toString(); if (valStr != null ) {
execute.command( "Node 15 Dim", valStr ); } end
global org.openremote.controller.statuscache.LevelFacade level;
Michal pointed out an interesting detail on a different forum topic....
The sensor you have created for the dimmer level, is it a "LEVEL" or "RANGE" type, or did you use a "CUSTOM" type.
"LEVEL" & "RANGE" are integer
"CUSTOM" are string.
(I don't know if this will make a difference,, but it might)
On a similar theme, I had a set of rules that didn't work recently which turned out to be that I'd used a lower case S, where it should have been in upper case.
Have you tried using an in-memory command and sensor to display any output in your UI ?
Have you looked at the ...../logs/rules/rules.log file to see if there are any issues?
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 level;
import org.openremote.controller.protocol.*;
import java.util.*;import java.util.regex.*;