Can someone please give me some direction in modifying the KumoApp below. I am not familiar with coding, but I need a wireless motion tag to beep (x) times every (x) minutes until a door is closed.
The app below does everything I need, minus the beeping for x minutes x times. The app just needs a tweak to add the timer for the beeps.
Example: Someone opens a door. The tag sends a push notice to my iPhone to let me know that the door was opened, then if the door remains open for (x) minutes the tag beeps (x) times. Then the tag timer resets and waits for another (x) minutes before repeating the process or until the door is actually closed.
Thank you for any assistance!
Sam
--------------------------
var counts={};
var timer={};
var target = <#door or window_[12|13|21|52]_N#>;
var interval = <%interval in minute_N%>;
target.forEach(function(t){
t.opened=function(){
KumoApp.stopTimer(timer[t.uuid]);
counts[t.uuid]=0;
timer[t.uuid]=KumoApp.setInterval(function(){
counts[t.uuid]++;
<~devices to send notification~>.push(t.name + " open "+counts[t.uuid] * interval+" min.");
KumoApp.Log("Sent push " + t.name + " open "+counts[t.uuid]*interval+"min");
},interval*1000*60);
KumoApp.Log("Started timer " + timer[t.uuid] + " for " + t.name);
};
t.closed=function(){
KumoApp.Log("Stopping timer " + timer[t.uuid] + " for " + t.name);
KumoApp.stopTimer(timer[t.uuid]);
KumoApp.Log("Stopped timer " + timer[t.uuid] + " for " + t.name);
};
});