<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="http://docs.optrix.com.au/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>ARDI Documentation - trigger</title>
        <description></description>
        <link>http://docs.optrix.com.au/</link>
        <lastBuildDate>Wed, 27 May 2026 01:32:47 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>http://docs.optrix.com.au/_media/wiki:dokuwiki.svg</url>
            <title>ARDI Documentation</title>
            <link>http://docs.optrix.com.au/</link>
        </image>
        <item>
            <title>Writing a Basic Trigger</title>
            <link>http://docs.optrix.com.au/trigger:a_basic_trigger</link>
            <description>Writing a Basic Trigger

ARDI Trigger makes use of function decorators to make each of your triggered functions easy to read.

Creating the File

First, we start off with a basic Python file that imports the arditrigger module. We will call this file</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Backfill</title>
            <link>http://docs.optrix.com.au/trigger:backfill</link>
            <description>Backfill

arditrigger.Backfill is used to start back-filling data using your trigger(s).

You can also use BackfillLocal to pass local (rather than UTC) dates.

Parameters
NameDefaultMeaninghostlocalhostThe ARDI host namesitedefaultThe ARDI database/site</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Backfilling</title>
            <link>http://docs.optrix.com.au/trigger:backfilling</link>
            <description>Backfilling

Not to be confused with the similarly named BackTracking, backfilling allows you to run your triggers across previous times in history.

This is particularly useful when you&#039;ve introduced new types of reports or analytics, as they allow you to generate them for times in the past, not just for times in the future.</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>BackTracking</title>
            <link>http://docs.optrix.com.au/trigger:backtracking</link>
            <description>BackTracking

When your Trigger service is started, it may end up being in the middle of an event. 

If the trigger condition has already been met when the program starts, the system doesn&#039;t have any idea when the event began.

BackTracking tries to fill-in-the-blanks by doing a reverse search through history, looking for the most recent time there was a change in the value of your</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Batch Reporting Example</title>
            <link>http://docs.optrix.com.au/trigger:batch_reporting_sample</link>
            <description>Batch Reporting Example

This is a more complete example that actually does something with the data.

Whenever the batch code changes (and is not zero), a report will be created 


#Import Trigger Libraries
import arditrigger
from arditrigger import trigger,data,delay,when,timer,risingedge

#Misc Libraries
import datetime

#Reporting &amp; Query Libraries
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import mplreport
import ardiapi as ardi</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Changed</title>
            <link>http://docs.optrix.com.au/trigger:changed</link>
            <description>Changed

The Changed function is part of the Trigger class. 

