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)
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*/);