The sets of requests that your devices will support are defined in JSON
files inside the device_requests
directory of your simulation.
You can have different files with different collections for every defined profile in your simulation or reuse them in several profiles.
You can skip this step if your simulation does not require device requests support. |
Your simulated devices can receive data from Digi Remote Manager, also known as receiving device requests. Transfers are initiated from a Web Services client connected to Remote Manager. This transfer is used to send data to the device or trigger actions in the device. The device may also return a response.
Requests are composed of:
-
Target: A unique name which specifies which part of the application is in charge of attending this request.
-
Data: Arbitrary data sent to the device.
On the Digi IoT Device Simulator side, when it receives the request, it looks into the user-registered targets for the corresponding simulated device. If a match is found, then it is automatically accepted and the implemented custom code called with the received information. If no match is found, a standard error response is returned to Remote Manager.
For this example you need a request to remotely turn on/off a streetlight.
Follow these steps to create a file with a collection of supported requests:
-
Inside
device_requests
directory, renametemplate_requests.json
file tolight_requests.json
.In your
streetlight.json
profile you configureddevice_requests_id
to belight_requests
, this means you must have a file with that name and.json
extension inside thedevice_requests
directory. See step 3. Establish your devices profile. -
Open the
light_requests.json
file to add the required requests. -
Define the collection of supported requests.
For the example, define a target to turn on/off a streetlight,
set_status
.The request includes extra data with the status
on
oroff
. This must be managed by custom code to process received requests from Digi Remote Manager. See 6. Implement custom code.
For a complete explanation of the request files, see Device request configuration. |
device_requests/light_requests.json
{
"set_status": {
"timeout": 5
}
}