Connectivity 14 min read

What Is MQTTS? MQTT over TLS for Energy IoT

Understand MQTT over TLS: certificates, broker identity, topic access, QoS limits and commissioning checks for trustworthy energy IoT data.

Example EpiSensor Edge flow editor with fictional endpoints showing field data transformed and sent to an MQTT broker.

MQTTS is common shorthand for MQTT carried over a network connection protected by Transport Layer Security (TLS). It is not a separate MQTT protocol version. Correctly configured TLS can protect the MQTT connection against eavesdropping and tampering and can authenticate the broker. MQTT still defines the publish-and-subscribe exchange: topics, sessions, retained messages and quality-of-service behaviour.

That distinction matters in energy systems. A green “connected” indicator does not prove that the client reached the intended broker, that it may publish only to approved topics, or that the receiving application stored the right value with the right unit and timestamp. A trustworthy installation proves each boundary separately.

Do not confuse MQTTS with MQTT-SN, which was formerly called MQTT-S. MQTT-SN is a separate publish-and-subscribe protocol for sensor networks and non-TCP/IP environments (MQTT specifications).

MQTT and MQTTS at a glance

The MQTT 5.0 specification describes MQTT as a client-server publish-and-subscribe messaging transport. It recommends TCP port 8883 for servers offering MQTT over TLS and identifies its IANA service name as secure-mqtt. Port 1883 is conventionally used for MQTT without TLS.

The port does not create the security property. A service can listen on another port, and a listener on 8883 can still be misconfigured. The client must establish the expected protocol and verify the expected identity.

Question MQTT without TLS MQTT over TLS (“MQTTS”)
Transport confidentiality Not provided by MQTT Available for the TLS connection when correctly negotiated
Broker identity Not provided by basic username and password authentication; MQTT 5 enhanced authentication can authenticate the server when both endpoints support the same mechanism Certificate path and reference-identity verification can authenticate the broker
Client identity Username, password or another broker mechanism May also use a client certificate; broker policy decides
Topic permission Broker authorisation is still required Broker authorisation is still required; TLS does not replace ACLs
Typical registered port 1883 8883

TLS protects a connection hop. It does not turn an arbitrary payload into a valid meter reading, make every subscriber trustworthy, or encrypt the payload after a broker or downstream application terminates that TLS connection.

Four checks, not one “secure” badge

A production connection needs four distinct proofs.

1. Trust and broker identity

The client needs an approved trust anchor and must validate the broker's certificate path, validity period and identity. RFC 9525 describes matching a configured reference identifier, normally the intended DNS name or IP address, to an identifier presented in the certificate. RFC 5280 defines the certificate-path and validity model, including the notBefore and notAfter bounds.

Record the broker's approved fully qualified domain name rather than copying whichever address happened to resolve during setup. Supply Server Name Indication (SNI) where the service requires it. An untrusted CA, a wrong hostname and an expired or not-yet-valid certificate should fail during acceptance testing.

2. Client identity

The broker must know which gateway or application is connecting. The project may use a client certificate and private key, a username and password, or another approved mechanism. If client certificates are used, give each gateway a distinct identity, protect the private key and define issuance, renewal and revocation ownership.

The Eclipse Mosquitto configuration reference illustrates the separation: enabling a TLS listener protects traffic to the server, while requiring a valid client certificate is an additional broker policy.

3. Topic authorisation

Authentication answers “who is this client?” Authorisation answers “what may it do?” Give the client only the publish and subscribe paths it needs. Prove one permitted action and at least one denied action outside that boundary. Mosquitto's Dynamic Security documentation shows separate allow and deny rules for client publication, receipt and subscription.

Avoid broad wildcards merely to make commissioning easier. A gateway that publishes measurements should not automatically gain the ability to subscribe to command topics or write into another site's namespace.

4. Application acceptance

Finally, follow a known, non-actuating measurement into the receiving application. Compare the source identity, original timestamp, value, unit, quality and intended destination. Broker evidence is useful, but it is not proof that a historian, energy platform or customer application accepted the correct record.

For example, a fictional acceptance record might follow site-17/main-meter/active-power with source time 14:03:00Z, value 412.6, unit kW and record ID site-17-140300. The evidence should show the same identity, time, value and unit at Edge and in the receiving application. A broker log alone leaves that comparison unfinished.

What TLS protects and what it does not

For a direct Edge-to-broker connection, TLS can provide confidentiality and integrity while data is in transit and can authenticate the broker. Mutual TLS can also authenticate the client. Those properties end at the TLS endpoints.

