Difference between revisions of "Rules Complete Examples"

From wiki.netio-products.com
Jump to navigation Jump to search
(Created page with "== Example for PAB - RANGE (multiple actions for one condition) == Defined condition checks a device connected to output 4. The device is expected to have a maximum load of 60...")
 
Line 1: Line 1:
 +
== Example for PAB - RANGE ==
 +
The setting described below is intended to monitor a device connected to first output. The device is expected to have a certain load between 100W and 500W during working hours. If the consumption is too low or too high (i.e. outside the specified interval) for more than 10s, it is likely that the device works incorrectly and restart is needed to correct its state.
 +
 +
===PAB definition===
 +
 +
PAB name: '''Watch_out1_load'''
 +
<nowiki>
 +
{
 +
  "type": "RANGE",
 +
  "source": "OUTPUTS/1/LOAD",
 +
  "lowerBound": 100,
 +
  "upperBound": 500,
 +
  "timeHysteresis": 10
 +
}</nowiki>
 +
 +
===Rules definition===
 +
 +
''Note: We use the Schedules functionality in the filter to define working hours of the week. The device monitoring will only work at time set in the Schedule.
 +
 +
Schedule name: '''Working_hours'''
 +
 +
<nowiki>
 +
{
 +
  "conditions": {
 +
    "PAB/Watch_out1_load/IN": 0
 +
  },
 +
  "filters": {
 +
    "SCHEDULE/Working_hours/ACTIVE": true
 +
  },
 +
  "actions": {
 +
    "OUTPUTS/1/ACTION": 2
 +
  }
 +
}</nowiki>
 +
 
== Example for PAB - RANGE (multiple actions for one condition) ==
 
== Example for PAB - RANGE (multiple actions for one condition) ==
 
Defined condition checks a device connected to output 4. The device is expected to have a maximum load of 600W. If the load is too high, we want to immediately turn off the device and send an alarm to Cloud.
 
Defined condition checks a device connected to output 4. The device is expected to have a maximum load of 600W. If the load is too high, we want to immediately turn off the device and send an alarm to Cloud.

Revision as of 15:38, 22 October 2021

Example for PAB - RANGE

The setting described below is intended to monitor a device connected to first output. The device is expected to have a certain load between 100W and 500W during working hours. If the consumption is too low or too high (i.e. outside the specified interval) for more than 10s, it is likely that the device works incorrectly and restart is needed to correct its state.

PAB definition

PAB name: Watch_out1_load

{
  "type": "RANGE",
  "source": "OUTPUTS/1/LOAD",
  "lowerBound": 100,
  "upperBound": 500,
  "timeHysteresis": 10
}

Rules definition

Note: We use the Schedules functionality in the filter to define working hours of the week. The device monitoring will only work at time set in the Schedule.

Schedule name: Working_hours

{
  "conditions": {
    "PAB/Watch_out1_load/IN": 0
  },
  "filters": {
    "SCHEDULE/Working_hours/ACTIVE": true
  },
  "actions": {
    "OUTPUTS/1/ACTION": 2
  }
}

Example for PAB - RANGE (multiple actions for one condition)

Defined condition checks a device connected to output 4. The device is expected to have a maximum load of 600W. If the load is too high, we want to immediately turn off the device and send an alarm to Cloud.

PAB definition

PAB name: Watch_out4_load

{
  "type": "RANGE",
  "source": "OUTPUTS/4/LOAD",
  "lowerBound": 0,
  "upperBound": 600
}


Action definition

{
  "conditions": {
    "PAB/Watch_out4_load/IN": 0
  }
  "actions": {
    "OUTPUTS/4/ACTION": 0,
    "CLOUD/OUTPUT/1/ALARM": "${COND_RESULT}"
  }
}

Example for PAB - ZONES

In this condition, the value of current at the output 2 is monitored. It is then classified to respective zone according to measured value. Depending on the zone in which is classified, different actions can be triggered:

  • If the value of current is in zone 0, restart device on output 1
  • If the value of current is in zone 2, turn ON alarm in Cloud

PAB definition

PAB name: Watch_out2_current

{
  "type": "ZONES",
  "source": "OUTPUTS/2/CURRENT",
  "thresholds": [
    50,
    150,
  ],
  "timeHysteresis": 10
}

Rules definition

Must be defined in two separate Rules because they contain different conditions:

  • Rule name: Zone_restart
  • Description: If the PAB is in zone 0 (0-49mA), restart the device at output 1
{
  "conditions": {
    "PAB/Watch_out2_current/ZONE": 0
  },
  "actions": {
    "OUTPUTS/1/ACTION": 2
  }
}


  • Rule name: Zone_alarm
  • Description: If the PAB is in zone 2 (150+ mA), send alarm to Cloud
{
  "conditions": {
    "PAB/Watch_out2_current/ZONE": 2
  },
  "actions": {
    "CLOUD/OUTPUT/1/ALARM": "${COND_RESULT}"
  }
} 

Watchdog example

The Watchdog monitors specified IP address. The ping is sent every 60s and waits 5s for the device to respond. If the ping fails twice in a row, Watchdog returns false and restarts the device. After restart, it waits 120 seconds and starts monitoring again. This cycle repeats a total of 3 times, and if the device does not respond even once, the Watchdog remains in ERROR state.

Watchdog definition

Watchdog name: Watch_101_180

{
  "target": "192.168.101.180",
  "pingInterval": 60,
  "timeout": 5,
  "maxTimeouts": 2,
  "timeToReboot": 120,
  "maxRestarts": 3 
}


Rule definition

Rule name: Watch_101_180_restart

{
  "conditions": {
    "WDT/Watch_101_180/FAIL": true
  },
  "actions": {
    "OUTPUTS/1/ACTION": 2
  }
}