I would like to start by first thanking Rex for his excellent tutorial - I tend to think in a more serially than abstractly which tends to lock me up when trying to figure out how to code something new. The examples have been a great help so far.
I have been lurking a while and the following code is based on what I have read from http://wiki.micasaverde.com/index.phpLuup_Scenes_Events, http://forum.micasaverde.com/index.php/topic,18679.msg154756.html#msg154756 and the sticky at the top of this board. Here is where I am stuck. I have a scene where my Insteon door sensor (using the native Vera Insteon code, not Altsteon) will enter a triggered state, whenever the sensor is armed or not, so when the sensor arms, I get alerts. I would like to set some luup code in a scene so that when the sensor trips, the luup waits 5 or 10 seconds (to filter out “reed switch bounces”), then resets to a value of “Tripped” = 0. Here is what i have so far:
luup.call_delay("delayReset",10)
-- Main code terminates at this point
-- Function to be called after delay --21 is my Insteon Sensor device number
function delayReset()
luup.call_action("urn:schemas-micasaverde-com:device:MotionSensor:1","SetVariable",{ newVariableValue=0 },21)
end
My questions are:
- How can I debug this to get feedback? When I test in the Develop Apps area, I get “Failed to test code, please try again” which is not very helpful as to a cause.
and - Do you see any obvious problems / better ways to solve this issue?
Thanks - any help is appreciated!
Sleepyhat