I am new to OpenHab. I am using all Insteon devices. I have two motion sensors that I would like to use to control dimmers. The idea is when motion is detected the light comes on and remains on until I leave the room. I for testing purposes I have set the Insteon Motion Sensor’s Automatic “Off” Countdown to the minimum 30 seconds.
My current rule looks like this:
rule "Erin's Office light motion"
when
Item Erin_Office_Motion changed to OPEN
then
if (Erin_Office_Motion_Timer==null) {
// motion detected
sendCommand(Erin_Office_Dimmer, 100)
logInfo("Erin's Office","Starting timer for turning off the lights")
Erin_Office_Motion_Timer = createTimer(now.plusMinutes(1))[|
logInfo("Erin's Office","Turning lights off")
sendCommand(Erin_Office_Dimmer, 0)
Erin_Office_Motion_Timer = null
]
}
else {
logInfo("Erin's Office", "We have a timer already, rescheduling")
Erin_Office_Motion_Timer.reschedule(now.plusMinutes(1))
}
end
Unfortunately, no matter how much movement there is the timer is never rescheduled. The light constantly turns off and on (so I know the “null” state function is working).
I have also tried this rule:
rule "Erin's Office light motion"
when
Item Erin_Office_Motion received update OPEN
if (Erin_Office_Dimmer.state < 30 ){
if (Erin_Office_Motion_Timer != null)
{
Erin_Office_Motion_Timer.reschedule(now.plusMinutes(Erin_Office_Motion_Timeout))
logInfo("Erin's Office - ","Erin's Office Motion timer rescheduled for " + Erin_Office_Motion_Timeout + " minutes")
}
else
{
sendCommand(Erin_Office_Dimmer, 100)
logInfo("Erin's Office - ","Erin's Office Motion timer create with " + Erin_Office_Motion_Timeout + " minutes")
Erin_Office_Motion_Timer = createTimer(now.plusMinutes(Erin_Office_Motion_Timeout))
[|
if (Erin_Office_Motion.state == OPEN)
{
Erin_Office_Motion_Timer.reschedule(now.plusMinutes(Erin_Office_Motion_Timeout))
logInfo("Erin's Office - ","Erin's Office Motion timer triggered, but rescheduled again for " + Erin_Office_Motion_Timeout + " minutes")
}
else
{
sendCommand(Erin_Office_Dimmer, 0)
Erin_Office_Motion_Timer = null
}
]
}
}
end
Same thing. The lights come on and turn off when the timer expires. The timer is never rescheduled no matter how much movement there is. Any help would be greatly appreciated.