Skip to content

Device configuration

Configuration commands

Interactive mode

For simplicity, in interactive mode all commands are 1 character long, (plus the Enter,line-feed, '\n', ASCII 0x0D). In case the command is sent through the CLI: $ printf 'C\n' > /dev/ttyACM0

JSON mode

The user should ensure that the string to send is a valid json object (programatically or you could use a linter, like https://jsonlint.com for instance).

The commands can also be combined in one JSON object. For example: {"led":true,"reportingPeriod":30,"format":"CSV"}

NOTE: For both modes. A status report is always returned after a command. This helps to ensure that the command was received properly.

Reporting format

Interactive

Command Format
J JSON
C CSV
M HUMAN

JSON

Command Format
{"format":"json"} JSON
{"format":"csv"} CSV
{"format":"human"} HUMAN

Reporting period

In some cases, like when performing data collection for long periods of time (weeks, months), it's convenient to reduce the reporting frequency, and avoid overloading the database with too much data if the smaller granularity is not needed.

Interactive

Command Reporting period
1 1 second (default)
2 10 seconds
3 30 seconds
4 1 minute
5 10 minutes
6 30 minutes
7 1 hour

JSON

Command Reporting period
{"reportingPeriod":integer} in seconds (min. 1, max. 3600)

LEDs On/Off

Interactive

Command State
E Enabled
D Disabled

JSON

Command State
{"led":boolean} true / false (Enabled / disabled)

Save configuration

This command is only available for the JSON mode, and it saves the configuration in permanent storage (it's maintained after reconnecting the device):

Command Detail
{"saveConfig": true} Store the configuration in Flash memory

Status

Interactive

Command Detail
S Retrieves the device, firmware, serial number, configuration and uptime (in ms)

Status response:

--------------------------------------------------------
***  Device: *"uThing::MNL rev.A"* -- Status:
     Reporting period: 1 sec, Format: JSON, Uptime: 2189513 ms, Serial #: 28AE9B978CFE249B, FW: v1.0.3
--------------------------------------------------------

JSON

Command State
{"status":true} Retrieves the configuration and uptime (in ms)

Status response:

{
    "status": {
        "reportingPeriod": 1,
        "format": "JSON",
        "upTime": 1802065
    }
}

Info

This is available only in JSON since the same information is already returned for the status command in interactive mode:

Command State
{"info":true} Retrieves the device information (HW, FW and Serial number)

Response:

{
    "info": {
        "device": "uThing::MNL rev.A",
        "serial": "28AE9B978CFE249B",
        "firmware": "1.0.3"
    }
}

Commands summary

The table below summarizes the commands available in FW v1.0.3:

Command Interactive JSON Description
Format [J, C, M] {"format":"string"} Change reporting format (JSON, CSV, HUMAN)
Period [1-7] {"reportingPeriod":integer} Change reporting period
LEDs [E, D] {"led":boolean} Enable / Disable LEDs
SaveConfig not-available {"saveConfig":true} Save configuration parameters
Status [S] {"status":true} Show actual configuration
DeviceInfo [S] {"info":true} Show device info

The following response will also be printed when an invalid character is sent (the letter 'h' for example):

-------------------------------------------------------
***  Invalid option.
 Use:              [m] Human readable, [j] JSON, [c] CSV, [s] Status, [e/d] enable/disable LED
 Reporting Period: [1] 1 sec, [2] 10 sec, [3] 30 sec, [4] 1 min, [5] 10 min, [6] 30 min, [7] 1 hour.
--------------------------------------------------------