Difference between revisions of "Rules"

From wiki.netio-products.com
Jump to navigation Jump to search
Line 20: Line 20:
| filters
| filters
| Eg: <code>"SCHEDULE/MY_SCHEDULE/ACTIVE": true<code/>
| Eg: <code>"SCHEDULE/MY_SCHEDULE/ACTIVE": true<code/>
| Filter definition. For multiple filter conditions, the relationship betweeeen them is always <code>AND</code>
| Filter definition. For multiple filter conditions, the relationship between them is always <code>AND</code>
| actions
| actions

Revision as of 15:01, 16 November 2021

Rules allow to trigger follow-up actions based on fulfillment of specified conditions (defined by PAB or Watchdog). The actions can change output states (turn OFF, turn ON, toggle, etc.) or trigger an alarm in Cloud. There can be more conditions for one action and based on definition must apply both (AND) or at least one of them (OR). Also, multiple actions can be defined for a set of conditions. Additionally , evaluation of actions can be filtered by conditions set in filters variable. If the precondition in filter is not met, conditions do not get evaluated. When all the conditions specified in conditions are met (and the preconditions in filters as well), all actions defined in actions will be executed.


Variable Value Description
conditions Eg: `"PAB/PAB1_1/IN": true` Conditions definition. Relationship between conditions is defined by operator (AND/OR)
operator AND/OR Optional. Specifies relationship between conditions. AND = all conditions must apply at the same time. OR = at least one condition must apply. If missing, defaults to OR
filters Eg: "SCHEDULE/MY_SCHEDULE/ACTIVE": true Filter definition. For multiple filter conditions, the relationship between them is always AND
actions Eg: "CLOUD/OUTPUT/1/ALARM": "${COND_RESULT}" Actions definition. All actions defined here will be triggered when conditions (and filters) are met

Condition names are based on user-specified names and their types:

  • For PABs, the name has structure: PAB/pab_name/pab_output_value (TRUE/FALSE or int)
  • For Watchdogs, the name has structure: WDT/watchdog_name/FAIL

Available forms of conditions

  • "PAB/PAB1_1/IN": true = PAB1_1 is in specified interval
  • "PAB/PAB_ZONE_1/ZONE": 1 = PAB_ZONE_1 is in zone 1
  • "WDT/WATCHDOG_1/FAIL": true = WATCHDOG_1 is in ERROR state

Available forms of filters

  • "SCHEDULE/TestSchedule/ACTIVE": true = TestSchedule is active
  • "OUTPUTS/1/STATE":"on" = Output 1 is ON

Available forms of actions

  • "OUTPUTS/1/ACTION": 0 = Turn OFF Output 1
  • "OUTPUTS/6/ACTION": 2 = Short OFF Output 6
  • "CLOUD/OUTPUT/1/ALARM": "${COND_RESULT}" = Set condition output value to the alarm (Turns the alarm ON or OFF based on condition evaluation)

Note: The variable ${COND_RESULT} contains output value of the given condition. It takes values 0 (condition not met) or 1 (condition met). It can be used for dynamic switching the alarm in Cloud ON/OFF depending on current state of the PAB.

ACTIONS - how to control outputs

  • 0 = TURN OFF
  • 1 = TURN ON
  • 2 = SHORT OFF
  • 3 = SHORT ON
  • 4 = TOGGLE - Changes the status from ON to OFF and vice versa
  • 5 = NOTHING (placeholder, DO NOT USE)