MQTT Transmit
    • Dark
      Light

    MQTT Transmit

    • Dark
      Light

    Article summary

    A mqtt data transmit transfers data to the mqtt broker.

    Example:

    If we want to upload our records from the bathhouse:water stream to our IOT cloud, broker.emqx.io with port 1883 our configuration will look something like this:

    {
        "data_transmit": [
            {
                "transmit_name": "iot_hub_transmit",
                "transmit_type" : "mqtt",
                "filter_stream": [
                    "bathhouse:water"
                ],
                "host": "broker.emqx.io",
                "port": 1883,
                "username": "spiderman",
                "password": "somepowerfullpass",
                "topic": "some_topic",
                "client_id": "some_client_id"
            }
        ]
    }

    Warning:

    This plugin is very sensitive to upload bandwidth: if it can’t upload a payload completely within the timeout, it will abort the connection and try again. You may need to increase the timeout from the default of two minutes. For example:

    {
        "transmit_name": "SightMachine",
        "transmit_type": "mqtt"
        "filter_stream": ["*"],
        "timeout": 300
    }

    Configuration:

    Required and optional properties that can be configured for an MQTT transmit:

    • host: MQTT broker hostname (e.g. broker.emqx.io)
    • port: MQTT connection port (Currently defaults to 1883)
    • client_id: Some unique string identifying the client to the MQTT server. Must be unique across all connections to the MQTT server.
    • username: Username to connect to the server
    • password: Password to connect to the server
    • topic: topic where we send MQTT messages
    • additional_fields: additional field to add in the message payload for e.g. { “processingPath”: “SM”}
    • transmit_name: ID for the transmit. It must be unique.
    • transmit_type: Method to use in transmitting records.
    • filter_stream: A list of streams that will use the transmit. Each stream can either be * (all) or asset:stream.
    • timeout: Number of seconds to wait until timing out.
    • poll_interval: Maximum number of seconds to wait between requests
    • max_request_records: Maximum number of records to send in a single request.
    • max_request_size_bytes: Maximum number of bytes allowed in a single request. Size is capped at 4 MB.
    • opc_payload_metadata: Additional fields to add in the OPC-formatted payload. E.g. { “TiqTwin”: { “NodeId”: “a2ec725a-78e2-431b-a124-ce20b8e3e4c6” }} Ignored if use_opc_publisher_format is False.
    • opc_message_metadata: Per-message metadata fields to add in the OPC-formatted payload.
    • use_opc_publisher_format: If True, the message payload will be formatted to mimic OPC Publisher. https://github.com/Azure/Industrial-IoT/tree/main/docs/opc-publisher#opc-publisher-telemetry-formats

    What's Next