Skip to main content

mqtt

The MQTT (Message Queuing Telemetry Transport) protocol in InDataX allows for the integration of IoT devices and telemetry systems through a publish/subscribe model. InDataX acts as a client, connecting to a broker and subscribing to specific topics to receive data in JSON format.

MQTT Broker

InDataX includes its own internal MQTT broker that works by default without any additional configuration.

If you prefer to use an external broker, you must modify the following parameters in the .env file located in the installation folder:

  • MQTT_HOSTNAME: Address or IP of the external broker.
  • MQTT_PORT: Connection port of the broker.
  • MQTT_USER: The username InDataX will use to identify itself to the broker.
  • Password: The external broker must be configured to accept the content of the SECRET parameter defined in the same .env file as the password.

Connection Parameters

To configure a new MQTT channel, define the following fields:

  • Name (Nombre): Unique identifier for the protocol.
  • MQTT Topic (Tópico MQTT): The topic path InDataX will subscribe to (e.g., sensors/plant1/temperature).

Variable Configuration

In MQTT, data extraction is performed by mapping JSON keys. The system expects to receive a message whose payload is a valid JSON object.

  • Name (Nombre): The variable's name in InDataX.
  • Type (Tipo): Data type (Real, Integer, Boolean, etc.).
  • Audit trail: Audit record for value changes.
  • Record value (Registrar valor): Inclusion in the Thing's historical records.
  • Key (Clave): The name of the property within the JSON object that contains the desired value.

Example

If the system receives the following message on the configured topic:

{
"temp": 25.5,
"hum": 60,
"status": "OK"
}

To read the temperature, we would configure a variable with the Key (Clave): temp. InDataX will automatically extract the value 25.5.