Interaction of multiple devices in a single automation scenario
In automata, it is possible to use multiple objects within a single
scenario. That is, it is possible to organize the joint work of heterogeneous objects,
that are connected to the platform. This allows for a broader view of the IoT world,
because IoT is all about interaction between smart things.
In order to compose an automaton of the interaction between multiple devices, add to it the
it with models of those objects between which the common logic will be configured. These
can be objects with different models or the same ones.
When building an automaton, in selecting actions, events, and parameters to form the
conditions you will be asked to choose one of the used models.
Once added, a number corresponding to the number of the selected
model.
When forming transition conditions, you can include parameters of devices with
different models and compare these parameters among themselves.
Just as in automata with a single model, in the case of multiple models you can
send the current value of the parameters in the message text. In this case they
are written as a construct
{{objects[n].state.id_of_parameter}}
, wheren
is the model number minus 1,id_of_parameter
- identifier of the parameter from the model.
For example, the contents of a notification can be generated as follows:
{
"event": "currentstate",
"temperature1": "{{objects[0].state.temperature}}",
"temperature2": "{{objects[1].state.temperature}}",
"speed": "{{objects[2].state.speed}}"
}
The message text will send the temperature value for objects with model 1 and 2 and the
speed value for object with model 3.
After you design and save the automaton, on the Objects tab.
add objects for each model.
Click Start, the automaton will run simultaneously on all selected objects.