Automations Tab
Automations in the Hark Platform are a powerful way to express rules, business processes and integrations using the telemetry sent to the Hark Platform.
Automations can belong to a piece of Equipment, but can also exist Organization-wide.
Automations contain Triggers, Conditions and Actions. These concepts allow you to control what should cause your Automation to run, under what Conditions it can run, and what to do when the Automation has been triggered.
Triggers, Conditions and Actions
Triggers

A number of triggers are available, these are the conditions which must be met, in order for an automation to be carried out.
- On Alarm (Legacy) - Trigger this Automation when an Alarm (Legacy) is Activated, Updated or Cleared.
- On a Schedule - Trigger this Automation when on a schedule specified using a Cron expression.
- On Event - Trigger this Automation when an Event is raised that matches an Event configuration.
- On MQTT Message - Trigger this Automation when an MQTT is received that matches the specified configuration.
- On Numeric Value - Trigger this Automation when a number goes outside of the configured tolerance.
- Calculate Template - Trigger this Automation when a configured template resolves on an interval.
- User Defined Function - Trigger this Automation when a configured UDF resolves to true on an interval.
- On Value Change - Trigger this Automation when a value changes between configured options.
- On Webhook Received - Trigger this Automation when a Webhook is received that matches the specified configuration.
For most typical use cases, either on Numeric Value, On Value Change, or on a Schedule will be suitable.
Conditions

Conditions allow for more fine grained control over when automations occur. For example, if the automation Trigger is set to occur once a day, but only want the automation to actually run if a certain value is above a threshold, an, If Value Matches condition should be added here.
- Condition Group - Group a set of Conditions with an operator to build more complex conditions.
- If Numeric Value - Only trigger this Automation when a number goes outside of the configured tolerance.
- User Defined Function - Only trigger this Automation when a UDF resolves to true.
- If Value Matches - Only trigger this Automation when a value matches the value configured.
- Time of Day Condition - Only trigger this Automation when the time of day matches the configured bounds.
- If Alarm (Legacy) - Only trigger this Automation when an Alarm (Legacy) matches the specified configuration.
- Calculate Template - Calculate the outcome of a Scriban template.
Actions

Actions are where your desired automation are carried out. There are a wide number of possible actions, detailed below.
- Alarm (Legacy) - Activate, Update or Clear an Alarm (Legacy)
- Raise Event - Raises an Event with the given name and attributes.
- Send Event Hub Message - Sends a message on an Event Hub with a configured name with an optional payload.
- Make HTTP Request - Makes a HTTP request of the specified configuration.
- Send MQTT Message - Sends an MQTT request on a configured topic with an optional payload.
- Set Model Property Value - Sets the value of a Model Property
- Send an SMS - Sends an SMS to a list of configured phone numbers.
- Send an Email - Sends an Email over SMTP to the configured email addresses.
- Set State Value - Sets the value of a Twin Engine State variable.
- Trigger an Automation - Triggers another Automation with an optional set of variables.
- Run User Defined Function - Runs a JavaScript User Defined Function to perform custom actions.
Creating an Equipment Automation in Explorer
In the Explorer module, you can create an Automation on an individual piece of Equipment by navigating to the Equipment of interest, clicking on the "Automations" tab, then clicking "+ Create".

You'll then be able to add Triggers, Conditions and Actions as described in the sections above.

Viewing and Managing Equipment Automations
When viewing Equipment in the Hark Platform, click on the Automations tab to view the Automations against the Equipment you are viewing.
You'll see each Automation's name and description, and how many Triggers, Conditions and Actions the Automation has.

When hovering over an Automation in the list, you can use the "bin" icon on the left to delete the Automation. Clicking on the Automation will show you the details of the Automation.
