Hoping someone can tell me what I am doing wrong here. I have an Insteon dimmer 2477D switch, OH 1.8.3 and InsteonPLM with 1.9.0 SNAPSHOT binding.
Looking to have a rule that if someone physically taps switch once it leaves light on for 10 minutes and if they tap the switch twice it leaves the light on for 2 hours. For testing purposes I have the single tap set to 10 seconds…
My rule seems to work, but only if I turn it on through the OH app. Once turned on through app, I see rule kick in and turn it off 10 seconds later. However, if I physically goto the switch and single tap it, it never turns off. This is exactly the opposite of what I am wanting. I am wanting it to trigger when physically changed at the switch.
import org.openhab.core.library.types.*
import org.openhab.model.script.actions.*
import java.lang.Math
import java.util.Calendar
import java.util.Date
import java.util.TimeZone
import java.text.SimpleDateFormat
var Timer ClickTimer = null
var Timer LightTimer = null
rule "Garage Light Auto Off"
when
Item garagelight received command ON
then
if (ClickTimer == null) {
ClickTimer = createTimer(now.plusMillis(500), [|
if(LightTimer != null) LightTimer.cancel
LightTimer = createTimer(now.plusSeconds(10), [|
garagelight.sendCommand(OFF)
LightTimer = null
]
)
)
}
else
if(ClickTimer != null) ClickTimer.cancel
ClickTimer = null
if(LightTimer != null) LightTimer.cancel
LightTimer = createTimer(now.plusHours(2), [|
garagelight.sendCommand(OFF)
LightTimer = null
]
)
end
My logs show this when tapping the switch.
2016-07-27 23:49:18.685 [INFO ] [.o.b.i.i.device.MessageHandler] - LightOnDimmerHandler: device 30.B7.45 was turned on REGULAR. Sending poll request to get actual level
2016-07-27 23:49:20.364 [INFO ] [.o.b.i.i.device.MessageHandler] - DimmerRequestReplyHandler: set device 30.B7.45 to level 100
2016-07-27 23:53:26.153 [INFO ] [.o.b.i.i.device.MessageHandler] - DimmerRequestReplyHandler: set device 30.B7.45 to level 100
Anyone have any ideas where I am going wrong? I am so close…