System variables are variables that are related to SIA such as UUID and time.
This articles contains all the accessible system variables that can be used when scripting and processing in SIA.
Info
To identify variables they need to be wrapped in % e.g.: %TIME%.
Variables are case-insensitive
Note
The keyword value (without being encapsulated with %) will return the actual current value of the item (even before being post-processed).
Warning
For certain values, please use quotes to turn that value into a string.
If this is not done, the JS parser will also evaluate the expression.
For example, a date containing - / etc would break the parsing, showing JS errors.
UID and name referencing
Any item or instance can be referenced to by calling it by its UID or name. This makes information, parameters and values from instances and items accessible all across SIA.
| Reference | Description | Example |
|---|---|---|
| UID | An instance and item can have a UID. By referencing to this it is possible to access its variables. Check the following articles for setting UIDs for instances and items |
UID: BOTTLE_COUNTER (value variable) %BOTTLE_COUNTER.VALUE% |
| NAME | The item or instance the variable should point at can also be referenced by its name. Spaces will be replaced by _ and special characters removed. |
NAME: Speed setpoint (value variable) %SPEED_SETPOINT.VALUE% |
Warning
Referencing by name might not work as intended if multiple items or instances shares the same name or UID.
If there is a conflict between name and UID the UID.
Time variables
| %VARIABLE% | Description | Example |
|---|---|---|
| VALUE.TIME | Timestamp of the value associated to an item. | 2021-12-31T14:00:00 |
| TIME | Current system time in UTC. Default format: yyyy-MM-ddTHH:mm:ss |
%TIME% |
| TIME_UTC |
||
| NOW | 2021-12-31T14:00:00 | |
| TIME_LOCAL |
Current system time in local time. Default format: yyyy-MM-ddTHH:mm:ss |
%TIME_LOCAL% |
| 2021-12-31T15:00:00 | ||
| EPOCH_TIME | The epoch / Unix timestamp which is given in s since January 1, 1970 | %EPOCH_TIME% |
| UNIX_TIME | 1640959200 | |
| EPOCH_TIME_MS | The epoch / Unix timestamp which is given in s since January 1, 1970 given in ms | %EPOCH_TIME_MS% |
| UNIX_TIME_MS | 1640959200000 |
Formatting of time
Time variables can be formatted so you can tailor and format so it matches into your requirements and needs.
In order to use time format you have to apply .FORMAT to the time format:
%TIME.FORMAT("yyyy-MM-ddTHH:mm:ss")%
%VALUE.TIME.FORMAT("yyyy-MM-ddTHH:mm:ss")%
The following tables shows all the format specifiers:
| Format specifier | Description |
|---|---|
| d | The day as number without a leading zero (1 to 31) |
| dd | The day as number with a leading zero (01 to 31) |
| ddd | The abbreviated localized day name (e.g. 'Mon' to 'Sun') |
| dddd | The long localized day name (e.g. 'Monday' to 'Sunday') |
| M | The month as number without a leading zero (1-12) |
| MM | The month as number with a leading zero (01-12) |
| MMM | The abbreviated localized month name (e.g. 'Jan' to 'Dec') |
| MMMM | The long localized month name (e.g. 'January' to 'December') |
| yy | The year as two digit number (00-99) |
| yyyy | The year as four digit number |
| Format specifier | Description |
|---|---|
| h | The hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display) |
| hh | The hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display) |
| H | The hour without a leading zero (0 to 23, even with AM/PM display) |
| HH | The hour with a leading zero (00 to 23, even with AM/PM display) |
| m | The minute without a leading zero (0 to 59) |
| mm | The minute with a leading zero (00 to 59) |
| s | The second without a leading zero (0 to 59) |
| ss | The second with a leading zero (00 to 59) |
| z | The milliseconds without leading zeroes (0 to 999) |
| zzz | The milliseconds with leading zeroes (000 to 999) |
| AP or A | Interpret as an AM/PM time. AP must be either "AM" or "PM" |
| ap or a | Interpret as an AM/PM time. ap must be either "am" or "pm" |
Internal variables
| %VARIABLE% |
Description |
Example |
|---|---|---|
| UUID |
The system UUID |
%UUID%d20c87c7-7fc5-4705-941b-c1c0e88facb6 |
| SYSTEM_VERSION | Installed version of the SIA Connect system software. | %SYSTEM_VERSION%1.1.0
|
| INSTANCE_COUNT | Number of instances / devices on the system. | %INSTANCE_COUNT%5
|
| DEVICE_COUNT | Number of instances / devices on the system. | %DEVICE_COUNT%5
|
| ITEM_COUNT | Number of total items across all instances on the system | %ITEM_COUNT%243
|
| ONLINE | Indicates whether the gateway can reach the configured connectivity check IP address. This does not indicate whether hostnames can be resolved. | %ONLINE%truefalse
|
| RAM_AVAILABLE | Amount of physical memory currently available on the system given in kB. | %RAM_AVAILABLE%1000000 (1.000 MB / 1 GB) |
| RAM_TOTAL | Total installed physical memory on the system given in kB. | %RAM_TOTAL%100000000 (100.000 MB / 100 GB) |
| SYSTEM_UPTIME | Time elapsed since the system was last started or rebooted given in seconds. | %SYSTEM_UPTIME%12242 (3H 24M 2S) |
| STORAGE_AVAILABLE | Free storage space available on the primary system drive given in MB | %STORAGE_AVAILABLE%245000 (245.000 MB / 245 GB) |
| STORAGE_TOTAL | Total capacity of the primary system drive given in MB | %STORAGE_TOTAL%632000 (632.000 MB / 632 GB) |
| CPU_COUNT | Number of logical CPU cores available to the operating system. | %CPU_COUNT%4
|
| CPU_SPEED | Current or nominal processor clock frequency given in MHz | %CPU_SPEED%1600 (1.600 MHz / 1.6 Ghz) |
| CPU_LOAD_TIME_15MIN | Average CPU load over the last 15 minutes given in percentage. |
%CPU_LOAD_TIME_15MIN%
|