Object commands

  1. Object commands

Preset Commands

For some types of devices, there is a set of preset commands. Work with preset commands may be blocked. To do this, in the title of the command list panel, click on the "Settings" icon and uncheck the "System/Command" checkbox. Custom commands in the list start with the "Edit" icon.

Custom commands

When creating a command, you must specify its name and body. Commands of two types are provided: simple and command with parameters. In simple commands, the content specified in the body of the command is sent to the device as is. Commands with parameters should be created in the form of a JSON block. If the body of the command begins with the symbol "{" and ends with the symbol "}", the system treats this command as a command with parameters.

Mandatory attributes of the root JSON are:

An optional attribute in the root JSON is the help attribute. It allows you to display additional information text in the "parameters filling" window.

Each element of the parameter array must contain the required attributes:

Elements of the parameter array may contain optional attributes:

Example:


{"body":"display %p1 color=%p3, int:%p2",
"help":"This is complex command",
"params":[
{ "id":"p1", "type":"text", "name":"Message","help":"min 1 max 10 symbols","range":"1:10"},
{ "id":"p2", "type":"number", "def":"3","name":"Interval","range":"2:5","help":"number from 2 to 5"},
{ "id":"p3", "type":"select", "name":"Color","options":"R:Red;G:Green;B:Blue"}
]}

Some types of devices require sending IMEI or password in the command. In this case, the substrings %IMEI and/or %PSW must be included in the template. Parameters for them do not need to be defined. These values ​​will be automatically filled by the system when sending commands to the device.

If you mark the checkbox "without confirmation" in the command editing panel, then additional confirmation for sending the command is not required.

Chain of Commands

The process of creating and editing command chains is similar to the process of creating a command. The command delimiter in the chain is the substring %EOC%.

An example of a simple chain with commands without parameters:


 $$,%IMEI,stop%EOC%$$,%IMEI,alarm

An example of a chain commands with parameters:


{"body":"CTRL/TEMPERATURE/R1 %p1%EOC%CTRL/TEMPERATURE/R2 %p1%EOC%CTRL/NLIGHT ON%EOC%CTRL/NIGHTLIGHT/COLOR %p2",
"help":"Setting the temperature in rooms 1,2 and turning on the night lamp with a given color",
"params":[
{ "id":"p1", "type":"number", "def":"26","name":"Temperature","range":"18:28"},
{ "id":"p2", "type":"select", "name":"Color","options":"R:Red;G:Green;B:Blue"}
]}
Back Directory

top