TLS by itself does not establish:

  • least-privilege publish and subscribe permissions;
  • the accuracy, calibration or physical identity of the original measurement;
  • the meaning, unit, timestamp or quality of an MQTT payload;
  • storage by the broker or a downstream application;
  • payload confidentiality after TLS terminates;
  • durable replay through a gateway restart or a long outage; or
  • safe, authorised physical control of equipment.

If end-to-end payload confidentiality is required beyond the broker, specify an application-layer protection scheme and its key lifecycle separately. Do not describe hop-by-hop TLS as end-to-end encryption.

MQTT delivery semantics for energy data

MQTT quality of service applies to a particular sender-to-receiver protocol leg. A publisher-to-broker leg and a broker-to-subscriber leg are separate exchanges.

QoS MQTT delivery behaviour Engineering boundary
0 At most once; no MQTT acknowledgement Loss can occur. A later reading does not reconstruct the missing one.
1 At least once The receiver acknowledges ownership; retransmission can produce duplicates.
2 Exactly once for the defined MQTT protocol exchange, with more overhead It is not an end-to-end business guarantee, and a broker or platform may not support it.

At QoS 1, the MQTT specification allows the receiver to send PUBACK before completing onward delivery. In MQTT 5, inspect the PUBACK reason code before recording broker acceptance: an error reason rejects the publication, while No matching subscribers does not establish onward delivery. Even a successful acknowledgement does not prove that a later subscriber received the message or that an energy application stored it. AWS IoT Core, for example, supports MQTT QoS 0 and 1 but not QoS 2; destination limits must be checked rather than inferred from the publishing client.

Delivery features also solve different problems:

  • A retained message stores the latest retained application message for a topic so a future matching subscriber can receive it. It is not a time series.
  • A persistent session can preserve defined session state and queued messages, subject to protocol version, negotiated limits, expiry and broker behaviour. It is not automatically a 24-hour gateway buffer.
  • An in-memory batch may reduce network calls but normally does not survive every process or power loss.
  • A durable local outbox deliberately stores selected records for retry. Its capacity, retention, filtering, ordering and duplicate behaviour still need a contract.
  • A historian or application database is the destination record. Broker acceptance is not evidence that this record exists.

Where duplicates matter, carry a stable record identity or another documented deduplication key. Preserve source measurement time independently from arrival time so replayed records do not appear current.

How EpiSensor Edge participates

EpiSensor Edge provides a visual Node-RED flow editor on the Gateway. A project flow can acquire field data, transform it into an agreed topic and payload, and publish it to an MQTT broker using a configured TLS connection. The exact broker, credentials, certificates, topic design, payload schema and destination acceptance remain project-specific.

Fictional Edge MQTT broker configuration showing port 8883 and a selected TLS configuration, with no real destination or credentials.
Example Edge broker configuration using a fictional destination. A selected TLS configuration is the start of commissioning evidence, not proof that identity verification or destination ingestion passed.

The Enel X integration guide is one maintained example of Edge publishing mapped telemetry to an MQTT destination over TLS. It should not be generalized into a promise that every broker, QoS option or outage pattern works without project configuration and acceptance.

Layer Typical owner
Meter or sensor acquisition and quality Site integrator and device owner
Edge transformation, topic and payload mapping EpiSensor or project integrator
Broker endpoint, trust and client identity Platform owner and commissioning engineer
Broker topic access rules Broker or platform owner
Receiving application mapping and storage Platform owner
End-to-end acceptance, certificate renewal and rollback Named project owner

Do not infer broker certificate verification from the product name or the presence of a TLS node. Confirm that verification is enabled and that the intended reference hostname or IP identity is configured in the deployed flow. Likewise, Edge's durable telemetry outbox is available to specific tracked delivery paths; an arbitrary MQTT flow does not automatically gain restart-safe, unlimited or lossless buffering.

Browse the integration library for reviewed destination-specific evidence. For a multi-vendor site, use the interoperability guide to specify the data contract rather than treating MQTT support as complete compatibility.

MQTT over TLS commissioning checklist

