USB commands

You can run diagnostic and maintenance USB commands on your MindConnect Element.

The following lists various USB commands and the respective JSON format:

Prerequisites

  • A MindConnect device e.g. MindConnect Nano or MindConnect IoT2040

  • A fat32 formatted USB stick

Procedure

To use a USB command, proceed as follows:

  1. Make sure your USB stick is fat32 formatted.

  2. Create a file named “ConBox_Commands.json” directly on the USB stick.

  3. Open the “ConBox_Commands.json” file in a text editor.

  4. Enter one of the "JSON Code" commands that you want to execute.

  5. Save the changes to the "ConBox_Commands.json".

  6. Plug the USB STick into the MindConnect device.

    The LEDs should directly indicate that it is reading the USB. You can find more information in the LED lights of MindConnect Elements chapter.

The following list shows various USB commands:

Copy extended logs to USB stick

The following command will collect all agent logs & system files, put them into ConBox_<UID>_Logs.tar.gz and ConBox_<UID>_SystemFiles.tar.gz files and copy them to the USB stick.

JSON Code:

{

  "Commands": [

   {

    "Cmd":"CopySystemFilesToUsbStick",

"TypeOfFiles": "AllSystemFiles"

   },

{

"Cmd":"CopyAgentLogsToUsbStick"

}

  ]

}

NOTE

For the MindConnect IoT2040 it can take up to 15 minutes to collect all files.

Copy archived logs to USB stick

Some Logs arrive every day at approx. 0 UTC. The extended logs therefore only contain the data of the current day. To get those logs for past days you need to run this command.

The following command will copy all archived log files to a sub directory on the USB stick and delete the copied log files from the archive folder optionally. The USB stick should be larger than 200 MB.
Sub directories on the USB stick will have following structure: ConBox_<BOX ID>/<CurrentTime>Sample:ConBox_J47110815/20180318T191647

JSON Code:

{

  "Commands": [

   {

    "Cmd":"CopyArchivedLogsToUsbStick",

    "DeleteAfterCopy":"false"

   }

  ]

}

Change system time

For the case that the system time should have been changed so that agent runtime is no longer able to connect to MindSphere, you can retrieve the backend time to correct the system time. The following command provides the possibility to change the system time manually via ConBox_Commands.json file on the USB stick.

JSON Code:

{

 "Commands": [

  {

    "Cmd": "SetSystemTime",

    "NewTime": "2017-09-19T12:34:56"

  }

 ]

}

NOTE

You have to set to the current UTC (Coordinated Universal Time) time.

Change log file upload configuration

You can activate or deactivate the upload of log files via the ConBox_Commands.json file with the ChangeLogFileUploadConfiguration command on a USB stick. This reduces the amount of data that is stored for a tenant on the backend side and reduces the mobile data costs for uploading data to MindSphere.

If log file upload is disabled, the log files are saved locally. This local space is limited (200 MB). The files are written and after reaching this limit the oldest files are overwritten.

After the log file upload has been reactivated, previously saved MERS log files are uploaded to MindSphere (max. 200 MB).

JSON Code:

{

"Commands": [

{

"Cmd": "ChangeLogFileUploadConfiguration",

"EnableUpload": "true"

}

]

}

You can set the following command parameters:

Parameter

Description

EnableUpload

true: enable log file upload

false: disable log file upload

Perform factory reset

For factory reset a ConBox_Commands.json file can be provided by using the USB stick.

The network settings will be reset to their initial state on MindConnect device. All temporary files will be then deleted. At the end the MindConnect device will be restarted automatically.

The factory reset command is available on MindConnect Nano/IoT2040 version 03.01.00.00 b00x or later.

JSON Code:

{

  "Commands": [

   {

    "Cmd": "DoFactoryReset",

    "DeviceID": "_MindConnect_ID_"

   }

  ]

}

NOTE

The Unique ID has to be replaced with the serial number of the device

You can find more information on how to set a MindConnect Element to factory settings in chapter Manual firmware update of MindConnect Element

Restricted device configuration

The RestrictDeviceConfiguration command allows you to enable or disable online device configuration changes via MindSphere user interface after the MindConnect device has been successfully onboarded.

If you need to adapt the configuration, you have to create a new onboarding file with new e.g. network parameter and insert this data again via USB.

NOTE

Make sure that all parameters are valid before exporting the configuration file to prevent unwanted changes that can lead to invalid network settings, for example.

NOTE

Effects on online device configuration

There is no indication in the MindSphere asset configuration user interface that the device configuration has been restricted on MindConnect Nano/IoT2040 device.

If you try to change restricted device settings online, a message is logged in the diagnostic file on the MindConnect Nano / IoT2040 device that this setting could not be applied.

JSON Code:

{

    "Commands": [

        { "Cmd":"RestrictDeviceConfiguration",

            "networkInterfaces": [

                {

                    "name": "WebInterface",

                    "DHCP": "true",

                    "IPv4": "true",

                    "SubnetMask": "true",

                    "Gateway": "true",

                    "DNS": "true"

                },

                {

                    "name": "ProductionInterface",

                    "DHCP": "true",

                    "IPv4": "true",

                    "SubnetMask": "true",

                    "Gateway": "true",

                    "DNS": "true"

                }

            ]

        }

    ]

}

To prevent changes of network interface settings, the following parameters can be specified in the JSON command:

Parameter

Description

name

Name of the network interface.

Possible values:

  • WebInterface

  • ProductionInterface

DHCP

  • true: DHCP setting can not be changed

  • false: DHCP setting can be changed (default)

IPv4

  • true: IP address can not be changed

  • false: IP address can be changed (default)

SubnetMask

  • true: Subnet mask can not be changed

  • false: Subnet mask can be changed (default)

Gateway

  • true: Gateway address can not be changed

  • false: Gateway address can be changed (default)

DNS

  • true: DNS address can not be changed

  • false: DNS address can be changed (default)

NOTE

  • If you only provide some of the above mentioned parameters, then the omitted parameters will be ignored. This means that either the last restricted device configuration of these parameters will be used, or they will be treated as not set.

  • To enable device configuration changes of specific parameters again, a JSON command containing those parameters with value "false" can be provided via USB stick.

  • To turn it off a new JSON command file needs to be provided with "false" for all parameters.