Command and Control¶
The data logger can be controlled over MQTT by publishing commands to a Command and Control (cc) topic.
The API allows for remote configuration and data collection. This documentation is written from the perspective of the data logger.
MQTT topic structures are case-sensitive and must be specified exactly as documented.
Publish - The data logger publishes to the specified topic.
Subscribe - The data logger subscribes to the specified topic.
CC Topic¶
To send a command to a data logger, a specific JSON message must be published.
The data logger will automatically subscribe to the cc topics when connecting to a broker.
Generic Topic Structure¶
Topic Structure <baseTopic>/cc/<deviceID>/<command>/<tranID>
Properties
<baseTopic> Configured in the data logger settings. Default:
cs/v2<msgType>
ccCommand and Control- <deviceId> A unique identifier for the data logger.
<UID>(e.g., A1b2-C3d4-E5f6)<model>/<serialNumber>when a UID is not configured
<command> A keyword indicating the specific action to be executed.
- <tranID> (Optional) This field is used to correlate command-and-control responses.
If Present in the command payload, the
<tranID>is included in the response topic.If Absent the response omits the
<tranID>from the topic.Length: 39 ASCII character max.
Generic Command Format¶
All commands must be sent in JSON format. Typically, a command is invoked by publishing a JSON payload to an MQTT topic that includes the command in the topic structure.
Example (OS Command) [Preferred Method]
Subscribe <baseTopic>/cc/<deviceID>/OS <---'OS' command included in topic
{
"url":"https://DataThings.com/Operating_Systems/CR6.14.2.0.obj"
}
The data logger also supports commands published to the generic cc topic without specifying the command in the topic path.
In this case, the command must be explicitly stated in the JSON payload using the command key:value pair. "cmd":"string"
Example (OS Command) [Optional Method]
Subscribe <baseTopic>/cc/<deviceID>/ <---'OS' command excluded from topic [ ends with '/']
{
"cmd":"OS",
"url":"https://DataThings.com/Operating_Systems/CR6.14.2.0.obj"
}
CR Topic¶
After the data logger has received a message on the cc topic, it publishes a response on the Command Response cr topic.
The cr topic follows a structure similar to the cc topic, with specific differences outlined.
<baseTopic>/cr/<deviceID>/<command>/<tranID>
Properties
<baseTopic> Configured in the data logger settings. Default -
cs/v2<msgType>
crCommand Response- <deviceId> A unique identifier for the data logger.
<UID>(e.g., A1b2-C3d4-E5f6)<model>/<serialNumber>when a UID is not configured
<command> A keyword indicating the specific action to be executed.
- <tranID> (Optional) This field is used to correlate command-and-control responses.
If Present in the command payload, the
<tranID>is included in the response topic.If Absent the response omits the
<tranID>from the topic.
Command Set¶
The data logger supports the following set of commands.