Skip to content
MaestroHub
Menu
Free trialdownload and run it todayStart the pilot

Integrations

Siemens S7 to MQTT, without a script.

Read the PLC's data blocks with MaestroHub's S7 connector and publish each value to your MQTT broker on a topic from the plant model, with its unit and quality. MaestroHub keeps publishing through the PLC's quirks and buffers when the broker is unreachable.

The flow

One value, from the machine to MQTT. Illustrative.

Siemens S7PLC protocolDB10.DBD4
MaestroHub

Oven 3 temperature · 182.5 °C · Good

  • named, unit, quality
  • origin stamped
  • buffered on disk
MQTTmessage brokerplant/bake/oven3/temperature

Why do it with MaestroHub

More than a pipe from Siemens S7 to MQTT.

01

S7 straight to the broker

No OPC UA server or protocol gateway between the PLC and the broker.

02

The topic tree is governed

Topics follow the namespace with schemas, so a misspelt topic doesn't quietly create a second truth.

03

Writes back are controlled

If a value needs to go back to the PLC, it goes through permissions and the audit trail.

What lands in MQTT

An example. You choose the fields in the pipeline.

topicvalueunitqualityts
plant/bake/oven3/temperature182.5°Cgood2026-10-03T06:00:01Z

Set it up in three steps

  1. 1

    Connect Siemens S7

    Add the S7 connection with the PLC's address, rack and slot, then create read functions for the data blocks you need.

  2. 2

    Give the values meaning

    Map each value to a topic in the namespace with its name, unit and schema. Quality and origin are stamped on every value.

  3. 3

    Deliver to MQTT

    Add an MQTT publish output with a topic template, so every value lands on a clean, predictable topic.

Before you start

What each side needs, from the connector documentation.

Siemens S7

  • Network reach to the PLC on port 102 (ISO-on-TCP), entered as host:port.
  • The CPU rack and slot from the PLC hardware configuration. Common combinations are rack 0 with slot 1 or slot 2.
  • The session password, only if password protection is enabled in the PLC security settings. Maximum 8 characters.
  • The DB numbers, byte offsets and data types of the values you need, for example from the TIA Portal project.

Example settings

PLC Address
192.168.1.100:102
Rack
0
Slot
1
Connection Type
Programming Device (PG)
Request Timeout (ms)
10000
Idle Timeout (ms)
30000
Siemens S7 connector documentation

MQTT

  • A reachable MQTT broker: hostname, port (typically 1883 plain, 8883 for TLS) and protocol tcp, ssl, ws or wss.
  • Broker credentials if the broker requires them. A password needs a username.
  • For verified TLS or mutual TLS: the CA certificate, client certificate and private key in PEM format.

Example settings

Protocol
ssl
Broker Hostname
broker.example.com
Port
8883
MQTT Version
3.1.1
Client ID
<your-client-id>
Keep Alive (sec)
60
MQTT connector documentation

Things to know

Pitfalls and limits the documentation calls out, so they don't surprise you on site.

Siemens S7

  • Process Inputs (I) are read-only and writes to them are rejected. CHAR, STRING, WSTRING and the time and counter types can be written to DBs only, not to memory areas.
  • For STRING and WSTRING, Size must be the declared maximum length plus the 2-byte S7 header. STRING[20] in TIA Portal is 22 bytes.
  • A passing Test All checks the configuration only. Submit can still fail if the PLC rejects it, for example when the DB does not exist or the address is out of range on that PLC.

Limits

  • Write functions handle one value each. Only reads group several data points into one function.
  • TIMER, COUNTER, TIME_OF_DAY and DATE_AND_TIME can be read but not written.

MQTT

  • Plain ws cannot use TLS. Use wss for TLS over WebSocket.
  • The certificate fields appear only when TLS is on and certificate verification is not skipped.
  • On MQTT 5.0, write a shared subscription in the topic filter to load-balance across clients: $share/<group>/<topic>.

Limits

  • Reconnection, subscription recovery and message acknowledgement are handled by the platform and cannot be configured on the connection.

What teams use it for

Unified namespace on Siemens lines

Every S7 PLC publishing to one broker in one structure.

MES and app integration

Apps subscribe to clean topics instead of polling PLCs.

Line monitoring

Live machine states for dashboards and alerts.

Ways to connect Siemens S7 to MQTT

In general terms. Check any specific product for its own details.

Compare a custom script, a flow tool, a cloud vendor's edge service and MaestroHub

Swipe sideways to see every column

A custom scriptA flow toolA cloud vendor's edge serviceMaestroHub
Talks Siemens S7A library you chooseCommunity plug-insDepends on the vendorBuilt in, one of 90+ connectors
Names, units and schemaYou write itYou build itPartly, in the vendor's modelOne governed namespace
Quality on every valueYou write itYou build itDepends on the vendorBuilt in, carried through calculations
Where each value came fromYou write itYou build itDepends on the vendorStamped on every value
Survives a network outageYou build itYou build itUsually, to that vendor's cloudOn disk, per destination, in order
Several destinations at onceOne script eachYes, flow by flowMostly that vendor's cloudAny mix, each with its own buffer
Permissions and auditYou build itYou build itCloud account permissionsRoles, single sign-on, audit trail
AI agents can use the dataYou build itYou build itDepends on the vendorThrough the MCP server

Questions

How do I publish Siemens S7 PLC data to an MQTT broker?

Read the PLC's data blocks with MaestroHub's S7 connector and publish each value to your MQTT broker on a topic from the plant model, with its unit and quality. MaestroHub keeps publishing through the PLC's quirks and buffers when the broker is unreachable.

Do I need to write code to connect Siemens S7 to MQTT?

No. You configure the Siemens S7 connection and the MQTT output in MaestroHub and join them with a pipeline. Transformations can be added where you need them.

Where does MaestroHub run for this?

On your own infrastructure next to the machines: an edge box, a virtual machine or Kubernetes. Nothing has to leave your network.

Why not just write a script for Siemens S7 to MQTT?

A script works on day one. The cost comes later: decoding and naming values, handling bad quality, buffering through outages, keeping credentials safe, and doing it again for the next machine and the next destination. MaestroHub does those once, for every connector.

What else can Siemens S7 data go to?

More than 90 connectors are included in every edition, among them historians, databases, cloud warehouses, message brokers and business systems, so the same values can feed several destinations at once.

Try Siemens S7 to MQTT yourself.

The free trial includes every connector. No factory to hand? The Digital Factory Simulator serves OPC UA, Modbus, MQTT and more on your laptop.

Cookie preferences

Choose which categories of cookies you allow. Strictly necessary cookies are always on because the site cannot function without them.