Scripts
In this section you can manage the scripts, edit them and activate or deactivate them. The deactivated scripts have no effect, nor are they evaluated in any way.
In the chapter Scripting scripting programming principles are explained in
To review the log (error log or warnings) of a script, you must enter your edit form. In the logs section you can select how many lines display and press the Sodm button at any time to update the view with new registration lines.
Scripts containing unneaked errors (including access to out-of-service devices) will generate automatic alerts informing the error.
The Scripts section shows a section for each type of supported script, in the chapter Types of scripts and self-generated blocks the differences between each type are explained.
The box button below the Help icon, serves to activate full screen mode. In this way you can work with more space and have a more global view of long scripts.
Context and available variables
To know the functionalities that can be executed, the script editor of

By pressing the Question button in the upper right corner of the scripts editor, the help panel is displayed. Once pressed, the icon changes to a cross, which serves to hide the side of aid panel again.
![]()
This panel is composed of two sections:
Objects and functions:These are methods and objects accessible from any place of the scripts globally. For example, each time you write Logger, it will be referring to the Global Logger type instance, similarly, each time you writeFormula will be calling the global function that generates a new formula.
To know which options an object has, you can click on the indication of your type (indicated between < and >) or search for the definition of the type in theTypes section.
Functions can be differentiated from objects because, instead of a type, are followed by the specification of parameters that require and, in some cases, the type of value they return.
Passing the cursor over the names of the functions and objects, you can see a description and explanation of its use.
Types: The list of types indicates all the types involved in the scripts of
In some places, types: in the types section and on the definition of objects and functions will be highlighted. By pressing on them, the panel will show the definition of this type. The closing icon becomes an arrow and when you press it return to the main section of the help.
Typing in the help
The nomenclature of tipped follows rules similar to Typescript typed language, syntax is below.
- The type of a field, object or function is at the end of the definition, following two points
:. - The parameters of a function are enclosed in parentheses and separated with coma
,, analogously to how they are used when calling the function. - A parameter in turn can define a type with two points followed by the type.
- When a parameter ends at questioning (
?), It is an optional value.
Types can be in turn:
- Basic types of JavaScript:
string,numberoboolean. anycorresponding to any kind.- Composite times, separated by
|, indicating the different base types that the value can take. For examplestring | Numberrepresents a value that can be so muchstringandnumber.
Autocomplete and assistant.
At some points, the interface of
To make use of this function, press Control and space simultaneously. If the available options can be recognized by context, a pop-up will appear below the cursor. Use the up and down arrows to select an option andenter orintro to select an option.
Syntax alerts
The editor includes a Syntax and semantic analyzer of JS. Although the analyzer is not infallible, it is very useful to pay attention to the alerts it generates. These alerts include correct uses but not recommended by being ambiguous or potentially sources of errors (recommendations on code style, reuse of variables, etc.).
When the Linter find an error will appear dialing red, underlining the affected code part and an error red circle appears to the left of the affected line number.
Editor showing an error for missing the closing parentheses.
Likewise, when an alert is produced that is not necessarily a syntactic error, the affected code is underlined in yellow and an alert triangle appears on the affected line.
Editor showing an alert when trying to access
Console, which is not defined.
Passing the cursor above the warning icon you can read active errors on the line.
Event scripts
To create event scripts, you have to do from the Programming tab. On the tabs of scheduled events orperiodic events.
At each event in the table, there is option Manage scripts that opens a modal with the list of event scripts associated with the selected event.
The event scripts are edited in the same way as generics, just keep in mind that code blocks are self-generated, without the need to instantial the event handler manually, for example, when a script is generated for a scheduled event, it will appear A script in the following way:
"use strict";
// Block "Main" editable by the user
events.addListener({ "eventName": "Timer", "timerObject": "Schedule", "timerName": "****" /* Nombre del evento programado */, "timerEvent": "StartSchedule" }, async (event) => {
// Block "StartSchedule" editable by the user
});
events.addListener({ "eventName": "Timer", "timerObject": "Schedule", "timerName": "****" /* Nombre del evento programado */, "timerEvent": "EndSchedule" }, async (event) => {
// Block "EndsChedule" editable by the user
});
Script register
The script log is accessible in the editing form of a script already created (it is not available in the creation, since there is still not that script and, therefore, does not yet record).
Under the script code you will find the script logs section where all events are recorded with your date and time and the importance they have. These events are both errors and alerts generated by the system and the utilities used within the script and the lines where the script developer has used Logger methods.

In the upper right corner of the Logs section of the script you will find a selector of number of lines to be displayed. Note that if you select a too high number it could take long to be received and displayed on your computer. The log text box is updated as soon as you change the selection of lines to be displayed.
Next to the line selector to show, you will find the refresh button. Use this button to know if the script has generated new logs since the last time you refrefted the view (this automatically occurs when you load the script edition or when you change the number of lines parameter to be displayed).