It returns true if any of the value(s) have changed between now and the last time the trigger was executed (ie. the last time the function returned &#039;true&#039;).

The function has an optional parameter. If</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Condition Function</title>
            <link>http://docs.optrix.com.au/trigger:condition_function</link>
            <description>Condition Function

There are two key functions when you want to create a triggered event. The condition function and the trigger function.

The trigger function is the function that gets called when your condition function changes state (such as going from &#039;False&#039; to &#039;True&#039;),</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Condition</title>
            <link>http://docs.optrix.com.au/trigger:condition</link>
            <description>Condition

The Condition function is part of the Trigger class. 

It returns the current state of the condition that triggers the function.

This is primarily used when you&#039;re triggering on both types of edge (ie. the function is being called both when the condition becomes</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>List of Decorators</title>
            <link>http://docs.optrix.com.au/trigger:decorators</link>
            <description>List of Decorators

@trigger

This must be the first decorator - it marks the function as a trigger function that needs to be added to the system.


@trigger


@data

Takes an array of point names as a parameter. These are the points of data that will be loaded from ARDI. They can be used in both your</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Dynamic Attachment</title>
            <link>http://docs.optrix.com.au/trigger:dynamic_attachments</link>
            <description>Dynamic Attachment

Trigger can use the same Dynamic Attachment feature used in Agency.

This means that you can create a number of different instances of your trigger by attaching them to ARDI assets.

For example, you can create a trigger that logs when a door is opened or closed, then attach that to</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Edge Modes</title>
            <link>http://docs.optrix.com.au/trigger:edge_modes</link>
            <description>Edge Modes

There are three distinct modes for a trigger - it can be called on the rising edge, the falling edge or both edges.

In this case &#039;edge&#039; means when the trigger condition (for example, that the temperature is higher than 70 degrees) changes.</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Event Alerting Example</title>
            <link>http://docs.optrix.com.au/trigger:event_alerting_example</link>
            <description>Event Alerting Example


import datetime
import traceback
import arditrigger
from arditrigger import trigger,data,when,changes,attach



@trigger                      #This is a trigger function
@changes                   #This gets called on every change
@data(&#039;{0}.Power&#039;)     #This needs the &#039;Power&#039; property from the attached asset
@attach(&#039;type&#039;,&#039;Wind Turbine&#039;)   #This is connected to each of the turbines, in order
@when(lambda o: o.GTHist(float(o.Value()),2200,100))  #Trigger when the power …</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>FirstRun</title>
            <link>http://docs.optrix.com.au/trigger:firstrun</link>
            <description>FirstRun

The FirstRun function is part of the Trigger class. 

It returns True if this is the first time the trigger has been executed.

This is primarily used when you&#039;re triggering on both types of edge (ie. the function is being called both when the condition becomes</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>GetARDIAPI</title>
            <link>http://docs.optrix.com.au/trigger:getardiapi</link>
            <description>GetARDIAPI

The GetARDIAPI function is part of the Trigger class. 

It gives you access to a shared ARDI API class that allows you to perform queries on the ARDI server that the Trigger system is connected to.

Parameters

No Parameters

Example


api = ob.GetARDIAPI()
#Make AQL queries here.</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>GTHist</title>
            <link>http://docs.optrix.com.au/trigger:gthist</link>
            <description>GTHist

The GTHist function is part of the Trigger class. 

It allows you to perform a simple &#039;greater than&#039; comparison that includes hysteresis, to prevent your condition function from flickering on and off when values are near thresholds.

Parameters
NameDescriptionvalueThe value you want to compare</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Trigger Service Parameters</title>
            <link>http://docs.optrix.com.au/trigger:interactive_command-line_parameters</link>
            <description>Trigger Service Parameters

Scripts using the Interactive ARDI trigger option can take command-line parameters to control what they do.

Parameters

From Date (FRM)

The starting date for back-filling. This runs all of your triggers over the data from history.</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Interactive</title>
            <link>http://docs.optrix.com.au/trigger:interactive</link>
            <description>Interactive

arditrigger.Interactive is used to turn your script into something that can be used as a service or through command-line parameters.

Parameters
NameDefaultMeaninghostlocalhostThe ARDI host namesitedefaultThe ARDI database/sitenameARDI Trigger Application</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Log</title>
            <link>http://docs.optrix.com.au/trigger:log</link>
            <description>Log

The Log function is part of the Trigger class. 

The function takes one parameter - a string with the message you want to record to the log. 

Note that the date and time is automatically added to the line - there&#039;s no need to add this yourself.</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>LogEvent</title>
            <link>http://docs.optrix.com.au/trigger:logevent</link>
            <description>LogEvent

The LogEvent function is part of the Trigger class. 

Parameters
ParameterMeaningMessageThe text message to logDurationThe length of the event, in secondsOffsetThe offset - in seconds - between the end of the range and the end of the recorded event. The default is 0</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>LTHist</title>
            <link>http://docs.optrix.com.au/trigger:lthist</link>
            <description>LTHist

The LTHist function is part of the Trigger class. 

It allows you to perform a simple &#039;less than&#039; comparison that includes hysteresis, to prevent your condition function from flickering on and off when values are near thresholds.

Parameters
NameDescriptionvalueThe value you want to compare</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Name</title>
            <link>http://docs.optrix.com.au/trigger:name</link>
            <description>Name

The Name function is part of the Trigger class. 

It returns the name of the trigger as a string.

This is primarily used if you&#039;re attaching your trigger to assets dynamically.</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>OldValue</title>
            <link>http://docs.optrix.com.au/trigger:oldvalue</link>
            <description>OldValue

The OldValue function is part of the Trigger class. 

It returns the previous data value from ARDI, where &#039;previous&#039; means the values in the Values array the last time your function was called.

These are in the order that you specified in the &#039;@data&#039; decorator for your function.</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>OldValues</title>
            <link>http://docs.optrix.com.au/trigger:oldvalues</link>
            <description>OldValues

The oldvalues array is part of the Trigger class. 

It contains all of the values delivered from ARDI the last time the calling function was run. These values are in the order that you specified in the &#039;@data&#039; decorator for your function.

Note that if the previous event</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Output</title>
            <link>http://docs.optrix.com.au/trigger:output</link>
            <description>Output

The Output function is part of the Trigger class. 

It allows you to record a value to the Modular Output System.

Parameters
NameDescriptionKeyThe name of the point, May include &#039;/&#039; characters to form a hierarchyValueThe value to storeTagsOptional - An array of tag strings that describe the value</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Range</title>
            <link>http://docs.optrix.com.au/trigger:range</link>
            <description>Range

The Range function is part of the Trigger class. 

It returns a tuple of two datetime values. The first is when the trigger last occurred, and the second is the current date.

Note that if backtracking has not worked or is unavailable, the start date might be None</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Reference</title>
            <link>http://docs.optrix.com.au/trigger:reference</link>
            <description>Reference

When you create a function to be triggered, it takes a single parameter - a Trigger object.

You can also decorate the function with a variety of different decorators that change its behaviour.

Trigger

The trigger decorator is always required - it marks the function as something to be triggered by a data-driven event.</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Running Triggers as a Service</title>
            <link>http://docs.optrix.com.au/trigger:run_as_a_service</link>
            <description>Running Triggers as a Service

You can run your ARDI Trigger script as a service in Windows and as a daemon in Linux.

Make sure you finish your script with a call to Interactive rather than Start or Backfill.

Call your script with the --last parameter, specifying the path to a file that the system uses to record the most recent update. Ensure that this file can be written to and read by the user your service/daemon will run as.</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Start</title>
            <link>http://docs.optrix.com.au/trigger:start_function</link>
            <description>Start

arditrigger.Start is used to start monitoring your triggers using live ARDI data.

Parameters
NameDefaultMeaninghostlocalhostThe ARDI host namesitedefaultThe ARDI database/siteservicenameARDI TriggerThe name of the application (used in outputs)</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>ARDI Trigger</title>
            <link>http://docs.optrix.com.au/trigger:start</link>
            <description>ARDI Trigger

Trigger is a small Python library that allows you to create triggered responses. These responses can be based on live ARDI data, or the current time.

It allows you to do practically anything in response to changes or patterns in your live data. While</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Launching your Triggers</title>
            <link>http://docs.optrix.com.au/trigger:starting_trigger</link>
            <description>Launching your Triggers

At the end of the file containing your triggers, you need to start the trigger engine itself.

This can be done through three different commands.

Start is used to start your triggers running on live data. 

Backfill is used to back-fill a region of time.</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Trigger Function</title>
            <link>http://docs.optrix.com.au/trigger:trigger_function</link>
            <description>Trigger Function

There are two key functions in the system.

The Trigger Function is the function that gets called when you condition function returns true.

For example, if you wanted to send an SMS to someone when the outside temperature was greater than 40 degrees, the</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Trigger</title>
            <link>http://docs.optrix.com.au/trigger:trigger</link>
            <description>Trigger

The Trigger class is the main class you&#039;ll be interacting with using the Trigger system.

It is passed to both the function you want to be triggered, and to the condition that determines if the function should be called.

Member Variables

Values</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Value</title>
            <link>http://docs.optrix.com.au/trigger:value</link>
            <description>Value

The Value function is part of the Trigger class. 

It returns an up-to-date data value from ARDI. These are in the order that you specified in the &#039;@data&#039; decorator for your function.

The function has an optional parameter of the index in the array you&#039;d like to read. If you don&#039;t specify, it assumes you want the 0th index.</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
        <item>
            <title>Values</title>
            <link>http://docs.optrix.com.au/trigger:values</link>
            <description>Values

The values array is part of the Trigger class. 

It contains all of the up-to-date values delivered from ARDI that you specified in the &#039;@data&#039; decorator for your function.

NOTE: The &#039;values&#039; buffer is actively updated with new data as it changes. If you are going to use data from the values array or</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 18 Dec 2025 22:50:17 +0000</pubDate>
        </item>
    </channel>
</rss>
