Create a Datapoint Condition Alarm

The following sample shows how to create a data point condition alarm that fires when the outside temperature data point is less than than 10 degrees Fahrenheit below zero.

In this example, the alarm template ID for the data point condition alarm is 9 (almtId=9). To find the almtId for an alarm type, send a GET ws/AlarmTemplate request to get a list of all available alarm templates.

Request

POST /ws/Alarm

Payload

<Alarm>
   <almtId>9</almtId>   <!-- Datapoint Condition Alarm -->
   <almName>Minneapolis Temperature</almName>
   <almDescription>Fire when it gets extremely cold.</almDescription>
   <almScopeConfig>
      <ScopingOptions>
         <Scope name="Resource" value="temperature/MN/Minneapolis" />
      </ScopingOptions>
   </almScopeConfig>
   <almRuleConfig>
      <Rules>
         <FireRule>
            <Variable name="thresholdValue" value="-10" />
            <Variable name="timeUnit" value="minutes" />
            <Variable name="type" value="numeric" />
            <Variable name="timeout" value="10" />
            <Variable name="operator" value="&lt;" />
         </FireRule>
         <ResetRule>
            <Variable name="thresholdValue" value="-10" />
            <Variable name="timeUnit" value="minutes" />
            <Variable name="type" value="numeric" />
            <Variable name="timeout" value="10" />
            <Variable name="operator" value="&gt;" />
         </ResetRule>
      </Rules>
   </almRuleConfig>
</Alarm>