Skip to content
Proxus 2.0.0 Proxus 2.0: the largest release in Proxus history Release notes

Connection guides · Siemens S7 MQTT

Siemens S7 to MQTT: read an S7 PLC and publish its values to your broker

Proxus reads Siemens S7 PLCs, from the S7-200 to the S7-1500, with its own S7 driver on the Edge Gateway. This guide connects one PLC with the device setup wizard, then publishes its values to the MQTT broker you already run through an outbound target. The gateway’s built-in broker publishes the same values on topics that follow your Unified Namespace.

Every step is taken from the Proxus documentation and links to its page.

What you need

  • A Proxus hub you can sign in to, and a user role that may create devices and outbound targets. Install Proxus with Docker
  • An Edge Gateway that can reach the machine on the network. The hub’s own gateway, SYSTEM, works for machines on the hub’s network; a gateway shows Connected when it is online. Install an edge gateway
  • The PLC’s IP address, its rack and slot, and the tags to read: a TIA Portal “PLC tags” export (.csv or .xlsx) is ideal. Add a device
  • The connection details of your MQTT broker (host, port, user name and password, topic), and network access to it from every gateway that will send to it. Outbound targets

Steps

  1. 01

    Allow access on the PLC

    On S7-1200 and S7-1500, allow PUT/GET communication from remote partner in the CPU settings and note the rack and slot. Without it the PLC refuses the session.

    Docs: Troubleshoot devices

  2. 02

    Open the device wizard and choose Siemens S7

    Go to Connect > Devices and select New. Choose the Edge Gateway on the machine’s network: the connection is tested from that gateway. Type s7 in the protocol search box, select the Siemens S7 card and set its switch to your CPU family, then select Next: Connection.

    Docs: Add a device

    The first wizard step with the gateway selected, a search term in the protocol search box and one protocol card selected
    Shown with Modbus TCP; the step is the same for every protocol.
  3. 03

    Enter the address and test the connection

    Enter the machine’s IP address as the gateway sees it. Leave Port empty to use port 102. Protocol settings such as rack and slot are shown with the address, less common ones under Advanced. For Siemens S7 the test also reads the CPU’s order number: The device says it is <...>. Leave Read every at Profile default unless you need faster or slower reads, then select Test the connection. The gateway itself tries to reach the machine and shows each check: whether it reached the address, and whether the machine accepted the protocol session.

    Docs: Protocols

  4. 04

    Add the tags

    On the From file tab, load the TIA Portal “PLC tags” export: its addresses such as %MW10 become the addresses the driver reads (M10), and the name, data type and address columns are found by their headers. For single tags, the Address helper builds an address from data block, offset and bit. Select Read all once to read every tag one time; a wrong address shows its error on the row. Enter a Profile name so the next PLC of this kind can reuse the tags.

    Docs: Add a device

    The tag table with names, addresses, types and units, and a test-read value next to each tag
  5. 05

    Name and place the device, then save

    In Place and type, enter a unique Device name, fill in the Place from Enterprise down to Equipment module (every level is optional) and choose the Device type, which Proxus does not guess. The place decides where the device appears in the Unified Namespace. Select Save and verify: the stages Saved, Sent, Device connected and First values turn green in order, and each tag shows its first value.

    Docs: Add a device

  6. 06

    Create the MQTT target for your broker

    Go to Connect > Outbound Targets, switch the filter to All, open the MQTT sample and select Clone.... Enter a unique Profile Name, then select Edit Parameters and fill in Broker Host and Broker Port (1883 by default). Set Topic to the topic to publish to; left empty, values go to proxus_device_data. Username and Password are used only when both are set. For TLS, turn on Use TLS, use port 8883 and choose the broker’s CA as Trusted Server Certificate. Under Transport Strategy, Pass Through sends every value read and On Change only values that changed. Select Save.

    Docs: Outbound targets

    The MQTT sample target with its target type, transport strategy and parameters such as BrokerHost and BrokerPort
  7. 07

    Check the target from the gateway

    On the saved target, select Check. Under Run Probe On, choose the gateway that reads the device rather than the hub: the gateway is what sends the data, and a target that only the plant network can reach fails from the hub. The Configuration Check lists errors and warnings without contacting the target. Test Connection then connects without sending data and reports Connected, Reachable or Failed with the reason.

    Docs: Outbound targets

    The Check window of an outbound target with Run Probe On, the runtime health and the configuration check
  8. 08

    Send the device’s values to the target

    In Connect > Devices, select the device (or several), then Targets > Add Target and choose the target. For one device you can also use the Delivery tab on its page; a new device can tick the target under Where does the data go? in the wizard. The target’s Devices count goes up, and its Status turns green after the first delivery.

    Docs: Outbound targets

Verify the data

  • In the wizard’s last step, the stages complete in order and each tag shows its first value and how long ago it arrived. For Siemens S7, the connection test has already shown the CPU’s order number. Add a device
  • Open the device. On the Live values tab every tag shows its value, a small trend, its Quality and when it was updated. Good means the value was read without error. The device page
  • Open Organize > UNS Explorer, type the device name in Search... and press Enter, then right-click a node and choose Expand All. The device sits at the place you gave it, each tag with its current value, trend and update time. UNS Explorer
  • Subscribe to the target’s Topic on your broker with any MQTT client: each reading arrives there as JSON. Each gateway also publishes the same values on its built-in broker; subscribe to v1/# with the gateway’s MasterToken as user name (port 1883, or 8883 with TLS). MQTT and the UNS topics
  • On the target, Status is green, and Last Success is renewed about once a minute while the target keeps delivering. Outbound targets
The UNS Explorer with the tree expanded from the enterprise down to a device’s tags, and one tag selected in the panel

Common problems

The device refused the session.
The network is fine but the PLC did not accept the session. Check rack and slot, and that the CPU allows PUT/GET communication from remote partner. Troubleshoot devices
The gateway cannot reach the device.
There is no TCP connection: a wrong address or port, the device is off, or a firewall or VLAN is in between. The test runs on the gateway, so check reachability from the gateway’s host, not from your own computer. Troubleshoot devices
The device shows Sleep Mode
A Siemens S7 that cannot connect goes to sleep mode after three failed read cycles. The gateway then retries after 10 seconds, waiting twice as long after each failure, up to 5 minutes. Fix the cause named after Last Error:; the first successful read ends sleep mode, and saving the device ends it at once. Troubleshoot devices
S7 Bool tags should use DBX bit addresses, not DBW word addresses.
Proxus recognizes common S7 address mistakes and says so on the tag. Another one: S7 Int/UInt/Float values are typically 4 bytes. Use DBD or change the data type. Fix the address or the data type in the profile. Troubleshoot devices
Values go to proxus_device_data or localhost
A key left empty falls back to a default value. Check names it as a warning; set the key it names on the target. Troubleshoot data
The server’s certificate is not trusted
Every TLS connection verifies the server, and a target never accepts an unknown certificate. For a self-signed or private-CA certificate, upload the CA to the Certificate Store and choose it as the target’s trusted server certificate. The address on the target must be a name in the server’s certificate. Secure connections to targets

Next steps

Next step

Try Siemens S7 to MQTT on your own equipment.

Install Proxus and follow the steps with your own equipment. If something does not connect, an engineer looks at it with you.

  1. 01

    Scoping call

    Equipment, protocols, sites and the systems the data has to reach.

  2. 02

    Technical walkthrough

    A working demo against a scenario that resembles your plant, not a generic tour.

  3. 03

    Pilot plan

    A defined first line or site, with the deployment and security questions answered up front.

  4. 04

    Roll-out

    The same templates bring the next lines and sites online.