Java Runtime Environment: Java SE Runtime Environment build 1.8.0_152_b16
openHAB version: 2.2.0, #1069
Issue of the topic: When I start Openhab I receive following notification. Is something wrong with the syntax?
2017-11-14 07:19:57.298 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'mysensors1.rules', using it anyway:
The operator '==' should be replaced by '===' when null is one of the arguments.
This expression is not allowed in this context, since it doesn't cause any side effects.
The operator '==' should be replaced by '===' when null is one of the arguments.
var Timer timer = null
rule "Hall-living LED Light on motion ON"
when
Item livhallmot2001 changed from 0 to 1
then
if(timer == null && WalllightsStatus.state == ON) {
relunderstair0103.sendCommand(ON)
timer = createTimer(now.plusSeconds(60)) [|
relunderstair0103.sendCommand(OFF)
timer == null // reset the timer
]
}
else {
timer.reschedule(now.plusSeconds(60))
}
end
@ei_Gelb_Geek thank you; I figured out === requirement.
The rule loads now fine; the only issue I still have is that during daytime (WalllightsStatus == OFF) it gives following error:
2017-11-18 06:47:19.963 [DEBUG] [ensors.handler.MySensorsThingHandler] - Updating channel: tripped(V_TRIPPED) value to: OPEN
2017-11-18 06:47:19.971 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Hall-living LED Light on motion ON': cannot invoke method public abstract boolean org.eclipse.smarthome.model.script.actions.Timer.reschedule(org.joda.time.base.AbstractInstant) on null
Current sketch
//Timer living-hall led light
var Timer hallledtimer = null
rule "Hall-living LED Light on motion ON"
when
Item livhallmot2001 changed from CLOSED to OPEN
then
if(hallledtimer === null && WalllightsStatus.state == ON) {
relunderstair0103.sendCommand(ON)
hallledtimer = createTimer(now.plusSeconds(60)) [|
relunderstair0103.sendCommand(OFF)
hallledtimer = null // reset the timer
]
}
else {
hallledtimer.reschedule(now.plusSeconds(60)) //if motion is triggered while light is on, reschedule timer
}
end
//Timer living-hall led light
var Timer hallledtimer = null
rule "Hall-living LED Light on motion ON"
when
Item livhallmot2001 changed from CLOSED to OPEN
then
if(hallledtimer === null && WalllightsStatus.state == ON) {
relunderstair0103.sendCommand(ON)
hallledtimer = createTimer(now.plusSeconds(60)) [|
relunderstair0103.sendCommand(OFF)
hallledtimer = null // reset the timer
]
}
else {
if (WalllightsStatus.state == ON) hallledtimer.reschedule(now.plusSeconds(60)) //if motion is triggered while light is on, reschedule timer
}
end