Rules introduction
-
Rules
are used to trigger set ofOperations
when a condition met the specification. MyController supports multiple conditions.Conditions type:
- Compare
- State
- Script
- String
- Threshold
- Threshold range
To add new
Rule
, Navigate toResources
>>Rules
>>Add rule
.Condition -
Compare
We can compare
Sensor variable1
withSensor variable2
.
Example: Hall-temperature >= 20% outside-temperatureCondition -
State
With this condition we con monitor state of
Binary
type sensor variables,Node
,Gateway
andResources group
.
Example forSensor variable
Example for
Node
Example for
Gateway
Example for
Resources group
Condition -
Threshold
With this condition we can monitor
Sensor variable
values with a static value or with anotherSensor variable
valueExample with static value:
Example with another Sensor variable:
Condition -
Threshold range
With this condition we can monitor
Sensor variable
value Is in range? or Is in outside range?Threshold value low
(1) - low value of thresholdThreshold value high
(2) - high value of thresholdInclude threshold low
- When we check this field included (1) in boundaryInclude threshold high
- When we check this field included (2) in boundaryIn range
- When you check this box will be act asIn range
check, otherwiseOut side range
check
Example: X inside [10,56], X outside [45, 200]
Example for
In range
:Example for
Out side range
: -
Hello,
I would like to execute some operation when data from two sensors meet some condition.
For example: if (sensor1 == 0 AND sensor2 == 0) then turn_off_power.Is there a way how to do it?
Thank You,
Marek -
@Marek from UI you cannot compare two sensors. However you can writer simple script for condition. and return
true
orfalse
. If you need help to write script let me know I will show some example. -
@jkandasa Thanks for the hint. I'v created following script and it works
var dimCree = mcApi.uidTag().getByUid("dimm_cree_uid");
var dimCob = mcApi.uidTag().getByUid("dimm_cob_uid");
( dimCree.sensorVariable.value == 0 && dimCob.sensorVariable.value == 0 )Thanks for all the effort,
Marek