The applicable project and security requirements remain authoritative. This sequence exposes common gaps without using production actuation as a connectivity test.

  1. Record the contract. Capture the approved broker FQDN, port, MQTT version, authentication method, client ID, topic schema, payload contract, QoS, retain, session and expiry choices, with a named owner for each.
  2. Prove the network path. Verify gateway time, DNS, route and exact outbound firewall rule before changing protocol settings or credentials.
  3. Inspect the certificate material safely. Check the chain, identity, fingerprint where required, validity dates, matching private key and key-file permissions. Do not paste private keys into tickets or screenshots.
  4. Verify the broker identity. Enable certificate verification, configure the intended hostname or IP identity and required SNI, then prove that a wrong hostname and an untrusted CA fail.
  5. Prove unique client identity. Confirm that only the intended gateway uses the client ID and credentials. Investigate repeated connection displacement or reconnect churn.
  6. Test least privilege. Publish permitted telemetry and attempt one denied publish or subscription outside the approved topic boundary.
  7. Trace one known measurement. Follow a safe source value, original timestamp, unit and identity through Edge, broker evidence and the final application. Compare every field.
  8. Observe continuing delivery. Watch more than one reporting interval. A single retained or old value does not prove a live data path.
  9. Exercise a bounded outage. Check fresh data, expected backlog, duplicates, session and message expiry, outbox capacity and destination behaviour separately after reconnection.
  10. Prove renewal and rollback. Record expiry-warning, renewal, reload and rollback ownership. Test the replacement certificate before retiring the old one.

For the observation itself, the sensor-data guide explains source time, quality, lineage and gap evidence. For supervisory systems, the SCADA guide separates protocol acknowledgement from device state and physical outcome.

Commands and control need separate acceptance

An MQTT command path needs an explicit expiry, a least-privilege command topic, safe duplicate handling, local interlocks and safe-state behaviour, and physical-state readback. Avoid retained commands unless the persistence and hazard consequences have been deliberately assessed.

Neither connection success nor PUBACK proves that equipment changed state. Define the evidence chain from authorised request to receiving application, local controller, returned device state and, where necessary, independent physical measurement. Do not use a production actuation merely to test connectivity.

The BMS, SCADA and meter integration guide helps place Edge within an existing control estate while keeping deterministic protection and safety functions in their approved local systems.

Troubleshooting by layer

Avoid “fixes” that disable certificate verification or broaden topic access. Start at the first boundary that can explain the symptom.

Symptom First layer to check Do not infer
Broker name does not resolve DNS and the assigned hostname Certificate failure
TCP connection times out Route, firewall and exact port Bad username or client certificate
TLS handshake or identity error Clock, validity, chain, hostname or SNI, and key pair Permission to publish
Repeated connect and disconnect Duplicate client ID, network stability or session policy Stable delivery
Connected but publish refused Topic ACL and client identity Wrong sensor mapping
Successful PUBACK but no platform record MQTT 5 reason code, topic and payload mapping, then application ingestion Data is safely stored
Reconnect succeeds but history is absent Selection, batching, outbox, expiry and broker limits Lossless replay

Keep the evidence from each test: timestamp, gateway and broker identity, flow or configuration revision, topic with sensitive segments redacted, expected result, observed result and named owner. That record is more useful than a screenshot of a connected status.

Frequently asked questions

What is MQTTS?

MQTTS is common shorthand for MQTT carried over a network connection protected by Transport Layer Security (TLS). It is not a separate MQTT protocol version. Correctly configured TLS can protect the MQTT connection against eavesdropping and tampering and can authenticate the broker, while MQTT still defines topics, sessions and message delivery behaviour.

What is the difference between MQTT and MQTTS?

MQTT describes the publish-and-subscribe messaging protocol. MQTTS means using MQTT over TLS. TLS adds protection for the network connection and can authenticate one or both endpoints, but it does not replace broker topic permissions, payload validation or proof that the receiving application stored and used the data correctly.

Does port 8883 guarantee a secure MQTT connection?

No. TCP port 8883 is the registered and recommended port for secure MQTT, but a port number is only a convention. Commissioning must prove that TLS was negotiated, the certificate chain is trusted, the certificate matches the intended broker identity and verification has not been disabled.

Does MQTT QoS 1 prove that an energy platform stored the data?

No. A QoS 1 PUBACK completes the MQTT exchange for that delivery leg, but MQTT 5 PUBACK reason codes can report rejection. Even a successful acknowledgement does not prove that a later subscriber received the message or that an energy platform validated, mapped and stored the measurement.

Does Edge buffer every MQTT message through an outage?

No. Durable recovery depends on the installed flow and its configured storage, selection, retention, capacity, expiry and replay behaviour. A retained message, a persistent MQTT session, an in-memory batch and a durable local outbox are different mechanisms and must be tested separately.

Planning an MQTT connection for an energy-monitoring project? Discuss the devices, destination and commissioning requirements with EpiSensor.

Working out what this needs on your own site? Answer a few questions