Actions are things you want Agent to do when something happens, like when an alert is generated by a camera/ AI or a device disconnects. To get to the Actions settings, edit a device and select Actions in the menu.

Click Add to add a new action and you will see a screen like:

There are a lot of events you can use to trigger actions. You can add multiple actions to each event and use various tags within those actions to generate dynamic actions.

Configuring an Action
  • Active: Switch this action on or off (you can also use the Schedule and the API to do this with the command actionOn, actionOff and actionRun using the ID displayed above).
  • If: Select an available event (see below)
  • With tag: (AI Events). This is primarily used with AI events. For example if you chose AI: Object Found and entered cat here then this action will only fire when a cat is found.
  • In Zones: (AI Events). Choose the motion zones (from the motion detection tab) to use to filter the detected objects. For example you could select zone 1 and cat above and this action will only fire when a cat is found in zone 1. Leave this field blank to run the action on all zones.
  • Repeat Timeout: This supresses the event if it's been raised in this interval. It also resets the timer. So for example if you have a stream of cars going by and are alerting on Vehicle detected and have this set to 30 it will send 1 alert and then no more until there's been a continuous 30 second gap in the traffic.
  • Add Task Click to add the task. You can add as many tasks as you like to an action (v4.5.5.0+).

Available Events

The events you can set up actions for are:

  • AI: Face Recognized
  • AI: Face Not Recognized
  • AI: License Plate Recognized
  • AI: License Plate Not Recognized
  • AI: Object Found
  • AI: Object Not Found
  • AI: Sound Recognized (mics only)
  • Alert
  • Alert Finished
  • Manual Alert
  • Motion Detected
  • Motion Finished
  • None - use this if you want to trigger actions with "Alert Action Run" command on the schedule
  • ONVIF Logical State ON - use this to for example start and stop recording based on ONVIF logical state updates (requires the motion detector type to be set to ONVIF)
  • ONVIF Logical State OFF
  • Photo Taken
  • PTZ Preset Applied
  • Reconnect Failed
  • Recording Finished
  • Recording Started
  • Source Disconnected
  • Source Reconnected
  • Switch Object Off
  • Switch Object On
  • System: UI Connected - when someone opens a browser to view your system)
  • System: UI Disconnected - when the session is closed (happens roughly a minute after the browser disconnects)

Adding Custom Events

In addition to these pre-set events you can add your own by adding Tasks. The task will then be listed in Events You can then add an Action for that task. You can trigger tasks via the Live page in the UI (by clicking on a camera and then on the task icon at bottom left) or by using Action: Run in the Schedule.

Available Tasks

The list of available actions you can perform (under Then) is:

  • Alert - triggers an alert on the device
  • Beep - plays beep through local PC speaker
  • Call URL - call any URL with an optional Auth token. You can call the Agent API here. If you have Protect API checked in server settings you will need to provide an authorization header. To do this you will need to add a User Account via Server Settings and enter a Basic Auth Header value:
    BASIC YWRtaW46YWRtaW4=
  • Execute Command
    Also see commands
    To add your own commands/ scripts you can add .bat or .sh files into the Commands directory. You can then pass parameters into the batch file. For example, to copy all photos to the root of the D drive:

    Create a plain text file containing:
    copy %1 D:\
    Save it as copyPhoto.bat (on linux use .sh - you will need to make this file executable using chmod +x) to Agent Directory/Commands
    Then add an action:
    if: "Photo Taken"
    then: "Execute Command"
    File: copyPhoto
    Parameters: "{FILENAME}"

  • Go to Preset (PTZ Preset)
  • MQTT - send an MQTT message
  • MQTT Image - send a raw live image in jpeg bytes to a topic
  • Network Message
  • RTMP Start - start RTMP streaming for this device
  • RTMP Stop - stop RTMP streaming for this device
  • Send Email (with optional image attachements)
  • Send Email with video (specify duration - this includes a buffer of the event). v4.9.8.0+
  • Send Push Notification
  • Send SMS
  • Set Motion Detector Area (select the Area you defined on the Detector)
  • Show Message - displays message on viewing web browsers
  • Sound (on Agent computer)
  • Sound (through Camera)
  • Sound (through web browser)
    Due to browser security this requires interaction with the web page first (eg clicking on something). To work around this in chrome go to chrome://settings/content/sound and add the address of your server (or our website if you are using the remote portal) to the Allowed List.
  • Start Recording On (some device) - will record until stopped.
  • Start RTMP Streaming.
  • Start Timelapse On (some device)
  • Stop Recording On (some device)
  • Stop RTMP Streaming
  • Stop Timelapse On (some device)
  • Switch Object On
  • Switch Object Off
  • Switch Profile
  • Text to Speech (on Agent computer - requires an account as text is rendered via webservice calls)
  • Text to Speech (through web browser)
    Due to browser security this requires interaction with the web page first (eg clicking on something)
  • Text to Speech (through camera)
  • Trigger Alert On (another device)
  • Trigger Detect On (another device)
  • Trigger Face Recognition On (another device)
  • Trigger LPR Recognition On (another device)
  • Trigger Object Recognition On (another device)
  • Trigger Recording On (another device). This will record up to the trigger recording timeout setting on the Recording tab. This timeout resets with every trigger recording action call.

Using Tags

You use tags in the Then fields to create dynamic actions. Some of these tags are only available under certain conditions. For example, {FILENAME} isn't available for the Alert Event and {AI} isn't available if an AI server hasn't generated the event.

  • {ID}: The object ID. When you edit a camera or microphone in Agent this is displayed at top left of the editor.
  • {OT}: The object type ID. 1 = Microphone, 2 = Camera
  • {FILENAME}: The filename. This applies to events like Recording Started, Recording Finished and Snapshot Taken. It's the full local path to the file.
  • {MSG}: The event name that triggered the action, for example "Manual Alert"
  • {NAME}: The name of the device (on the General tab)
  • {GROUPS}: The groups the device belongs to (on the General tab)
  • {LOCATION}: The location the camera is in (on the General tab)
  • {LEVEL} and {DB}: The motion or audio level (DB is decibel level for audio devices). This is measured at the point the action runs. (v4.3.7.0+)
  • {AI}: Comma separated list of detected objects from AI, plates from LPR or detected faces from Facial Recognition
  • {AIJSON}: JSON data returned from DeepStack or LPR
  • {ZONE}: The zone the action was triggered from (empty if not using AI or a csv list if multiple zones triggered like 1,2,3)
  • {BASE64IMAGE}: Live image data URL. This is the raw base64 encoded bytes so you may need to pass it in a parameter like
    (available v4.5.9.0+)

For example, you could have an event AI: Face Recognized with a Then task Text to Speech with the Text

Hello {AI}
which will say hello <NAME> to everyone it recognizes.

If you are using trigger alert on actions, make sure there is no cyclical route - ie, on Camera 1 alert, Camera 1 triggers alert on Camera 2 which triggers alert on Camera 1.

When you have added an action the table control displays a list of your actions:

Example Action Table

The green tick indicates that the action is active and the text gives you a summary of what the action does.

TIP: You can use the scheduler to enable and disable actions or trigger an action.

Schedule Actions

In this example we added an action to send an email with 2 grabs with the event set to None. We then added a schedule entry to execute that action at 8AM on Sunday and Saturday.