The CLI of the Digi IoT Device Simulator includes a set of commands related to the CLI itself that facilitates the interaction with the application. Among all the available functionality, you can:

Show the CLI help

The help command displays a list with the commands currently available in the CLI of the IoT Device Simulator:

simulator> help
    clear   Clears the console output.
    exit    Exits from simulator.
    help    Lists all the available commands.
    history Lists the commands previously used.
    purge   Clears all the information of any simulation in your account.
    set     Configures an existing device in the simulation.
    show    Shows the requested information.
    start   Starts the simulation. Only one simulation can run at once.
    stop    Stops the running simulation.
simulator> 

To get detailed information about each command and its syntax, just type the command help followed by the command that you want to get information for.

simulator> help <command>

Where <command> is the name of the command to get information.

For example, this code prints the help available for the start command:

simulator> help start
start -  Starts the simulation. Only one simulation can run at once.
         If a simulation is running, this command will show an error message.
         Always stop the running simulation before launching a new one.
Usage: start <simulation-path>
  -? --help            Displays command help
  simulation-path      The path to the simulation directory
simulator> 

Quit the Digi IoT Device Simulator

Instead of killing the application when you are done with the simulation, you can use CLI exit command. This command stops the simulation process closing all the sockets between the IoT Device Simulator and Remote Manager immediately. The syntax is as simple as:

simulator> exit
If you want to perform a clean shutdown of the application, it is recommended to execute the stop command prior to the exit one to disconnect all the simulated devices before exiting the application.

Get the history of the commands executed

The command history of the CLI allows you to see and manage the history of the commands executed during the simulation session. It is particularly useful to get and list the sequence of commands that modify the behavior of simulated devices such as changes in the connection and firmware updates. The syntax of this command is a bit complex as it allows you to customize the output in multiple ways.

simulator> history [<action>] [<options>] [-m <match>] [<first>] [<last>]

Where:

  • <action> is an operation you can do with the history:

    • --clear. Clears the history.

    • --save. Saves the history.

  • <options> are optional modifiers for the events printed in the history:

    • -d. Prints timestamps for each event.

    • -n. Suppresses command numbers.

    • -r. Reverses the order of the commands.

    • -f. Prints full time date stamps in the US format.

    • -E. Prints full time date stamps in the European format.

    • -i. Prints full time date stamps in ISO8601 format.

  • <match> is a pattern used together with -m and only the history events matching the pattern are shown. Optional.

  • <first> is the string or index corresponding to the first event to show. Optional.

  • <last> is the string or index corresponding to the last event to show. Optional.

For detailed information about the syntax of the history command, type help history in the CLI.

The following example demonstrates how to show the command history of set events printing the timestamp of each one in ISO8601 format and suppressing the command numbers:

simulator> history -din -m set*
  10:18:13  set devices EE0D1E60-EE0EE001 connect no
  10:18:21  set devices EE0D1E60-EE0EE001 connect yes
  10:19:09  set devices EE0D1E60-EE0EE001 maintenance yes
  10:19:13  set devices EE0D1E60-EE0EE001 maintenance no
simulator> 

Clear the console output

You can use the clear command to perform a terminal initialization or clear the console log.

simulator> clear