Features of models for different protocols
MQTT
Arguments
In the case of MQTT, the data source for an argument is the topic on which the device sends the value of this parameter.
For example, if a device sends a humidity value in a packet with the topic
base/state/humidity
, then it is this topic that needs to be specified as the
source in this parameter.
To send multiple parameters in one packet, use the
JSON format when building the payload. For example, to send two coordinates in one
packet by specifying the top as base/state/pos
, and the payload as
{ "lat": 55.55, "lon": 33.33 }
So how do you parse such a complex package by model? The parameter with the data type Object:
- Create an argument with the Object data type, specify in the source the topic, for which you expect data - in this case base/state/pos. Set some identifier - for example, pos.
-
Create two more nodes - under each field from the JSON. In this case, these are the nodes for Latitude and Longitude. For each of these parameters, specify the data type, corresponding to the type of these values in JSON. In our package, coordinates are passed as numbers, so specify the Number data type.
-
form the source of each node in the form of <identifier_of_node_with_object_type>.<necessary_field_from_json>. For coordinates from the example, the sources are pos.lat and pos.lon.
If you specify arguments for fields from JSON a level below the argument-object, then the argument-object will act as a subsystem and will not be displayed in the interface. will not be displayed in the interface.
If the arguments for fields from JSON are at the same level as the argument-object, then the object interface will display as arguments for the fields (in this case as numbers) as well as the argument to the object (as a string of JSON).
Actions
In the case of MQTT, when completing an action, select PUBLISH in the SEND field (Publish). Then specify the parameters with which you want to to publish the message:
-
Topic, with which the command is sent as a message to the device;
-
Payload (Data) - a payload containing the text of the transmitted message;
-
Reply to - the topic, upon receipt of a packet with which the command is considered to be executed. As an option, you can create a command to get the state of the device and specify in the Reply to field the topic, by which the device sends its state - for example,
leds/state
. sends its state - for example,leds/state
. Then when you send this command, even if you receive an Ack (PUBACK - Publish acknowledgement) or any packets with other tops, the command will not be the command will not be considered executed until the packet with the specified leds/state topiq. leds/state topix. If the Answer to field is not filled in, the command will be considered executed when the Ack is received. will be considered executed when Ack is received from the device.
Wialon IPS
Arguments
In case of Wialon IPS there are two types of arguments:
-
basic parameters: always present in the data package, for them sources in the template model are predefined;
-
additional parameters: any parameters that can be additionally defined in the device. parameters**: any parameters that can be additionally defined in the device. In Wialon IPS package each such parameter is a
NAME:TYPE:VALUE
construction, where:- NAME - an arbitrary string with length not more than 15 bytes
- TYPE - type of parameter, 1 -int/long long, 2 - double, 3 - string
- VALUE - value depending on the type
In the source for such custom parameters specify what is in the NAME field, i.e. the name of the parameter. NAME field, i.e. the name of the parameter.
All the basic parameters corresponding to the protocol capabilities are already represented in the template model are already provided (navigation.latitude, navigation.speed, etc.)
Name | Source | Description |
---|---|---|
Time GPS | navigation.time | Date and time |
Latitude | navigation.latitude | Latitude |
Longitude | navigation.longitude | Longitude |
Speed | navigation.speed | speed |
Angle | navigation.angle | heading |
Height | navigation.height | Height |
Satellites | navigation.sat-count | number of satellites |
HDOP | hdop | accuracy reduction |
Inputs | inputs | digital inputs, each bit of a number corresponds to one input, starting from the lowest |
Outputs | outputs | digital outputs, each bit of the number corresponds to one output, starting from the lowest |
ADC | adc | analog inputs |
iButton | ibutton | Driver key code |
If only a certain bit is to be taken from the parameter at the specified address, then specify the bit number followed by a period: .<bit number>. For example, inputs.2 is is the value of the third digital input (counting from zero).
Similarly get individual elements from an array. For example, the parameters of the analog inputs come in the adc array. Then, to output the value of ADC2, specify adc.1 as the source in the corresponding parameter (do not forget about the counting from zero).
Actions
In case of Wialon IPS when filling in the action in the Send field select Text command. After that specify in the Text field the command to be sent to the device. you want to send to the device.
The list of available commands depends on the type of hardware. For example, for Vega-Absolute equipment, each device on the website (opens in a new tab) has a Supplies section that contains the Exchange Protocol Description. is Exchange Protocol Description. It lists Wialon IPS commands, supported by the selected hardware.
Galileosky
Arguments
In the case of Galileosky, the data source for an argument is the number of the tag being used according to the exchange protocol. It is formed according to the following principle: tag\_<the parameter tag from the protocol>. If from the parameter on the specified tag to take a certain bit. take only a certain bit, then specify the number of the bit with a period: .< bit number bit number>. For example, tag_40.2 is the third bit (counting from zero) in parameter 40.
All tags from the protocol are already present in the template model, but they can be hidden in the interface. Use the model search function to find the desired parameter. Editing a parameter is easier than creating a new one!
Actions
In the case of Galileosky, when filling out an action, in the Send field, select Text command. Then specify in the Text field the command to be sent to the device. you want to send to the device.
The list of available commands depends on the type of hardware. The list of all commands with description and examples can be found on the manufacturer's website in the [List of commands] section. section List commands (opens in a new tab).
Teltonika
Arguments
In the case of Teltonika, the data source for an argument is the address of the parameter in the
according to the exchange protocol. It is formed according to the following principle:
in_out_
<parameter number in protocol (Property ID in AVL packet)>.
All GPS-parameters corresponding to the protocol capabilities are in the template model are already provided (navigation.latitude, navigation.speed, etc.).
Name | Source | Description |
---|---|---|
Longitude | navigation.longitude | Longitude |
Latitude | navigation.latitude | Latitude |
Altitude | navigation.height | Altitude in meters above sea level |
Angle | navigation.angle | Angle in degrees from north clockwise |
Satellites | navigation.sat-count | Number of the visible satellites |
Speed | navigation.speed | Speed in km/h, calculated by GPS (if GPS error returns 0x0000) |
Actions
In case of Teltonika, when filling in an action, in the Send field select Text command. Then specify in the Text field the command to be sent to the device. you want to send to the device.
The list of available commands depends on the type of hardware. For example, for FMB-series equipment, the list of commands can be found at manufacturer's website. manufacturer](https://wiki.teltonika-gps.com/view/FMB_SMS/GPRS_Commands (opens in a new tab)).
Set all commands, except relay control, in the text form specified in the protocol documentation.
To create a command to control the internal relay of Teltonika devices, use the setdigout command with the addition of a key entered with a space. The key is a set of 1's and 0's to represent turning the relay on or off. The number of these characters must correspond to the number of relays in the terminal. Thus, the key reflects the required state of all relays of the device, however, if a relay is not required to be controlled at the moment, its state is indicated by a key. any relay is not required at the moment, its state should be indicated by the sign question mark "?".
For example,
- to activate the third relay out of four possible relays, send the command:
setdigout ??1?
. - To turn it off:
setdigout ??0?
. - if there are only two relays, the command to turn on the second relay looks like this:
setdigout ?1
- if both relays are to be switched on:
setdigout 11
.
If the number of relays is not known, use the getio
command. In response to
the device will send information about the available inputs and outputs. The
number of DO parameters in the response field means the number of relays in
the connected device.
If necessary, specify the duration of the relay closure. Write through spaces the switch-on time for the required relay (also positionally). For relays that must not change their state (i.e. marked with "?"), it is necessary to set 0. Time must be entered for each relay.
For example, the command to turn on the fourth relay for 5 seconds looks like setdigout ????1 0 0 0 0 0 5
.
Navtelecom (Flex)
Arguments
In the case of Navtelecom all parameters that come in telematics packages FLEX 1.0 and 2.0 versions are present in the model. Parameters for parsing packets FLEX 3.0 version parameters should be added to the model by yourself, forming the source by tag\_<number of the parameter in the protocol>. If you need to take only a certain bit from the parameter by the specified If only a certain bit is to be taken from the parameter by the specified number, specify the bit number with a dot: .<bit number>. For example, tag_139.2 is the third bit (counting from zero) in parameter 139. parameter 139.
Actions
In the case of Navtelecom in the commands section of the base model all possible commands of different purposes have already been created. commands of different purposes have already been created in the commands section of the base model:
- System.
-
Request device model and version
-
Request GPS receiver firmware version information
-
Device restart command
- Output Lines
-
Command to turn on output line 1
-
Command to turn off output line 1
-
Command to turn on output line 2
-
Command to turn off output line 2
-
Command to turn on output line 3
-
Command to turn off output line 3
-
Command to turn on output line 4
-
Output line off command 4
- Input Lines
-
Input line inhibit command
-
Input line unlock command
- Device operation modes
-
Arming command
-
Disarm command
-
Arming profile 2
LoRaWAN
Arguments
In the case of LoRaWAN, no sources for the parameters need to be filled in. By default when the device sends data to the model, the following parameters are automatically filled in. parameters:
-
DevAddr - address of the end device;
-
FPort - frame port number;
-
FCnt - frame number;
-
Payload - payload of the frame, i.e. data from the device.
Payload comes to the platform in Base64 format. It can contain any structure with data of different types. To parse the data by model, use handlers.
Actions
It is not possible to send commands to a LoRaWAN device. provided.
CoAP
Arguments
To publish telemetry data over CoAP, send a POST request to the following URL the following URL:
coap://dev.rightech.io:5683/api/v1/objects/:id/:path
where
- id - object identifier on the platform;
- path - the path where the device sends the parameter value.
In the case of CoAP, the data source for the argument is the parameter location path, specified after the id in the request.
For example, a device sends a humidity value in a POST request with the following URL
coap://dev.rightech.io:5683/api/v1/objects/:id/base/state/humidity
Then you must specify as the source in this parameter base/state/humidity.
To send multiple parameters in one packet, use the JSON format when building the data packet. For example, to send a lot of data in in one packet by specifying the URL as
coap://dev.rightech.io:5683/api/v1/objects/:id/state/telemetry1
a data in the form of
{
"stringKey": "value1",
"booleanKey": true,
"doubleKey": 3.1415,
"longKey": 73,
"jsonKey": {
"someNumber": 42,
"someArray": [1, 2, 3],
"someNestedObject": {
"key": "value"
}
}
}
So how do you parse such a complex package by model? A parameter with the data type Object:
- Create an argument with the Object data type, in the source specify the path you expect the data to follow - in this case
state/telemetry1
. in the source, specify the path where you expect the data - in this casestate/telemetry1
. Specify some identifier - for example,telemetry1
. . - Create additional nodes - under each field from the JSON. In this case, you get 9 nodes:
- The argument for the
stringKey
field - Argument for the
booleanKey
field - Argument for the
doubleKey
field - Argument for the
longKey
field - Argument for the ``someNumber
field from the nested JSON
jsonKey` field - Argument for the first array element of the
someArray
field from the nested JSONjsonKey
field - Argument for the second element of the
someArray
field array from the nested JSONjsonKey
. - Argument for the third element of the
someArray
field array from the nested JSONjsonKey
. - Argument for the field key from the nested JSON
someNestedObject
from the nested JSONjsonKey
in turn
- The argument for the
For each of these parameters, specify a data type that corresponds to the type of these values in JSON. Form the source of each of the nodes in the form of <identifier_of_node_with_type_object>.<necessary_field_from_json>. If you want to take only an element from array you want to take only an element from the array, then specify its serial number with a dot: .<number of the array element>. For example, someArray.2 is the third element of the array in the someArray field (counting from zero).
Examples:
- For stringKey string parameter;
- for the numeric parameter someNumber from the nested JSON jsonKey;
- for the second element of the numeric array someArray from the nested JSON jsonKey.
Actions
It is not possible to send commands to a CoAP-enabled device.
LwM2M
Arguments
In the case of LwM2M, the data source for an argument is a path in the form of numbers,
grouped as /ObjectId/ObjectInstance/ResourceID
, where
-
ObjectId is the object number, that is, some component of the device, such as a sensor;
-
ObjectInstance is the object instance number. For example, a device has two temperature sensors and three atmospheric pressure sensors. Then the objects are the temperature sensor and the pressure sensor, and object instances are specific instances of temperature and pressure sensors;
-
ResourceID - resource number. For example, for a sensor it can be a value value and unit of measurement.
Actions
In the case of LwM2M, when completing an action, select CoAP in the Send field command. After that specify:
- Method - GET/PUT/POST/DELETE;
- Path - the path, which is fomed in the same way as in the source for arguments, but here ObjectInstance and ResourceID parameters are optional;
- Data - data that can be specified depending on the type of LwM2M command.
LwM2M commands:
- Read - read data from a single resource, an object instance, or a object in its entirety. The response from the client must be in SenML JSON format. Specification (opens in a new tab)
Example READ Server
:
{
"method": "GET",
"path": "/1"
}
- Write - update values. The data to be written must be in Plain Text format. Specification (opens in a new tab)
Example WRITE 31024/10/1
:
{
"method": "PUT",
"path": "/31024/10/1",
"data": 254
}
- Execute - initiate the execution of actions on the resource. Specification (opens in a new tab)
Example EXECUTE 31024/10/2
:
{
"method": "POST",
"path": "/31024/10/2"
}
- Create - create an instance of the object. The data to be written must be submitted in SenML JSON format. Specification (opens in a new tab)
Example CREATE 31024/11
:
{
"method": "POST",
"path": "/31024",
"data": [
{
"bn": "/31024/",
"n": "11/1",
"v": 8
}
]
}
- Delete - delete an instance of an object. Specification (opens in a new tab)
Example DELETE 31024/11
:
{
"method": "DELETE",
"path": "/31024/11"
}
- Write-Attributes - change attribute values. Specification (opens in a new tab)
Example WRITE periods 31024/10/1
:
{
"method": "PUT",
"path": "/31024/10/1?pmin=5&pmax=60"
}
- Discover - get a list of all supported objects, instances of objects and resources. The response from the client should be in CoRE Link Format format. Specification (opens in a new tab)
Example DISCOVER Server
:
{
"method": "GET",
"path": "/1",
"data": "discover"
}
- Observe - set observation. The response from the client must be submitted in SenML JSON format. Specification (opens in a new tab)
Example OBSERVE Battery level
:
{
"method": "GET",
"path": "/3/0/9",
"data": "observe"
}
- Cancel Observation - end observation. Specification (opens in a new tab)
Example CANCEL Observe Battery level
:
{
"method": "GET",
"path": "/3/0/9",
"data": "cancel"
}
WebSocket
Arguments
To connect via WebSocket, specify the object ID in the URL:
ws://ws.dev.rightech.io:80/api/v1/objects/:id/connect
In the case of WebSocket, the data passed in the request body must be in the format of JSON. The data source for the argument in the model is the field key from the received JSON.
For example, you can send data in the following form
{
"stringKey": "value1",
"booleanKey": true,
"doubleKey": 3.1415,
"longKey": 73,
"jsonKey": {
"someNumber": 42,
"someArray": [1, 2, 3],
"someNestedObject": {
"key": "value"
}
}
}
In order to parse such a data packet by model, in the Source field specify the key from JSON of the field you are interested in.
Examples:
- For string parameter
stringKey
;
- for the numeric parameter
someNumber
of the nested JSONjsonKey
;
- for the second element of the numeric array
someArray
from the nested JSONjsonKey
.
Actions
In the case of WebSocket, when completing an action in the Send field, select Text Command. Then specify in the Text field the body of the request, to be sent to the device.