0 Replies Latest reply on Oct 1, 2014 9:46 AM by sharmon RSS
    sharmon Creator

    How to Create an Expression Rule That Reacts to an Alarm

    I was recently asked how to create an Expression Rule that reacts to an Alarm. One technique is to use the GUI:

    React_to_FooAlarm.PNG

    Some notes about that rule:

    • The Type of the rule is, "Alarm." Other alarm-associated expression rule types are:
      • AlarmExtendedDataChange
      • AlarmSeverityChange
      • AlarmStateChange
    • This Expression Rule evaluates to true when an alarm named, "FooAlarm," reaches the Axeda Machine Cloud for an associated asset. You can react to other characteristics of an alarm, such as:
      • Alarm.ack
      • Alarm.dataitem
      • Alarm.severity
      • Alarm.type
      • ...

    For more information about alarm types, and the variables, functions, and actions available for an expression rule, please fire up the expression rule editor, and then select the online help.

     

    It's always better to manage your custom objects, expression rules, and so on using Axeda Artisan. Here's how that Expression Rule would look in an apc-metadata file:

     

        <rule>
          <name>Alarm_Associated_ExpressionRule</name>
          <description>An expression rule associated with an alarm</description>
          <enabled>true</enabled>
          <applyToAll>true</applyToAll>
          <type>Alarm</type>
          <ifExpression><![CDATA[Alarm.name == "FooAlarm"]]></ifExpression>
          <thenExpression><![CDATA[ExecuteCustomObject("ReactToFooAlarm")]]></thenExpression>
          <elseExpression></elseExpression>
          <consecutive>true</consecutive>
        </rule>
    

     

    You could also create this rule using the API via a custom object or REST services. You'd just send the information above to the appropriate properties.

     

    The alarm does not have to react to a name. You could react to the value of a data item (assuming an alarm was generated). For example, you could change the ifExpression to, "Alarm.dataitem.foo.value > 30." NOTE - If you wanted to react to a data change, and there wasn't an alarm coming up, you'd use an Expression Rule of type, "Data," and test for a value of the changed data item that triggered the expression rule.