Sure, I have added the rules below. All of them are working now. However, the logs don’t show when they have been executed. I believe this is related to the fact that the system has somehow created three different log folders in the following paths:
~/openremote/webapps/controller/logs/
~/openremote/webapps/controller/WEB-INF/logs/
~/openremote/logs/
Any idea why this may be?
Here are the rules.
package
org.openremote.controller.protocol
import
org.openremote.controller.protocol.*;
import
org.openremote.controller.model.event.*;
import java.util.*;
import
java.util.regex.*;
global
org.openremote.controller.statuscache.CommandFacade execute;
global
org.openremote.controller.statuscache.SwitchFacade switches;
global
org.openremote.controller.statuscache.LevelFacade levels;
/*
--------------------- Sample rules -----------------------------------------*/
rule “binding
switches_ON” when
Event( source ==
“KitchenSwitch_Sensor”, value == “on” )
then
execute.command(
“Livingroom_Mainlight_ON” );
execute.command(
“ColorBulb_KC_Red”, 100 );
end
rule “binding
switches_OFF” when
Event( source ==
“KitchenSwitch_Sensor”, value == “off” )
then
execute.command(
“Livingroom_Mainlight_OFF” );
execute.command(
“ColorBulb_KC_Red”, 10 );
end
/--------------------------------Macros-------------------------------------------/
rule “Macro
Everything OFF” when
Event( source ==
“Macro_All_Off_STATUS”, value ==“on”)
then
execute.command(“Mode_FAN_AUTO_OFF”);
execute.command(“Macro_All_LightsON_OFF”);
execute.command(“KitchenSwitch_OFF”);
execute.command(“FrontLight_OFF”);
execute.command(“WemoSwitch_OFF”);
execute.command(“Outdoor_Light_Front_OFF”);
execute.command(“CeilingFan_MB_OFF”);
execute.command(“CeilingFan_GR_OFF”);
execute.command(“Livingroom_Mainlight_OFF”);
execute.command(“Gameroom_Mainlight_OFF”);
execute.command(“Livingroom_Lamps_OFF”);
execute.command(“Masterbedroom_Lights_OFF”);
execute.command(“Masterbedroom_Lamps_OFF”);
execute.command(“Masterbathroom_Dimmer_OFF”);
execute.command(“ZW_Lamp_Dimmer1_OFF”);
execute.command(“Patio_Light_OFF”);
execute.command(“Gameroom_TV_OFF”);
execute.command(“ZW_Lamp_Switch_1_OFF”);
end
rule “Macro All
Lights ON” when
Event( source ==
“Macro_All_LightsON_STATUS”, value ==“on”)
then
execute.command(“Macro_All_LightsOFF_OFF”);
execute.command(“KitchenSwitch_ON”);
execute.command(“FrontLight_ON”);
execute.command(“Outdoor_Light_Front_ON”);
execute.command(“Livingroom_Mainlight_ON”);
execute.command(“Gameroom_Mainlight_ON”);
execute.command(“Livingroom_Lamps_ON”);
execute.command(“Masterbedroom_Lights_ON”);
execute.command(“Masterbedroom_Lamps_ON”);
execute.command(“Masterbathroom_Dimmer_ON”);
execute.command(“ZW_Lamp_Dimmer1_ON”);
execute.command(“Patio_Light_ON”);
execute.command(“Macro_All_LightsON_OFF”);
end
rule “Macro All
Lights OFF” when
Event( source ==
“Macro_ALL_LightsOFF_STATUS”, value ==“on”)
then
execute.command(“Macro_All_LightsON_OFF”);
execute.command(“KitchenSwitch_OFF”);
execute.command(“FrontLight_OFF”);
execute.command(“Outdoor_Light_Front_OFF”);
execute.command(“Livingroom_Mainlight_OFF”);
execute.command(“Gameroom_Mainlight_OFF”);
execute.command(“Livingroom_Lamps_OFF”);
execute.command(“Masterbedroom_Lights_OFF”);
execute.command(“Masterbedroom_Lamps_OFF”);
execute.command(“Masterbathroom_Dimmer_OFF”);
execute.command(“ZW_Lamp_Dimmer1_OFF”);
execute.command(“Patio_Light_OFF”);
execute.command(“Macro_ALL_LightsOFF_OFF”);
end
/-------------------------------Modes
--------------------------------------/
rule “Mode
People At Home ON_Morning”
timer (cron: 0 0 7 *
execute.command(“Mode_PeopleAtHome_ON”);
end
/*-------- Eliminar
cuando estemos todos en la oficina
rule “Mode People At Home OFF_Morning”
timer (cron: 0 0 9 * * ?) when eval (true)
then
execute.command(“Mode_PeopleAtHome_OFF”);
end
rule “Mode People At Home ON_Afternoon”
timer (cron: 0 0 17 * * ?) when eval (true)
then
execute.command(“Mode_PeopleAtHome_ON”);
end
-----*/
rule “Mode
People At Home OFF_Afternoon”
timer (cron: 0 0 22
execute.command(“Mode_PeopleAtHome_OFF”);
end
/*
--------------------------- ceiling fan
rules --------------------------------
*/
rule “increase
speed ceiling fan when too hot”
when
Event( source
== “Multisensor_Living_Temp”,
value >= 80 )
Switch( source ==
“Mode_PeopleAtHome_STATUS”, value == “on”)
Switch( source ==
“Mode_FAN_AUTO_STATUS”, value == “on”)
then
execute.command(“CeilingFan_DIM”,
100 );
execute.command(“CeilingFan_MB_DIM”, 100 );
execute.command(“CeilingFan_GR_DIM”, 100 );
end
rule “increase
speed ceiling fan when hot” when
Event( source ==
“Multisensor_Living_Temp” , value >= 76 )
Switch( source ==
“Mode_PeopleAtHome_STATUS”, value == “on”)
Switch( source ==
“Mode_FAN_AUTO_STATUS”, value == “on”)
then
execute.command(“CeilingFan_DIM”,
50 );
execute.command(“CeilingFan_MB_DIM”, 50 );
execute.command(“CeilingFan_GR_DIM”, 50 );
end
rule “turn on
ceiling fan when temp is 74” when
Event( source ==
“Multisensor_Living_Temp” , value >= 74 )
Switch( source ==
“Mode_PeopleAtHome_STATUS”, value == “on”)
Switch( source ==
“Mode_FAN_AUTO_STATUS”, value == “on”)
then
execute.command(“CeilingFan_DIM”,
30 );
execute.command(“CeilingFan_MB_DIM”, 30 );
execute.command(“CeilingFan_GR_DIM”, 30 );
end
rule “increase
speed ceiling fan when NOT hot” when
Event( source
== “Multisensor_Living_Temp”,
value <= 72 )
Switch( source ==
“Mode_PeopleAtHome_STATUS”, value == “on”)
Switch( source ==
“Mode_FAN_AUTO_STATUS”, value == “on”)
then
execute.command(“CeilingFan_OFF”);
execute.command(“CeilingFan_MB_OFF”);
execute.command(“CeilingFan_GR_OFF”);
end
rule "ceiling
fans OFF at 10:00 PM "
timer (cron: 0 0 22 * * ?)
when
eval(true)
then
execute.command(“CeilingFan_OFF”);
execute.command(“CeilingFan_MB_OFF”);
execute.command(“CeilingFan_GR_OFF”);
end
/*
----------------------------------- Outdoor lights
---------------------------------------- */
rule “outdoor
light on” when
Event( source == “Sensor_MinToSunset”, value == 30 )
then
execute.command(“Outdoor_Light_Front_ON”);
execute.command(“Patio_Light_ON”);
end
rule “outdoor
light off”
timer (cron: 0 0 22
execute.command(“Outdoor_Light_Front_OFF”);
execute.command(“Patio_Light_OFF”);
end
/*
-----------------------------------Indoor
lights------------------------------------*/
rule “kitchen
light on”
when
Event( source == “Sensor_MinToSunset”, value == 30 )
then
execute.command(“Gameroom_Lamps_ON”);
execute.command(“Livingroom_Lamps_ON”);
execute.command(“KitchenSwitch_ON”);
execute.command(“ZW_Lamp_Dimmer1_DIM”, 50 );
execute.command(
“ColorBulb_KC_ON”);
execute.command(
“ColorBulb_KC_W_White”, 0 );
execute.command(
“ColorBulb_KC_C_White”, 0 );
execute.command(
“ColorBulb_KC_Green”, 50 );
execute.command(
“ColorBulb_KC_Red”, 100 );
execute.command(
“ColorBulb_KC_Blue”, 10 );
end
rule “kitchen
light off”
timer (cron: 0 30 22
execute.command(
“ColorBulb_KC_OFF”);
execute.command(“KitchenSwitch_OFF”);
execute.command(“Livingroom_Lamps_OFF”);
execute.command(“Masterbathroom_Dimmer_OFF”);
end
/*
----------------------------- Fountain Rules
---------------------------------------*/
rule " Fountain
off"
timer (cron: 0 30 22
execute.command(“ZW_Lamp_Switch_1_OFF”);
end