When a device request is received for a specific simulated device, it is sent to the user application to generate the appropriate response. Once obtained, the user application sends it to the Digi IoT Device Simulator to upload it as a response to the received request.
To include device requests support in your simulation you must:
-
Add the
user_app
object to thesimulation.json
file. See Simulation configuration. -
Include the
device_requests_id
value in the corresponding profile file inside theprofiles
directory of your simulation. See Device profiles definition. -
Create a
*.json
file named as the value of thedevice_requests_id
property inside thedevice_requests
directory of your simulation. -
Include the request targets supported in this file. See below.
-
Create the required Python custom code in the
simulation.py
file located inside your simulation. See Custom code implementation.
Files inside the device_requests
directory of the simulation include sets of requests supported by devices using a specific profile.
Each device request set can be used by one or more profiles defined in the profiles
directory.
They are identified by the file name without extension in the device_requests_id
property of profiles.
The file name must have a maximum on 100 characters between letters, numbers, dash, underscore, and period, ^[\w\.-]+$
.
Device requests requires the implementation of custom code to process received requests from Digi Remote Manager. See Custom code implementation.
{
"test": {
"timeout": 5
},
"device_info": {
"timeout": 10
},
"display_warning": {
"timeout": 15
},
[...]
}
Each device request block from a file like the above requires to configure:
-
The target of the request, specified as the name of each block, for example
device_info
. -
timeout
: The maximum timeout in seconds to quit the execution of the command to avoid deadlocks.
{
"device_info": {
"timeout": 10
},
[...]
}