The Automation Editor section allows the user to create and edit automation scripts.
There are a variety of options available in the editor, which will be discussed below.
General Functions
In the general functions section, the following actions are available:
Name -The name of the automation can be changed if necessary.
Assets - The assets on which the automation will be activated can be changed.
Timing - If you need to use a schedule plan other than what is offered by the system, you can use one of the many tools available online to convert CRON expressions to readable text format.
Active - Activate the automation if needed.
Add Fields
By using the Add Fields tab, the user can select the live and summary fields/keys to be embedded in the script.
Live Data will displayed as: “DATA: {Field.Name}”
Summary Data will displayed as: “SUMMARY: {Field.Name}”
Add Functions
The common functions list represents the commands that Galooli currently supports. The followings are the commands and their explanations:
Asset Iteration
Implements a loop that iterates on all the units by using the {MAIN-LIST} and {ACTIVE-ID} keywords. An action can be done to each unit by using the {ACTIVE-ID} keyword (for example await Galooli. Log({ACTIVE-ID}) inside the for each loop)
{MAIN-LIST} - The main list of ids (usually the unit ids) of all objects that the script is about to execute
{ACTIVE-ID} - The current id (one of the values from {MAIN-LIST}).
Accessing the unit's data - {DATA:unique_id} - By using this keyword, the user can retrieve a value of one of the current unit's properties.
For example, if the user uses the keyword {DATA:unit_name}, the value returned will be the name of the unit.
foreach (string {ACTIVE-ID} in {MAIN-LIST}) { }
Send SMS
The user can send a text message to a number (or a list of them separated with ‘,’ or ‘;’, without spaces).
Sending SMS through My Automations will be done through the service provider defined for each organization.
await Galooli.SendSMS(/*Numbers to send to seperated with ';' or ','*/, /*Message to send*/);
Send Email
The user can send an email to a recipient (or a list of them separated with ‘,’ or ‘;’, without spaces)
await Galooli.SendEmail(/*Adresses to send to seperated with ';' or ','*/, /*Email title*/, /*Email body*/);
There are several ways to activate the ”Send Email” function:
Using the Galooli design in an email:
await SendEmail(“some.one@example.com”, “Test”,”Test”, true);
Sending of an email without design:
await SendEmail(“some.one@example.com”, “Test”,”Test”, false);
Set State
The user can save a value to a variable for future executions. Note that the TTL of each variable is 1 hour, so the user can only use variables that were created in previous executions from the last hour.
bool success = await Galooli.SetState(/*Key*/, /*Value*/);
State variables that are "global" may be used in multiple runs of the same script. In order to accomplish this, save a variable as the "Set State" function as follows:
bool success = await Galooli.SetState(“SomeKey”, “SomeValue”, isGlobal: true);
Get State
The user can retrieve a value of a variable saved in a previous execution
string result = await Galooli.GetState(/*Key*/);
It is possible to obtain the value stored for a "global" variable by calling the "Get State" function as follows:
string value = await Galooli.GetState(“SomeKey”, true);
Delete State
The user can delete previously saved state variables
bool deleteSuccess = await Galooli.DeleteState(/*Key*/, /*Is the key global (Optional)*/);
To delete a "global" variable using the “Delete State” function, you should call it as follows:
bool success = await Galooli.DeleteState(“SomeKey”, true);
Log Message
The user can log a message in runtime – usually for debugging purposes. Can be viewed in the execution logs. Note that the length of the log line limited to a maximum of 1000 characters in the code.
await Galooli.Log(/*Message*/);
Send Unit Command
The user can send a command to a specified unit. The requests available are:
Output | Location | Generator | Inverter |
---|---|---|---|
{ "output-immobilize", true} | { "location-location", true} | { "generator-engine_start", true} | inverter-inverter_on.x (1-25) |
{ "output-mobilize", true} | { "generator-engine_stop", true} | inverter-inverter_off.x (1-25) | |
{ "generator-mode_auto", true} | inverter-inverter_reset.x (1-25) | ||
{ "generator-mode_stop", true} | |||
{ "generator-mode_manual", true} | |||
{ "generator-alarms_reset", true} | |||
{ "generator-engine_start.2", true} | |||
{ "generator-engine_stop.2", true} | |||
{ "generator-mode_auto.2", true} | |||
{ "generator-mode_stop.2", true} | |||
{ "generator-mode_manual.2", true} | |||
{ "generator-alarms_reset.2", true} |
await Galooli.UnitCommand(/*Unit id*/, /*Command*/);
Set Value
This method is used to set the value of the unit. The values that can be set are information fields (below "Unit" or "Additional Information").
await Galooli.SYS_SetValue(/*Unit id*/, /*The unique identifier of the field to set*/, /*The value to set*/);
Additional Automation Functions
Upload - An automation C# code can be uploaded as a text document by the user. The code will appear in the “Automation Log”
Download - It is possible for the user to download the code, mainly for the purpose of sharing it with others or modifying it and re-uploading it. If no code has been uploaded previously or has been written and saved from the “Automation Log”, the download button will not be available
Verify - An option to verify the executability of the code by compiling it. If the verification fails, the following message will appear:
Execute - In this case, the automation will be executed immediately, rather than according to a schedule. The main objective is to ensure that the code actually performs as expected
Light Mode - Modifies the background of the code section.