Profiles for your simulated devices are defined in JSON files inside the profiles directory. You can have as many as you require and refer to them in the simulation.json file. Each group in simulation.json must be assigned a profile.

Each profile determines the features of the simulated devices in a group, such as connection and disconnection to/from Digi Remote Manager, remote firmware update processes, or file system management. Additionally, a profile is assigned a set of device requests and data streams that support all devices that use the profile.

Follow these steps to create a profile that satisfies your requirements:

  1. Inside the profiles directory, rename the template_profile.json file to streetlight.json.

    In your simulation.json file you configured profile_id to be streetlight, this means you must have a file with that name and .json extension inside the profiles directory. See previous step 2. Define simulation parameters.

  2. Edit the streetlight.json file to configure the simulated devices behavior.

  3. Configure the connection settings so your simulated devices can:

    1. Recover the connection if they disconnect for any reason (reconnect_interval).

    2. Schedule random disconnections to simulate for example, low power modes or connection issues (disconnect_interval)

    This example does not simulate a connection lost, devices are always connected.

    To achieve this, remove the disconnect_interval from connection_settings. See Device profiles definition in case you need this behavior.

  4. Set the maintenance window for the devices: When it starts, how much time it takes, and when it repeats.

    For the example, specify a maintenance window of one hour a day. Inside maintenance_window set:

    1. duration to one hour, PT1H.

    2. frequency to one day, PT24H.

  5. Define the simulated firmware update process.

    Simulated streetlights of this example allow remote firmware updates but with a ratio of failure of 30% when installing the downloaded image. Inside fw_update set:

    1. Always succeed in verify stage: probability to 0 in verify_stage.

    2. Always succeed during download: probability to 0 in download_stage.

    3. 30% of errors during installation: probability to 30 in install_stage.

  6. Allow remote access to your simulated devices file system.

    For this example:

    1. Rename directory template_file_system inside fs to streetlight_fs.

    2. Use resources inside the streetlight_fs directory as the initial file system of your simulated devices: Set base_fs_id to streetlight_fs.

    3. Configure a maximum size per device, for example, 400 bytes.

  7. Add data streams to your simulation if your devices upload data to Remote Manager.

    The streetlight devices must upload the read light level and its status.

    To do so, configure the data_streams object:

    1. Select the set of data streams for the profile, that is the identifier of the file that defines the collection of data streams to upload to Remote Manager.

      Sets of streams are defined inside the data_streams directory of your simulation folder.

      The data streams identifier, data_streams_id, for the example is light_streams. It is defined in step 4. Specify data to upload.

    2. Configure three minutes as the rate to upload a samples batch, batch_upload_frequency.

  8. Include support for device requests if your simulation requires them.

    Sets of requests are defined inside the device_requests directory of your simulation folder.

    The device requests identifier, device_requests_id, for the example is light_requests. It is defined in step 5. Configure supported remote requests.

    Adding device requests requires the implementation of custom code to process them. See 6. Implement custom code.

For a complete explanation of profile files, see Device profiles definition.
profiles/streetlight.json
{
    "connection_settings": {
        "reconnect_interval": {
            "minimum": "PT30S",
            "maximum": "PT60S"
        }
    },
    "maintenance_window": {
        "type": "auto",
        "start_time": "now",
        "duration": "PT1H",
        "frequency": "PT24H"
    },
    "fw_update": {
        "allow_update": true,
        "reconnect_after_update": true,
        "progress_messages": [
            {
                "until_progress": 25,
                "message": "Unpacking firmware image..."
            },
            {
                "until_progress": 70,
                "message": "Installing firmware image..."
            },
            {
                "until_progress": 100,
                "message": "Applying firmware image configurations..."
            }
        ],
        "duration": "PT2M",
        "stage_errors": {
            "verify_stage": {
                "probability": 0,
                "error_code": 1
            },
            "download_stage": {
                "probability": 0,
                "error_code": 1
            },
            "install_stage": {
                "probability": 30,
                "error_code": 1
            }
        }
    },
    "file_system": {
        "base_fs_id": "streetlight_fs",
        "virtual_fs": true,
        "max_size_bytes": 400,
        "reuse_previous_fs": true
    },
    "data_streams": {
        "data_streams_id": "light_streams",
        "batch_upload_frequency": "PT3M"
    },
    "device_requests_id": "light_requests"
}