Difference between revisions of "Rules Complete Examples"
(→NR04 - Load Watchdog with alarm to Cloud) |
|||
Line 115: | Line 115: | ||
}</nowiki> | }</nowiki> | ||
− | == | + | == NR05 - Load Watchdog with zones == |
− | + | Rule monitors load (Watts) on Output 1. Measured load is then classified to several zones defined with thresholds (limit values). Depending on the zone in which the measured load is currently located, different actions can be triggered. Load value has to be between defined threshold for at least 10seconds in order to be placed to respective zone. | |
− | * | + | Example is composed of one PAB that classifies the zones and three Rules for 3 separate actions. Actions do the following: |
− | * | + | * Output 1 load lower than 1W: Output 2 = ON |
+ | * Output 1 load between 1-20W: Output 3 = ON | ||
+ | * Output 1 load between 20-200W: Output 4 = ON | ||
===PAB definition=== | ===PAB definition=== | ||
− | PAB name: ''' | + | PAB name: '''NR05_PAB''' |
<nowiki> | <nowiki> | ||
Line 129: | Line 131: | ||
"source": "OUTPUTS/2/CURRENT", | "source": "OUTPUTS/2/CURRENT", | ||
"thresholds": [ | "thresholds": [ | ||
− | + | 1, | |
− | + | 20, | |
+ | 200 | ||
], | ], | ||
"timeHysteresis": 10 | "timeHysteresis": 10 | ||
}</nowiki> | }</nowiki> | ||
− | ===Rules | + | ===Rules definitions=== |
− | + | Rule 1 name: '''NR05_RULE_1''' | |
− | |||
− | |||
<nowiki> | <nowiki> | ||
{ | { | ||
"conditions": { | "conditions": { | ||
− | "PAB/ | + | "PAB/NR05_PAB/ZONE": 0 |
}, | }, | ||
"actions": { | "actions": { | ||
− | "OUTPUTS/1/ACTION": | + | "OUTPUTS/2/ACTION": 1, |
+ | "OUTPUTS/3/ACTION": 0, | ||
+ | "OUTPUTS/4/ACTION": 0, | ||
} | } | ||
}</nowiki> | }</nowiki> | ||
+ | Rule 2 name: '''NR05_RULE_2''' | ||
− | + | <nowiki> | |
− | + | { | |
+ | "conditions": { | ||
+ | "PAB/NR05_PAB/ZONE": 0 | ||
+ | }, | ||
+ | "actions": { | ||
+ | "OUTPUTS/2/ACTION": 0, | ||
+ | "OUTPUTS/3/ACTION": 1, | ||
+ | "OUTPUTS/4/ACTION": 0, | ||
+ | } | ||
+ | }</nowiki> | ||
+ | |||
+ | Rule 3 name: '''NR05_RULE_3''' | ||
<nowiki> | <nowiki> | ||
{ | { | ||
"conditions": { | "conditions": { | ||
− | "PAB/ | + | "PAB/NR05_PAB/ZONE": 0 |
}, | }, | ||
"actions": { | "actions": { | ||
− | " | + | "OUTPUTS/2/ACTION": 0, |
+ | "OUTPUTS/3/ACTION": 0, | ||
+ | "OUTPUTS/4/ACTION": 1, | ||
} | } | ||
− | } </nowiki> | + | }</nowiki> |
== Example for devices without measurements == | == Example for devices without measurements == |
Revision as of 16:36, 23 November 2021
Contents
NR01 - WatchDog
The WatchDog functionality is used to monitor connectivity to specified IP address (or URL) by sending PING request to it.
The ping in this example is sent every 60s and waits 5s for the device to respond. If the ping fails, Watchdog returns false
and restarts (ACTION: 2 = SHORT OFF) device connected to first output. After restart, it waits 120 seconds and starts monitoring again. If the device does not respond, WatchDog remains in ERROR state until the next successful ping.
Watchdog definition
WatchDog name: NR01_WDT
{ "target": "192.168.101.180", "pingInterval": 60, "timeout": 5, "maxTimeouts": 0, "timeToReboot": 120 }
Rule definition
Rule name: NR01_RULE
{ "conditions": { "WDT/NR01_WDT/FAIL": true }, "actions": { "OUTPUTS/1/ACTION": 2 } }
NR02 - Digital Inputs
Rule is used for managing outputs in response to change of Digital Inputs (DI) state. Rule monitors state of first DI. When DI switches from OFF (0) to ON (1), Rule switches (toggles) Outputs 1 & 2 to their opposite states (ACTION 4 = TOGGLE).
Rule definition
Rule name: NR02_RULE
{ "conditions": { "INPUTS/1/STATE": "on" }, "actions": { "OUTPUTS/1/ACTION": 4, "OUTPUTS/2/ACTION": 4 } }
NR03 - Load Watchdog
Rule monitors load (Watts) on Output 1. If the load is between 1-20W for at least 2 minutes, it restarts (ACTION 2 = SHORT OFF) the output. Example uses PAB (Power Analysis Block) functionality to determine if measured value (load in our case) lies in given range for a period of time. When it does, defined Rule triggers device restart.
PAB definition
PAB name: NR03_PAB
{ "type": "RANGE", "source": "OUTPUTS/1/LOAD", "lowerBound": 1, "upperBound": 20, "timeHysteresis": 120 }
Rule definition
Rule name: NR03_RULE
{ "conditions": { "PAB/NR03_PAB/IN": true }, "actions": { "OUTPUTS/1/ACTION": 2 } }
NR04 - Load Watchdog with alarm to Cloud
Rule monitors load (Watts) on Output 1. If the load is between 1-20W for at least 30 minutes, it restarts (ACTION 2 = SHORT OFF) the output. In addition, it triggers an alarm in NETIO Cloud, which sends a notification to specified email address. This example needs a NETIO Cloud account with Premium version active for first output. There also has to be email notification enabled for the output.
Example uses PAB (Power Analysis Block) functionality to determine if measured value (load in our case) lies in given range for a period of time. When it does, defined Rule triggers device restart and sends alarm to Cloud.
PAB definition
PAB name: NR04_PAB
{ "type": "RANGE", "source": "OUTPUTS/1/LOAD", "lowerBound": 1, "upperBound": 20, "timeHysteresis": 1800 }
Rule definition
Rule name: NR04_RULE
{ "conditions": { "PAB/NR04_PAB/IN": true } "actions": { "OUTPUTS/1/ACTION": 2, "CLOUD/OUTPUT/1/ALARM": "${COND_RESULT}" } }
NR05 - Load Watchdog with zones
Rule monitors load (Watts) on Output 1. Measured load is then classified to several zones defined with thresholds (limit values). Depending on the zone in which the measured load is currently located, different actions can be triggered. Load value has to be between defined threshold for at least 10seconds in order to be placed to respective zone. Example is composed of one PAB that classifies the zones and three Rules for 3 separate actions. Actions do the following:
- Output 1 load lower than 1W: Output 2 = ON
- Output 1 load between 1-20W: Output 3 = ON
- Output 1 load between 20-200W: Output 4 = ON
PAB definition
PAB name: NR05_PAB
{ "type": "ZONES", "source": "OUTPUTS/2/CURRENT", "thresholds": [ 1, 20, 200 ], "timeHysteresis": 10 }
Rules definitions
Rule 1 name: NR05_RULE_1
{ "conditions": { "PAB/NR05_PAB/ZONE": 0 }, "actions": { "OUTPUTS/2/ACTION": 1, "OUTPUTS/3/ACTION": 0, "OUTPUTS/4/ACTION": 0, } }
Rule 2 name: NR05_RULE_2
{ "conditions": { "PAB/NR05_PAB/ZONE": 0 }, "actions": { "OUTPUTS/2/ACTION": 0, "OUTPUTS/3/ACTION": 1, "OUTPUTS/4/ACTION": 0, } }
Rule 3 name: NR05_RULE_3
{ "conditions": { "PAB/NR05_PAB/ZONE": 0 }, "actions": { "OUTPUTS/2/ACTION": 0, "OUTPUTS/3/ACTION": 0, "OUTPUTS/4/ACTION": 1, } }
Example for devices without measurements
Defined rule keeps output 1 state the same as output 3
Rule definition
Rule name: RULE_OUT
{ "conditions": { "OUTPUTS/3/STATE": "on" }, "actions": { "OUTPUTS/1/ACTION": "${COND_RESULT}" } }