The example below shows how to configure filling of retention tank based on measurement of minimum and maximum water level.
Equation smart rule has internal variable called LastState. This variable returns TRUE or FALSE based on last result of evaluation of this smart rule.
(LastState AND !St1) OR (!LastState AND !St)
If result is TRUE: Valve ... Turn On
If result is FALSE: Valve ... Turn Off
Minimum duration ... 0:05:00 minutes