hey guys im trying to get the office lights working with a motion sensor and also time of day.
my current rule shown the following in the logs.
2019-01-02 10:28:16.387 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'Test.rules', using it anyway:
This expression is not allowed in this context, since it doesn't cause any side effects.
This expression is not allowed in this context, since it doesn't cause any side effects.
This expression is not allowed in this context, since it doesn't cause any side effects.
This expression is not allowed in this context, since it doesn't cause any side effects.
This expression is not allowed in this context, since it doesn't cause any side effects.
This expression is not allowed in this context, since it doesn't cause any side effects.
This expression is not allowed in this context, since it doesn't cause any side effects.
This expression is not allowed in this context, since it doesn't cause any side effects.
This expression is not allowed in this context, since it doesn't cause any side effects.
This expression is not allowed in this context, since it doesn't cause any side effects.
This expression is not allowed in this context, since it doesn't cause any side effects.
This expression is not allowed in this context, since it doesn't cause any side effects.
2019-01-02 10:28:16.662 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'Test.rules'
hereâs the current rule file.
val int OfficeTimeoutMinutesMorning = 60
val int OfficeTimeoutMinutesDay = 60
val int OfficeTimeoutMinutesAfternoon = 60
val int OfficeTimeoutMinutesEvening = 60
val int OfficeTimeoutMinutesNight = 60
val int OfficeTimeoutMinutesBed = 5
val int EntryTimeoutMinutesBed = 2
val int EntryTimeoutMinutesOther = 30
var Timer OfficeLightsTimer = null
var Timer EntryLightsTimer = null
rule "Turn On Office Lights Auto Bypass"
when
Item Office_Lights changed or
Item Office_Lamp_Left changed or
Item Office_Lamp_Back changed or
Item Office_Lamp_Right changed
then
sendCommand(BYPASS_Office_LightsTimer, ON)
end
rule "Office Light Timer"
when
Item Office_Motion received update ON
then
if ((OfficeLightsTimer === null) && (vTimeOfDay.state == "MORNING") && (BYPASS_Office_LightsTimer == "OFF")) {
sendCommand(Office_Lights, "100")
sendCommand(Office_Lamp_Left_Temp, "60")
sendCommand(Office_Lamp_Back_Temp, "60")
sendCommand(Office_Lamp_Right_Temp, "60")
Thread::sleep(300)
sendCommand(Office_Lamp_Left, "100")
sendCommand(Office_Lamp_Back, "100")
sendCommand(Office_Lamp_Right, "100")
postUpdate(All_Lights, ON)
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer = createTimer(now.plusMinutes(OfficeTimeoutMinutesMorning ), [|
sendCommand(Office_Lamp_Left, "OFF")
sendCommand(Office_Lamp_Back, "OFF")
sendCommand(Office_Lamp_Right, "OFF")
sendCommand(Office_Lights, "OFF")
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer = null
])
}
else {
if((vTimeOfDay.state == "MORNING") && (BYPASS_Office_LightsTimer == "OFF")) {
sendCommand(Office_Lights, "100")
sendCommand(Office_Lamp_Left_Temp, "60")
sendCommand(Office_Lamp_Back_Temp, "60")
sendCommand(Office_Lamp_Right_Temp, "60")
Thread::sleep(300)
sendCommand(Office_Lamp_Left, "100")
sendCommand(Office_Lamp_Back, "100")
sendCommand(Office_Lamp_Right, "100")
postUpdate(All_Lights, ON)
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer(now.plusMinutes(OfficeTimeoutMinutesMorning ))
}
}
if ((OfficeLightsTimer === null) && (vTimeOfDay.state == "DAY") && (BYPASS_Office_LightsTimer == "OFF")) {
sendCommand(Office_Lights, "100")
sendCommand(Office_Lamp_Left_Temp, "30")
sendCommand(Office_Lamp_Back_Temp, "30")
sendCommand(Office_Lamp_Right_Temp, "30")
Thread::sleep(300)
sendCommand(Office_Lamp_Left, "100")
sendCommand(Office_Lamp_Back, "100")
sendCommand(Office_Lamp_Right, "100")
postUpdate(All_Lights, ON)
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer = createTimer(now.plusMinutes(OfficeTimeoutMinutesDay ), [|
sendCommand(Office_Lamp_Left, "OFF")
sendCommand(Office_Lamp_Back, "OFF")
sendCommand(Office_Lamp_Right, "OFF")
sendCommand(Office_Lights, "OFF")
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer = null
])
}
else {
if((vTimeOfDay.state == "DAY") && (BYPASS_Office_LightsTimer == "OFF")) {
sendCommand(Office_Lights, "100")
sendCommand(Office_Lamp_Left_Temp, "30")
sendCommand(Office_Lamp_Back_Temp, "30")
sendCommand(Office_Lamp_Right_Temp, "30")
Thread::sleep(300)
sendCommand(Office_Lamp_Left, "100")
sendCommand(Office_Lamp_Back, "100")
sendCommand(Office_Lamp_Right, "100")
postUpdate(All_Lights, ON)
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer(now.plusMinutes(OfficeTimeoutMinutesDay ))
}
}
if ((OfficeLightsTimer === null) && (vTimeOfDay.state == "AFTERNOON") && (BYPASS_Office_LightsTimer == OFF)) {
sendCommand(Office_Lights, "100")
sendCommand(Office_Lamp_Left_Temp, "30")
sendCommand(Office_Lamp_Back_Temp, "30")
sendCommand(Office_Lamp_Right_Temp, "30")
Thread::sleep(300)
sendCommand(Office_Lamp_Left, "100")
sendCommand(Office_Lamp_Back, "100")
sendCommand(Office_Lamp_Right, "100")
postUpdate(All_Lights, ON)
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer = createTimer(now.plusMinutes(OfficeTimeoutMinutesAfternoon ), [|
sendCommand(Office_Lamp_Left, "OFF")
sendCommand(Office_Lamp_Back, "OFF")
sendCommand(Office_Lamp_Right, "OFF")
sendCommand(Office_Lights, "OFF")
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer = null
])
}
else {
if((vTimeOfDay.state == "AFTERNOON") && (BYPASS_Office_LightsTimer == OFF)) {
sendCommand(Office_Lights, "100")
sendCommand(Office_Lamp_Left_Temp, "30")
sendCommand(Office_Lamp_Back_Temp, "30")
sendCommand(Office_Lamp_Right_Temp, "30")
Thread::sleep(300)
sendCommand(Office_Lamp_Left, "100")
sendCommand(Office_Lamp_Back, "100")
sendCommand(Office_Lamp_Right, "100")
postUpdate(All_Lights, ON)
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer(now.plusMinutes(OfficeTimeoutMinutesAfternoon ))
}
}
if ((OfficeLightsTimer === null) && (vTimeOfDay.state == "EVENING") && (BYPASS_Office_LightsTimer == OFF)) {
sendCommand(Office_Lights, "100")
sendCommand(Office_Lamp_Left_Temp, "40")
sendCommand(Office_Lamp_Back_Temp, "40")
sendCommand(Office_Lamp_Right_Temp, "40")
Thread::sleep(300)
sendCommand(Office_Lamp_Left, "100")
sendCommand(Office_Lamp_Back, "100")
sendCommand(Office_Lamp_Right, "100")
postUpdate(All_Lights, ON)
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer = createTimer(now.plusMinutes(OfficeTimeoutMinutesEvening ), [|
sendCommand(Office_Lamp_Left, "OFF")
sendCommand(Office_Lamp_Back, "OFF")
sendCommand(Office_Lamp_Right, "OFF")
sendCommand(Office_Lights, "OFF")
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer = null
])
}
else {
if((vTimeOfDay.state == "EVENING") && (BYPASS_Office_LightsTimer == OFF)) {
sendCommand(Office_Lights, "100")
sendCommand(Office_Lamp_Left_Temp, "40")
sendCommand(Office_Lamp_Back_Temp, "40")
sendCommand(Office_Lamp_Right_Temp, "40")
Thread::sleep(300)
sendCommand(Office_Lamp_Left, "100")
sendCommand(Office_Lamp_Back, "100")
sendCommand(Office_Lamp_Right, "100")
postUpdate(All_Lights, ON)
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer(now.plusMinutes(OfficeTimeoutMinutesEvening ))
}
}
if ((OfficeLightsTimer === null) && (vTimeOfDay.state == "NIGHT") && (BYPASS_Office_LightsTimer == OFF)) {
sendCommand(Office_Lights, "100")
sendCommand(Office_Lamp_Left_Temp, "60")
sendCommand(Office_Lamp_Back_Temp, "60")
sendCommand(Office_Lamp_Right_Temp, "60")
Thread::sleep(300)
sendCommand(Office_Lamp_Left, "100")
sendCommand(Office_Lamp_Back, "100")
sendCommand(Office_Lamp_Right, "100")
postUpdate(All_Lights, ON)
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer = createTimer(now.plusMinutes(OfficeTimeoutMinutesNight ), [|
sendCommand(Office_Lamp_Left, "OFF")
sendCommand(Office_Lamp_Back, "OFF")
sendCommand(Office_Lamp_Right, "OFF")
sendCommand(Office_Lights, "OFF")
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer = null
])
}
else {
if((vTimeOfDay.state == "NIGHT") && (BYPASS_Office_LightsTimer == OFF)) {
sendCommand(Office_Lights, "100")
sendCommand(Office_Lamp_Left_Temp, "60")
sendCommand(Office_Lamp_Back_Temp, "60")
sendCommand(Office_Lamp_Right_Temp, "60")
Thread::sleep(300)
sendCommand(Office_Lamp_Left, "100")
sendCommand(Office_Lamp_Back, "100")
sendCommand(Office_Lamp_Right, "100")
postUpdate(All_Lights, ON)
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer(now.plusMinutes(OfficeTimeoutMinutesNight ))
}
}
if ((OfficeLightsTimer === null) && (vTimeOfDay.state == "BED") && (BYPASS_Office_LightsTimer == OFF)) {
sendCommand(Office_Lights, "100")
sendCommand(Office_Lamp_Left_Temp, "60")
sendCommand(Office_Lamp_Back_Temp, "60")
sendCommand(Office_Lamp_Right_Temp, "60")
Thread::sleep(300)
sendCommand(Office_Lamp_Left, "100")
sendCommand(Office_Lamp_Back, "100")
sendCommand(Office_Lamp_Right, "100")
postUpdate(All_Lights, ON)
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer = createTimer(now.plusMinutes(OfficeTimeoutMinutesBed ), [|
sendCommand(Office_Lamp_Left, "OFF")
sendCommand(Office_Lamp_Back, "OFF")
sendCommand(Office_Lamp_Right, "OFF")
sendCommand(Office_Lights, "OFF")
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer = null
])
}
else {
if((vTimeOfDay.state == "BED") && (BYPASS_Office_LightsTimer == "OFF")) {
sendCommand(Office_Lights, "100")
sendCommand(Office_Lamp_Left_Temp, "60")
sendCommand(Office_Lamp_Back_Temp, "60")
sendCommand(Office_Lamp_Right_Temp, "60")
Thread::sleep(300)
sendCommand(Office_Lamp_Left, "100")
sendCommand(Office_Lamp_Back, "100")
sendCommand(Office_Lamp_Right, "100")
postUpdate(All_Lights, ON)
createTimer(now.plusSeconds(2), [ |
postUpdate(BYPASS_Office_LightsTimer, OFF)
])
OfficeLightsTimer(now.plusMinutes(OfficeTimeoutMinutesBed ))
}
}
end
rule "Back Yard Light Timer"
when
Item Patio_Motion changed from OFF to ON
then
if ((Someones_Home.state == ON) && (vTimeOfDay.state == "MORNING"))
{
sendCommand(HueBackYardColour, 100)
sendCommand(HueBackYardTemp, 60)
createTimer(now.plusMinutes(30), [ |
sendCommand(HueBackYardColour, OFF)
])
}
if ((Someones_Home.state == ON) && (vTimeOfDay.state == "AFTERNOON"))
{
sendCommand(HueBackYardColour, 100)
sendCommand(HueBackYardTemp, 60)
createTimer(now.plusMinutes(60), [ |
sendCommand(HueBackYardColour, OFF)
])
}
if ((Someones_Home.state == ON) && (vTimeOfDay.state == "EVENING"))
{
sendCommand(HueBackYardColour, 100)
sendCommand(HueBackYardTemp, 60)
createTimer(now.plusMinutes(60), [ |
sendCommand(HueBackYardColour, OFF)
])
}
if ((Someones_Home.state == ON) && (vTimeOfDay.state == "NIGHT"))
{
sendCommand(HueBackYardColour, 100)
sendCommand(HueBackYardTemp, 60)
createTimer(now.plusMinutes(60), [ |
sendCommand(HueBackYardColour, OFF)
])
}
if ((Someones_Home.state == ON) && (vTimeOfDay.state == "BED"))
{
sendCommand(HueBackYardColour, 100)
sendCommand(HueBackYardTemp, 60)
createTimer(now.plusMinutes(60), [ |
sendCommand(HueBackYardColour, OFF)
])
}
end
rule "Entry Lights"
when
Item Entry_Motion received command ON
then
if ((EntryLightsTimer === null) && (vTimeOfDay.state == "MORNING")) {
sendCommand(Entrance_Lights, ON)
EntryLightsTimer = createTimer(now.plusMinutes(EntryTimeoutMinutesOther ), [|
sendCommand(Entrance_Lights, OFF)
EntryLightsTimer = null
])
}
else {
if(vTimeOfDay.state == "MORNING") {
sendCommand(Entrance_Lights, ON)
OfficeLightsTimer(now.plusMinutes(EntryTimeoutMinutesOther ))
}
}
if ((EntryLightsTimer === null) && (vTimeOfDay.state == "DAY")) {
sendCommand(Entrance_Lights, ON)
EntryLightsTimer = createTimer(now.plusMinutes(EntryTimeoutMinutesOther ), [|
sendCommand(Entrance_Lights, OFF)
EntryLightsTimer = null
])
}
else {
if(vTimeOfDay.state == "DAY") {
sendCommand(Entrance_Lights, ON)
OfficeLightsTimer(now.plusMinutes(EntryTimeoutMinutesOther ))
}
}
if ((EntryLightsTimer === null) && (vTimeOfDay.state == "AFTERNOON ")) {
sendCommand(Entrance_Lights, ON)
EntryLightsTimer = createTimer(now.plusMinutes(EntryTimeoutMinutesOther ), [|
sendCommand(Entrance_Lights, OFF)
EntryLightsTimer = null
])
}
else {
if(vTimeOfDay.state == "AFTERNOON") {
sendCommand(Entrance_Lights, ON)
OfficeLightsTimer(now.plusMinutes(EntryTimeoutMinutesOther ))
}
}
if ((EntryLightsTimer === null) && (vTimeOfDay.state == "EVENING")) {
sendCommand(Entrance_Lights, ON)
EntryLightsTimer = createTimer(now.plusMinutes(EntryTimeoutMinutesOther ), [|
sendCommand(Entrance_Lights, OFF)
EntryLightsTimer = null
])
}
else {
if(vTimeOfDay.state == "EVENING") {
sendCommand(Entrance_Lights, ON)
OfficeLightsTimer(now.plusMinutes(EntryTimeoutMinutesOther ))
}
}
if ((EntryLightsTimer === null) && (vTimeOfDay.state == "NIGHT")) {
sendCommand(Entrance_Lights, ON)
EntryLightsTimer = createTimer(now.plusMinutes(EntryTimeoutMinutesOther ), [|
sendCommand(Entrance_Lights, OFF)
EntryLightsTimer = null
])
}
else {
if(vTimeOfDay.state == "NIGHT") {
sendCommand(Entrance_Lights, ON)
OfficeLightsTimer(now.plusMinutes(EntryTimeoutMinutesOther ))
}
}
if ((EntryLightsTimer === null) && (vTimeOfDay.state == "BED")) {
sendCommand(Entrance_Lights, ON)
EntryLightsTimer = createTimer(now.plusMinutes(EntryTimeoutMinutesBed ), [|
sendCommand(Entrance_Lights, OFF)
EntryLightsTimer = null
])
}
else {
if(vTimeOfDay.state == "BED") {
sendCommand(Entrance_Lights, ON)
OfficeLightsTimer(now.plusMinutes(EntryTimeoutMinutesBed ))
}
}
end
the rule isnât firing at all even all of the conditions are met eg vTimeOfDay.state is currently DAY\ & BYPASS_Office_LightsTimer is currently OFF
can anyone help?