Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.
About Delay quest?
-
I have a metal datapoint script like this
var triggerSMSAction = false; var thisText = ""; var NL = "\r\n"; var S = my.value; print('my.value= '+my.value); //print(my); var resendMsgTimeDelay = 300; var Ptr = -1; var txt = ""; var theSecondsDelyforSignalVerification = 30; //--mango timestamp value in milliseconds since the epoch var now = new Date().getTime(); //print("now=",now); var o1lastValue,o1_isLeak,o1; o1 = getDataPointByXID("XID_MainDC_Leak_A"); // print(o1); o1lastValue = o1.lastValue(); print ("o1lastValue =",o1lastValue); o1_isLeak = o1lastValue.value; print("o1_isLeak =",o1_isLeak); if (o1_isLeak === true) { print ("now =",now); print ("o1LastValueTime =",o1lastValue.time); timeDiff = (now - o1lastValue.time)/1000; print("timeDiff =",timeDiff); if (timeDiff <= theSecondsDelyforSignalVerification) {o1_isLeak=false;} } //====================================================================== Ptr = Ptr + 1; if (o1_isLeak === true){ print("o1_isLeak=",o1_isLeak); print ("Debug it !!"); if (!(S & Mask[Ptr])) { // 0101 & 0100 => 0100 => true // do stuff txt = 'Delay-Alarm'; LOG.info(txt); S = S | Mask[Ptr] ; triggerSMSAction = true; thisText = thisText + txt + NL; } }else{ if (S & Mask[Ptr]) { // 0101 & 0100 => 0100 => true // from true to false txt = 'Delay-reCover'; LOG.info(txt); S = S ^ Mask[Ptr] ; triggerSMSAction = true; thisText = thisText + txt + NL; } } function getDataPointByXID(xid) { var dataPoints = DataPointQuery.query("eq(xid,"+xid+")"); if( dataPoints.length !== 1 ) throw LOG.info("Data point with xid '" + xid + "' not found."); return dataPoints[0].runtime; }I turn the datapoint "XID_MainDC_Leak_A" value to true but in the if (o1_isLeak === true) script will not work?
How do I do fix it?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login