Event rules
An event rule says: when this happens, then do that. For example: while a camera reports blur during working hours, switch on the warning lamp on the I/O box and show an overlay on the camera.
Create a rule
Section titled “Create a rule”-
Open Event rules in the navigation rail and click New rule. The rule is made in four steps; Next goes on once a step is complete.
-
Rule: enter a name. Dead time and Max per minute can stay as they are.
-
When: choose the event. The events sit in folders (Devices, Certificates, Sites, then one per plugin, such as Dashboards or Text recognition); type a few letters to search them. Then choose the devices with Choose devices: all devices, or any mix of tags and single devices. A tag also covers devices you tag later. Add more conditions if you need them. They all must hold:
- Add check: a value of the event, for example Temperature > 40. See Check the values.
- Add event: another event, on the same device or on any device you choose. Example: blur, and the camera is reachable.
- Add schedule: weekdays and a time window. Example: Monday to Friday, 08:00 to 18:00.
-
Then: choose up to five actions. They run in the order of the list. With Choose devices pick where each one runs: on the device of the event, on all devices, or on tags and single devices.
-
Overview: check the rule and click Save.
Events
Section titled “Events”| Event | Comes from |
|---|---|
| Device unreachable, Credentials required, Certificate changed | The device status OADM sees |
| Any device: unreachable, credentials required, certificate changed | On while at least one device has the status; the value {count} says how many. No device |
| Any device: clock off | On while at least one device clock differs from the OADM server by more than the allowed clock difference, or its NTP is not synced; {count} says how many. No device |
| Certificate expires soon, Certificate expired, and their Any device events (group Certificates) | The HTTPS certificate of the device, with the days of the Expiry warning policy on the PKI page |
| Any event a device offers (inputs, virtual inputs, Object Analytics, Image Health Analytics, storage, …) and its “connection lost” | Device triggers you create |
| Text read (group Text recognition, one per reader): Area, Text, Text read, All matches, Number, Confidence, Matches format | The readers of Text recognition |
| Reader problem (one per reader), Any reader problem | On while a text reader cannot read, see Text recognition |
| The events of the Event nodes (group Vision Center, one folder per pipeline): Count, Classes, Class, Object, Direction, In, Out and more | The pipelines of Vision Center |
| Pipeline problem (one per pipeline), Any pipeline problem | On while a vision pipeline cannot run, see Vision Center |
| Optional plugin not loaded (group Optional plugins) | On while an optional plugin must be installed again; {count} and {plugin} |
| Recipient not connected | On while an MQTT, Modbus or OPC UA recipient cannot be reached; {count} and {recipient} |
Most events are on while something is true and off again when it ends. Then the rule is on while all conditions hold, and some actions can undo themselves when the rule turns off.
Check the values
Section titled “Check the values”Many events carry values, for example the temperature of a sensor or the state of a door. Add check below the event compares one of them. The event counts only while all its checks hold, up to five per event.
| Value | Checks |
|---|---|
| Text | equals, does not equal, contains, starts with (upper and lower case do not matter) |
| Number | = equals, ≠ does not equal, > greater than, ≥ greater than or equal, < less than, ≤ less than or equal. Write decimals with a point: 21.5. For a range add two checks, Temperature ≥ 20 and Temperature < 30 |
| Yes or no | is yes, is no |
While the event is on, every new value is checked again: a temperature that rises above 40 turns the rule on, and when it falls back the rule turns off. An event that does not send the value never passes the check.
Actions
Section titled “Actions”- Set output: switches an output of the device, for example a relay. Follow the rule keeps it active while the rule is on. Pulse switches it on for a number of seconds. Set active, Set inactive and Toggle do what they say.
- Run VAPIX command: sends a saved command of the VAPIX Commander, with its values and passwords. Optionally a second command when the rule turns off, for example to hide an overlay again. Commands marked dangerous need Allow dangerous commands. Text fields of the command take placeholders.
- Send HTTP request: calls a web service, for example a webhook of Teams or Slack or a building system. Choose a recipient, then the method, query parameters, headers and a body as JSON, XML, text or form. OADM does not follow a redirect: the action fails and names where the address points to. Enter that address in the recipient.
- Send email: sends a mail to a recipient, as text or HTML.
- Publish MQTT message: publishes a message to a topic on an MQTT broker, a recipient.
- Write Modbus value: writes on or off, a pulse, a number or text to a PLC or gateway, a recipient. Addresses count from 0.
- Write OPC UA value: writes on or off, a number or text to a node of an OPC UA server, a recipient.
- Send TCP message: sends a message to a recipient, for example a building, alarm or video system that
listens on a TCP port. Text, JSON, XML or hex bytes (
02 41 42 03), with an optional line end. Wait for an answer with Answer must contain fails the action when the other side does not confirm. - Log entry: writes a message to the server log (Logs page, Server) and does nothing else. Good for testing a rule.
- Read text: reads one picture with a reader of Text recognition now and sends its Text read and No text read events. No devices to choose: the reader names its camera.
- Run pipeline: runs one picture through a pipeline of Vision Center now. Reset counter sets a counter of a pipeline back to 0.
Email, HTTP and TCP run once each time the rule turns on or fires. Check Also send when the rule turns off for a second
message when it ends; {state} tells which one it is.
Placeholders
Section titled “Placeholders”Every text of an action can hold placeholders that OADM fills in when the rule runs: the rule, the event, the device
(address, host name, model, serial number, MAC address, AXIS OS, tags, a link to its web interface) and every value of the
event, for example {objectId}. The Placeholders card next to the actions lists them; the icon copies one.
In a JSON, XML or HTML body and in a JSON or XML TCP message OADM escapes each value, so "objectID": "{objectId}"
stays valid whatever the event sends. Text sends the values as they are. A value never starts a new line in a TCP message: in
Text and XML its line breaks and tabs are left out.
Send test sends the email, the request or the message once right away, with sample values for the event and the first device of the trigger. For MQTT, Modbus and OPC UA it is off: use Test on the recipient, which only connects.
When several devices turn a rule on, an action on chosen devices (the lamp on the I/O box) switches on with the first one and off when the last one ends.
Recipients
Section titled “Recipients”A recipient says where to send, the action says what to send. Like the recipients of an Axis device, except that a rule keeps a link: change a recipient and all its rules follow.
The Recipients card sits next to the rules. New asks for the type, a name and the type’s fields:
| Type | Holds |
|---|---|
| HTTP | URL, Login (Basic, Digest or Bearer token), Allow untrusted certificates |
| Mail server, port, encryption, Allow untrusted certificates, user name, password, From, To | |
| TCP | Host, port, Use TLS, Allow untrusted certificates |
Test sends once now and shows the reason when it fails. Leave a stored password empty to keep it while the target stays. A target takes no placeholders. For a second audience, create a second recipient.
In a rule, choose the recipient in the action, or click New next to the select.
Delete is refused while a rule uses the recipient: the message names the rules to change first.
MQTT, Modbus and OPC UA
Section titled “MQTT, Modbus and OPC UA”An MQTT, Modbus or OPC UA recipient keeps one connection open, which all its rules share. It connects at the first action and closes after 5 minutes without one; a connection that failed keeps trying. The Target column shows the state, only an icon when the column is narrow, and the tooltip the reason. Test only connects, it sends nothing, and it replaces Send test for these actions.
A new recipient needs only its address. TLS for MQTT, and security and login for OPC UA, are there when you need them. Certificates come from the PKI page: import or create one there, then choose it in the recipient. OPC UA with security needs a certificate imported into PKI.
The first action waits up to 15 seconds for the connection. After that an action does not wait for a connection that is down: it fails, and the event log says why. Nothing is sent later. Use the event Recipient not connected to act on it.
Manage rules
Section titled “Manage rules”- Turn a rule on or off with its check box. Turning off a rule that is on runs its “turn off” actions, so a lamp does not stay on.
- Duplicate copies a rule, turned off, with its stored passwords.
- Delete removes a rule after a confirmation.
- The State column shows whether a rule is on and for how many devices, and when an event or action is not available because its plugin is turned off.
Event log
Section titled “Event log”The Event log below the rules and recipients lists what happened: the events your rules use, when a rule turned on, off or ran, and every action with its result. The newest entries come first and new ones appear live. OADM keeps the log for 30 days or 100,000 entries. Delete all empties it and needs the permission Delete the event log (administrators have it).
Good to know
Section titled “Good to know”- Dead time (default 10 s): after the rule ran for a device, that device is ignored for this long. Max per minute (default 60 runs per minute for the whole rule): further events are skipped. Both protect against a flickering camera. The event log notes the first skipped run of a minute, then how many more there were.
- When too many actions run at once, an action that could not start within a minute is skipped and the event log says so. An action that started runs on all its devices, however long that takes. Turning something off is never skipped. A long pulse does not keep other actions waiting, and a rule whose target does not answer does not keep the other rules waiting.
- After a server restart OADM checks every event again and runs only what changed while it was down.
- A failed action is logged; the next action of the rule still runs. OADM does not retry.
- Devices that need a login, have no password yet or have a changed certificate are skipped.