Get Started
Part 2

Rules

How Rules Work

Every rule expresses a single statement: when all of these conditions are met, run these actions in order. That is the entire model; everything else is detail settings.

Conditions are combined with AND. A rule fires once at the moment all conditions become true together, and does not fire repeatedly while they remain true. To fire again, at least one condition must become false and then true again.

Note This is why the hold time matters. Detection results can flip between true and false in a short time, and without a hold time the rule would fire on each flip. See Controlling Repeat Firing.

Conditions

A condition defines the situation to monitor. Clicking + Add condition shows twelve condition types.

The list of condition types
What a condition can monitor.
ConditionMonitors
AI CameraCamera video: people, faces, plates, fire, codes, text, or targets you trained.
ScheduleDays of the week and time ranges.
IntervalA repeating cycle at a fixed interval.
I/O DeviceA sensor reading or a board input.
MQTT · Modbus · OPC UA · User Defined CommValues received from a broker, a PLC, or a custom protocol.
TelegramMessages received by your bot.
Sound ClassificationSounds such as breaking glass, a barking dog, or an alarm.
Speech To Text (STT)A spoken phrase.
Custom ConditionEvaluations the other types cannot express, written with blocks or a script.

Conditions can be combined. A camera condition plus a schedule yields "a person, at night only"; a camera condition plus a sensor reading yields "a person, only while the machine is running".

Camera Condition Settings

  1. Camera and analysis. Select existing ones, or create them from this panel.
  2. Evaluation criteria. The Condition list depends on the analysis: a face analysis offers known/unknown, a plate analysis offers registered/unregistered.
  3. Target. Conditions that require a name show the Target value field: an object class, a person, a plate, or text.
  4. Confidence and duration. Set the certainty threshold and Sustained for. The remaining settings are under Advanced.
Caution Target values are compared as literal strings. Select objects from the list rather than typing them. The two cases with a fixed convention (object names in lower case, plates in upper case) are normalized automatically, but names you define yourself are compared exactly as entered.
Sub conditions: evaluating only at firing time

Conditions are evaluated continuously unless configured otherwise. Changing one to a sub condition makes it evaluate once, at the instant all other conditions are met, to decide whether the actions run.

A typical use is a second camera: when the doorbell is pressed (evaluated continuously), check whether the face at the door is registered (evaluated only at that moment). The second camera does not need to be analyzed all day.

Use Change to sub condition in the row menu. The list shows a Sub badge, and there is no hold time setting, because a sub condition is evaluated once at firing time rather than monitored continuously.

A rule requires at least one ordinary condition. A rule consisting only of sub conditions can never fire, so Reflex blocks that change and explains why.

Ask LLM: re-verifying a detection with an LLM

The Ask LLM switch in the camera condition panel sits outside Advanced Options, directly below Sustained for. When enabled, Reflex captures photos at the moment the condition matches and sends them to an LLM; the actions run only if the LLM approves. Use it as an additional verification step for conditions prone to false positives.

FieldDescription
LLM connectionThe LLM provider to query. Create one from this panel if none exists.
QueryThe question sent to the LLM. Required. Example: "Is a person actually knocking on the door?"
ShotsNumber of photos to send. 1 to 10.
IntervalTime between shots. 0 to 5,000 ms.

Each rule can have at most one, and a camera condition is required to enable it.

Controlling Repeat Firing

Two settings prevent excessive alerts. Both are in the camera condition panel.

SettingBehaviorRaise it when
Sustained for The detection must last this long before the rule fires. Momentary detections are ignored. Alerts occur for targets that were not actually present.
Reset after After the actions run, the condition must remain unmet for this long before the rule can fire again. The same situation is reported repeatedly.

At a busy entrance, lowering Reset after is often the better choice, so that each person is recorded separately rather than merged into one event. Leaving it empty makes it equal to the hold time.

Additional settings for movement conditions

Movement detected and No movement add two settings.

Movement margin (px)The center of a detected box must move farther than this value to count as movement. Raise it to ignore small jitter, lower it to detect slow movement.
Still durationThe target must remain still for this long to count as stopped. This also prevents a jittery object from re-firing repeatedly.

Actions

Clicking + Add action shows sixteen actions.

The list of actions
The actions a rule can run when it fires.
PurposeActions
Send notificationsPush Notification, Email, Telegram
Keep recordsLogging
Play soundPlay Media, Text to Speech (TTS)
Control equipmentI/O Device, Zigbee Control, Modbus, OPC UA, User Defined Comm
Integrate with softwareMQTT Publish, HTTP Request, SQL Database, Shell Command
WaitDelay

Actions run top to bottom, and rows can be dragged to reorder them. Order matters when an action takes time: a notification that takes one second delays everything after it by that amount. Insert a Delay between actions to space them out, for example to play a warning, wait, and only then cut power.

Note Actions that can attach a photo (push, email, Telegram, logging) share one snapshot per event. The photo is captured once when the rule fires and every action attaches the same image, so the photo on your phone and the photo in the log always match. If the rule watches multiple cameras, select which camera the photo comes from in the action settings.
Caution To receive push notifications, the Grablo app must be installed on the phone, signed in with the same account, and allowed to send notifications in the phone's settings.

Keeping Event Records

The Logging action writes the moment to the event log with a photo, and optionally a video clip. The log is only useful with this action, so including one in most rules is recommended.

SettingDescription
NameRequired. The name used for this entry in the log, the CSV, and the printed report. A number is filled in automatically; replace it with an identifiable name.
TargetWhat to record: a camera, an analysis, or a value.
TypeSnapshot or Video Clip. A photo is captured even with a clip, for the list thumbnail.
Pre-event · Post-eventHow many seconds of video to include before and after the moment.
Video lengthA fixed duration, or While detected, which records for as long as the detection lasts.

The three targets record different information.

TargetRecords
CameraPhotos and video only. Use it to attach another camera as supporting context, including cameras this rule does not watch.
AnalysisThe photo plus the AI's judgment. This is the only target whose AI results can be corrected from the log later.
ValueThe reading at the moment the rule fired, with no attachment.
Caution Video is held in memory until it is written. A long Pre-event increases the controller's memory usage, and longer clips produce larger files. Only one recording per camera can use While detected; if another record already uses it, this one falls back to a fixed duration, and the screen indicates this.

Managing Rules

TaskMethod
RenameClick the name at the top of the middle area and edit it.
DuplicateDuplicate in the rule's row menu. Conditions, actions, and settings are copied.
DeleteDelete in the row menu. The contained conditions and actions are deleted as well.
SuspendThe switch beside the rule name. Rules, individual conditions, and individual actions each have one.

Switching an item off is a safe operation: its settings are preserved and it can be re-enabled at any time.

Note The fastest way to apply the same rule to several cameras is duplication. Duplicate the rule, then select a different camera in the copy's camera condition.
Caution Editing is locked while running. The controller operates on the project it received at start time, so mid-run changes would not take effect. Stop, edit, then start again. Face enrollment and adding training samples are exceptions and remain available while running, since they are tasks meant to be performed with the system live.