Wialon IPS device connection
Model configuration
Consider the following case. Suppose you need to connect the truck to the platform using the Wialon IPS protocol. It has a certain set of sensors, the key of which in this case is the sensor for fixing the opening and closing of the door and the sensor for the presence of cargo. Based on the readings recorded by each of them, a separate automation script will be generated.
First you need to create a model. The Wialon IPS model is added as the default template. It represents a fairly complete interpretation of this protocol, and therefore there is no need to modernize and supplement this template
Create a new Wialon IPS model.

The model will look as follows.

Creating a control object
In this case, a truck will be considered as an object. To create a new object, go to the “Objects” menu and open the corresponding dialog box. In this window, the previously created model is selected from the list. The identifier is specified in the following format: wialon: id termimal
of the terminal (for example, wialon: 123456789000001). The name of the object can be entered in the same format, but, nevertheless, it can be arbitrary, since it serves, in general, to find this object in the list of objects.

After the model and object were created for the device and it was connected to the platform, you need to make sure that the device sends data.

Designing automation scripts
Case №1: geo zones control
In the first case, the following script will be described. The truck runs between the warehouse where it should load the container and the store where it should unload. There is a sensor connected to relay No. 1 in the truck. It sends the value “1” when the container is installed in the truck body. In addition, it is possible to control the geo zone of the warehouse and store. The goal is to record any deviation from the normal business process.
First you need to build a geo zone warehouse and store. To do this, go to the “Geo zones” menu, select the geo zone shape that will best show the type of warehouse and store on the map, assign a name and choose a color for each geo zone.

Next, you need to describe the business process in the automation script editor. In the current example, five basic states are possible (taking into account two states related to deviation from the business process):
- the truck is in the loading zone;
- the truck is in the unloading zone;
- the truck left the loading zone without a container (we send an information message to the operator);
- the truck left the unloading zone without unloading the container (send a message);
- the truck is in motion.

After the script has been written, it can be run on a given object. If data is received that relay No. 1 is not closed, it means that the truck left the warehouse area, therefore, it drove out without a container. A message with information about this should appear in the right sidebar.
Case №2: control of opening/of theft
Suppose that the device doesn’t have a built-in system for detecting opening and theft, but it can send a parameter for opening a door (for simplicity, one parameter is used for any door and trunk) and for opening the hood.
We describe the following script. If the car is in security mode and the hood is opened, the door is opened or movement begins, a command is sent to the device to block the fuel pump and notify these events to a third-party service. At the same time, it is necessary that the blocking and notification command can be sent without stopping while the object is in one of the critical states indicated in the state machine.
To control the opening or theft of a truck, you need to record the opening and closing of doors, hood, and the car as a whole. The parameters “Driver’s door”, “Passenger door”, “Right rear”, “Left rear”, “Hood open”, “Closed” (truck) are already added to the model by default. In this case, it is necessary to add to the existing additional commands to lock and unlock the fuel pump.
By setting the checkboxes in front of the corresponding parameters, you can specify several parameters of the control object necessary for displaying in the interface

We describe the business process in the script editor. In this example, six basic states are possible (taking into account two states related to deviation from the business process):
- state determination;
- under protection;
- not protected;
- opening (send an HTTP request);
- movement;
- theft (send an HTTP-request).

It is worth paying attention to some nuances.
Firstly, in the “Motion” state, the timer is started for 20 seconds in order to exclude frequent false alarms. If by the end of this time the speed doesn’t turn out to be zero again, then a transition to the “Theft” state will occur and an HTTP request will be sent.
Secondly, the transitions from the “Opening” and “Theft” states to the “Protected” state don’t contain conditions, as it is designed to send HTTP critical messages in a circle.
The HTTP request is configured as follows:
