Chains of Commands. DateTime parameter

Chains of Commands

The Onebrella service has the ability to send chains of commands to objects. This simplifies the work when it is necessary to send a sequence of commands to the device. Chain commands are sent one after another to the device. After sending the last chain command in the service, an event is generated for the object with the chain-command name. That is, events in the object are generated for the entire chain, and not for each command in this chain.

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"}
]}

To the types of attributes parameters ("text", "number", "select") the type "datetime" is added. If it is necessary to transmit date and/or time data in a command, it simplifies the task of setting the date. The "datetime" parameters have two additional attributes “format” and “out_format”. The “format” attribute defines the date format in the input field, and the “out_format” attribute defines the format in which the given date will be transmitted in the command.

Example:

{ "id":"p1", "type":"datetime", "name":"Date,time", "format":"DD-MM-YYYY hh:mm:ss", "out_format":"DDMMYYhhmmss"}