Class
-
Default view (how to display Child Objects in SAYMON UI);
-
Dimensions of Objects in SAYMON UI;
You can’t change the Class of an entity later. |
Class model
Field | Type | Description |
---|---|---|
category_id |
String |
Class’s category ID. See a detailed description in the Category ID section. |
client_data |
String |
Class’s client data. See a detailed description in the Client data section. |
description |
String |
Class’s description |
entityType |
Integer |
Entity Type. For a class, entity type is |
id |
String |
Class’s ID. |
name |
String |
Class’s name. |
operations |
Array<Operation> |
An array of class’s operations. |
properties |
Array<Property> |
An array of class’s properties. |
triggers |
Array<Trigger> |
An array of class’s custom triggers. See the Custom Triggers section for more information. |
Client data
Client data is a set of fields that correspond to various class’s UI settings. The fields are specified in the JSON format and stored on a server as a string. The table below contains a description of all fields from the set:
Field | Type | Description |
---|---|---|
background |
String |
The ID of an image used as a class background. |
columns |
Array<ClassColumn> |
An array of class’s columns. |
default_view |
String |
Class’s default view. Available options: |
defaultDim |
Array<Integer> |
A default dimension of objects belonging to this class. Should be specified as an array of two integers, where the first one corresponds to width, the second one to height. |
Class column
Field | Type | Description |
---|---|---|
hidden |
Boolean |
Whether to hide the column. |
id |
String |
The ID of a class column. |
name |
String |
The name of a class column. |
removable |
Boolean |
Whether it’s possible to remove the column. |
type |
String |
The type of a class column. |
Category ID
The class’s Category ID is used to group child objects.
Child objects belonging to a class with the same category ID will be displayed on a parent object icon together. Child objects of classes with different category ID will be separated by a line.
This is how child objects look in the web interface:
Custom triggers
Server can execute scripts when you create or delete objects. Custom triggers define scripts that will be executed, their arguments, and when those scripts will be executed.
Custom triggers have the following fields:
Field | Type | Description |
---|---|---|
args |
Object |
JSON object that contains the set of key-value pairs with arguments that will be passed to the script. |
customScriptId |
String |
Path to the script that will be executed. |
type |
String |
When does the trigger activate. Possible values are |
You can pass the following variables into the script.
Field | Type | Description |
---|---|---|
{{body}} |
String |
Object’s body in the JSON format. |
{{class_id}} |
String |
Object’s class ID. |
{{client_data}} |
String |
Object’s Client Data. |
{{created}} |
Integer |
Timestamp of the object creation. |
{{entityId}} |
String |
Entity ID. |
{{geoposition}} |
String |
Object’s geoposition. |
{{geopositionRadius}} |
String |
Object’s geoposition radius. |
{{id}} |
String |
Object ID. |
{{last_state_update}} |
Integer |
Timestamp of the last State update. |
{{name}} |
String |
Object’s name. |
{{parent_id}} |
Array<String> |
List of parents' IDs. |
{{state_id}} |
String |
ID of the object’s State. |
{{tags}} |
Array<Tag> |
Object Tags. |
{{updated}} |
Integer |
Timestamp of the object update. |
Example
This example contains two custom triggers. The first triggers when an object is created, the second — when an object is deleted.
"triggers": [
{
"type": "create",
"args": {
";saymon-ctp-auto-id#0": "first var",
";saymon-ctp-auto-id#1": "second var"
},
"customScriptId": "test/class_trigger.sh"
},
{
"type": "remove",
"args": {
";saymon-ctp-auto-id#0": "pos var",
"--name": "{{name}}",
"--description": "Object was removed"
},
"customScriptId": "test/hello_world.sh"
}
]