openJIIDocs
MultispeQ MQTT Tool

Usage

Configure the current MMI process, connect, measure, and publish.

Configure the process environment

The current Config class reads these variables with os.getenv:

VariableDefault / behavior
AWS_IOT_ENDPOINTA repository-coded development endpoint; set the endpoint supplied for your environment.
AWS_IOT_PORT8883
AWS_IOT_CERT_FILEPATHno default
AWS_IOT_PRIVATE_KEY_FILEPATHno default
AWS_IOT_CA_FILEPATHno default
AWS_IOT_CLIENT_IDtest- plus a random UUID
AWS_IOT_TOPICingestion topic with placeholder experiment/protocol and cli_test_sensor_id
AWS_IOT_KEEP_ALIVE30 seconds
AWS_IOT_CLEAN_SESSIONFalse; only the string true (case-insensitive) enables it
AWS_IOT_PROXY_HOSTunset
AWS_IOT_PROXY_PORT0

Example shell setup:

export AWS_IOT_ENDPOINT="your-endpoint-ats.iot.eu-central-1.amazonaws.com"
export AWS_IOT_CERT_FILEPATH="$HOME/.config/openjii-iot/device-certificate.pem.crt"
export AWS_IOT_PRIVATE_KEY_FILEPATH="$HOME/.config/openjii-iot/device-private.pem.key"
export AWS_IOT_CA_FILEPATH="$HOME/.config/openjii-iot/root-CA.pem"
export AWS_IOT_CLIENT_ID="mmi-$USER"

MMI does not call a dotenv loader. If you keep values in a .env file, source/export them with your shell or another trusted launcher before starting mmi.

Interactive connection flow

Start the tool:

mmi

Then:

MultispeQ > connect
MultispeQ > status
MultispeQ > publish
MultispeQ > disconnect
MultispeQ > exit

connect asks for an experiment ID, protocol ID, certificate ID, and certificate directory. It constructs these filenames in that directory and assigns them to the active configuration:

<certificate-id>-certificate.pem.crt
<certificate-id>-private.pem.key
root-CA.pem

It validates that all three files exist and that the endpoint resembles a hostname, then creates an AWS IoT mTLS connection. Because this prompt overwrites certificate paths, place or name the files accordingly even if certificate variables were exported.

Measurements

publish (m) opens the current hard-coded serial port, asks for plant metadata, takes one SPAD measurement, saves the analyzed result under ./dump, adds plant_metadata, and publishes the JSON. The implementation prints the outgoing topic and payload, so review logs before using sensitive metadata.

continuous_publish (k) repeats that flow every six seconds until Enter is pressed. It adds an ISO timestamp to each reading and disconnects the device when the session ends.

set_plant stores plant metadata in memory for the current process. It is not persisted between runs.

Topic updates

set_topic (t) prompts for experiment and protocol IDs and rebuilds the topic as:

experiment/data_ingest/v1/{experimentId}/multispeq/v1.0/cli_test_sensor_id/{protocolId}

If MQTT is connected, it disconnects and runs the interactive connection flow again. The current CLI does not expose runtime prompts for sensor version or sensor ID.

Command summary

CommandShortcutCurrent behavior
connectcPrompt, validate certificate paths, connect to AWS IoT Core.
disconnectdDisconnect MQTT.
pingpOS-level ICMP ping of the endpoint; it does not publish an MQTT health message.
publishmMeasure once and publish.
continuous_publishkMeasure/publish every six seconds until stopped.
statussShow connection endpoint, client ID, and topic.
configfPrint active configuration.
set_topictChange experiment/protocol topic segments.
connect_devicevOpen the current hard-coded serial port.
set_plantnoneUpdate in-memory plant metadata.
helphShow command help.
clearnoneClear and redraw the terminal.
exit / quitqClean up and exit.

For channel semantics continue to MQTT protocol.

On this page