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.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

  • I need to make a logic so that
    if there is a active alarm, with level iqual to information or None, report 1, if there is no active alarm, report 0;
    and the same for active alarm urgente or higher.

    I need this to command a Dialer, to send a message for a cell phone


  • Hi Tobias,

    Is that any active alarm, or on a subset of points if an alarm is active? Do you want the message to resend on some interval based on the current highest active alarm state? Or just to send messages when the highest active alarm level changes? When you say

    and the same for active alarm urgente or higher.

    Do you mean to report a one, a zero, or some other number via the SMS message?


  • Hi Phil!

    It would be any active alarm!

    Do you want the message to resend on some interval based on the current highest active alarm state? Or just to send messages when the highest active alarm level changes?
    I think it would be better with the first option, so that if the alarm is not resolved a new SMS would be send in some interval.

    I need the 1 and 0 to use in a write output, from my hardware, to activate the Dialer. And the Dialer will have a Text ready to be send for "Not Urgent alarms" and "Urgent Alarms".


  • Interesting request!

    Currently, it is not possible to define an event handler for all events at one level or above, but that sounds like it would be the ideal way to address this. Currently, I would find myself either using a mailing list or user with a "send alarm emails" setting of "Urgent" and either having that be enough (you can send SMS to many carriers over email, but you would not control the message text) or having a script check if new alarms have occurred in the last X minutes. You could also add an event handler to every event type, that's an option.

    So far as the script goes, add the output point into the context, we'll run it on 0 0/5 * * * ? (every five minutes) and have something like....

    var activeEvents = com.serotonin.m2m2.Common.eventManager.getAllActive();
    var maxLevel = 0;
    for( var k = 0; k < activeEvents.length; k+=1 ) {
      if( activeEvents[k].activeTimestamp < checkedUnto.time )
        continue;
      if( activeEvents[k].alarmLevel > maxLevel )
        maxLevel = activeEvents[k].alarmLevel;
    }
    if( maxLevel >= com.serotonin.m2m2.rt.event.AlarmLevels.URGENT )
      output.set(1);
    else
      output.set(0);
    checkedUnto.set(!checkedUnto.value); //Ping-pong a context binary point to track time
    

    While this has the disadvantage of perhaps taking five minutes to alert of an alarm (you could speed up the cron patter though), it will have the advantage of also communicating the "server offline" state through failing to send an 'all is good' message on that five minute interval.

    If you want to go down the add-to-every event type route, I can help with the script you may need there. I think we probably will add the ability to define an event handler for all events at or above levels.