Coding Help

55 views
Skip to first unread message

Sam

unread,
May 11, 2018, 12:37:59 PM5/11/18
to Wireless Sensor Tags

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);

   };

});

evan.c...@gmail.com

unread,
Nov 5, 2018, 3:04:51 AM11/5/18
to Wireless Sensor Tags
Did you get it working? If so it would be great to share. 

Sam

unread,
Jun 16, 2019, 6:02:12 PM6/16/19
to Wireless Sensor Tags
There must be someone on this forum who could kindly lend a helping hand with the coding below.  I would truly appreciate your help!!!  Please read my request below and reach out to me if you can help.  

THANK YOU!!
Sam
Reply all
Reply to author
Forward
0 new messages