Function fireTrigger()

fireTrigger(triggerCodeName, explanation = '')

Description

Call this to set an alarm/trigger to be active.

Causes a trigger of an alarm to fire — in other words, for the trigger status to become True, and for any linked procedure to be enacted.

triggerCodeName specifies the code name of the alarm trigger. An alarm trigger in the AssetWolf portal should be created with this code name before the Phi script referring to it can run.

explanation is the text that will be passed to the trigger when it is fired. It can contain variables from the Phi script (e.g. the current temperature etc.). This text will be available to the called procedure, so that it can form the body of an email or SMS. To do this, use a merge field in the procedure with the text [[explanation]] (note the square brackets).

If an alarm trigger is configured with the "Triggered from the Phi script in the schema" option, then running the fireTrigger() function in the Phi script for an asset or data pool will cause the trigger status to become True, in other words, that an alarm begins.

If the script runs again (e.g. when more data is received or bubbles up) and fireTrigger() is called again while the status of that trigger is already True, there will be no further effect, and linked procedures will not be re-run. However if the Phi script runs and the fireTrigger() function is not called again, then the alarm trigger will end and any end-of-alarm procedures will then be called.