rule "status_volet_salon" when
Event( source == "ZWay_2_0_4", value <= "10" )
then
execute.command( "virtual_volet_salon_status", 0 );
else
execute.command( "virtual_volet_salon_status", 1 );
end
rule "02-10VMB7IN_8_Status"
when
$evt:Event(source matches "02-10VMB7IN_8_Status", $source : source) // NOTE SENSOR NAME IS WHAT IS BEING COMPARED HERE
then
String buttonStatus = $evt.getValue().toString();
boolean isActive = buttonStatus != null && buttonStatus.equalsIgnoreCase("Pressed"); // Replace "Pressed" with your march
System.out.println("Event Status Change '" + $source + "': " + buttonStatus); // Optional
if (isActive)
{
execute.command("Relay 01 Virtual", "ON");
}
else
{
execute.command("Relay 01 Virtual", "OFF");
}
end
rule "status_volet_salon" when
$evt:Event( source == "ZWay_2_0_4", $source : source )
then
String event = $evt.getValue().toString(); // Should the source be converted to a string? Should it be a Int if you want to calculate a result?
boolean isActive = event != null && event.equalsIgnoreCase("Pressed"); // Replace all this with your match or condition. (I'm not sure it works this way)
if (isActive)
{
execute.command( "virtual_volet_salon_status", 0 );
}
else
{
execute.command( "virtual_volet_salon_status", 1 );
}
end
When you get a good result, would you be kind enough to post your working code here so that I can copy and paste it into the examples?
//Package, globals, imports
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.*;import java.util.*;import java.util.regex.*;
rule "status_volet_salon" when
Event( source == "ZWay_2_0_4" )
if ( value > "10 ") break[on]
then
execute.command( "virtual_volet_salon_status", 0 );
then[on]
execute.command( "virtual_volet_salon_status", 1 );
end
//Package, globals, imports
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.*;import java.util.*;import java.util.regex.*;
rule "status_volet_salon" when
Event( source == "ZWay_2_0_4" )
if ( eval(Integer.parseInt(value.toString()) > 10 ) break[on]
then
execute.command( "virtual_volet_salon_status", 0 );
then[on]
execute.command( "virtual_volet_salon_status", 1 );
end