Connecting a PLC¶
On this page: when a PLC should send its readings to Lutra directly, the integration path, an outline for Phoenix Contact PLCnext, a worked message for an overflow pool with a buffer tank, why Lutra sends no commands to a PLC, a testing checklist and troubleshooting.
This page is for installers and system integrators who already control the pool plant with their own PLC, for example a Phoenix Contact PLCnext controller, Siemens, Beckhoff, Wago or a Codesys-based controller, and who want the readings in Lutra Insight with history, charts, alerts and the owner view.
When to use this¶
- The PLC keeps control. Pumps, valves, refill, backwash and heating stay in your PLC program, with your own interlocks. Lutra only receives readings.
- No Lutra box next to the PLC. The PLC sends its readings itself, through the external devices API. With no second controller in the plant room there is never doubt about who switches what.
- Write only. The device certificate only allows the PLC to publish its own readings. Lutra cannot send anything to the PLC. See Commands from Lutra to the PLC.
If the PLC is the master of a Modbus bus and you still want a Lutra box to read that bus, the box must run in listen-only mode; see Bus devices and inputs. For a PLC with network access, sending directly as described here is the simpler path.
The integration path¶
The PLC is an external device. Everything below is documented in External devices; this is a summary, not a replacement.
- Register: an administrator adds an own device to the pool in Lutra Insight and gets a device ID such as
lutra-ext-0a1b2c3d4e5f. See Register the device. - Certificate: a key pair is made on the PLC, a CSR with the common name (CN) exactly equal to the device ID is pasted in the portal, and the signed certificate is installed on the PLC together with the Amazon root CA.
- Connect with TLS 1.2 and that client certificate to
iot.lutrapool.com:- MQTT on port 8883: client ID exactly the device ID, publish with QoS 1 to
lutra/v1/<device ID>/telemetry, no subscriptions, see Sending over MQTT; or - HTTPS POST on port 8443 to the same topic, URL-encoded in the path, see Sending over HTTPS.
- MQTT on port 8883: client ID exactly the device ID, publish with QoS 1 to
- Message: one JSON object with
v(always3),ts(UTC seconds since 1970) andpts({quantity: value}, 1 to 40 entries), at most 4 KB. Optional:seq,boot,units,fw. Any other field makes Lutra drop the whole message. See Message format. - Quantities: only keys from the Quantities catalogue, in the Lutra unit and range. Lutra never converts units. A reading with an unknown key, the wrong type or a value out of range is dropped; the rest of the message is kept.
- Rate: at most 12 messages per minute per device. Every 1 to 5 minutes, plus on a clear change, is enough. After 30 minutes without a message the device shows as offline.
The same path works for any PLC brand. Before you start, check that the controller's MQTT or HTTPS client supports all of the following; a client that misses one of them will not work with Lutra:
- TLS 1.2 with a client certificate and private key (mutual TLS), not only a username and password;
- a CA you choose (the Amazon root CA);
- for MQTT: a client ID you set freely, a topic you set freely, QoS 1, and no retained messages;
- a payload you build yourself as a JSON text;
- a clock synchronised to NTP, so that
tsis correct.
PLCnext: what is available¶
This section summarises Phoenix Contact's public documentation as checked on 2026-11-24. Lutra has not tested a PLCnext controller yet. Names of menus and function blocks change between firmware versions: always check the PLCnext Info Center for your controller and firmware.
| Option | What Phoenix Contact documents | Fit for Lutra |
|---|---|---|
| Built-in MQTT client (firmware 2024.0 LTS and later) | Publishes OUT ports marked for Proficloud to a broker set as "Other MQTT Broker" in Web-based Management (WBM); publish only; TLS with an Identity Store and a Trust Store; QoS currently fixed at 0 ("at most once"); the client ID is combined with the device UUID [1] [2] | Probably not: the payload is not a message you define, the client ID is not exactly the device ID, and QoS 1 is not available. Not tested |
| MQTT Client function block in the IIoT library, free in the PLCnext Store [1] | An MQTT client inside your PLCnext Engineer project; Phoenix Contact recommends it for connecting to more than one broker [1] | The preferred route to check. Whether it takes a client certificate and key (not only a server CA) is not verified: check the library documentation |
| An app on the controller's Linux system | PLCnext controllers run Linux; the admin user has a matching Linux user [3]. PLCnext Store apps include Function Extensions, which can be "an extension of a runtime, a container or a command line tool" [4] | Possible for HTTPS POST (or MQTT) from your own program or container. Which languages and tools are available depends on the controller and firmware: check the Info Center |
Libraries from the PLCnext Store ("PLCnext Engineer Library") are imported into PLCnext Engineer; apps are installed online from the Store or offline through WBM [4] [5].
Certificates on PLCnext. WBM keeps your own identities (an X.509 certificate with its private key) in an Identity Store and the certificates of trusted partners in a Trust Store [6]. From firmware 2025.0, WBM can generate a key pair in an Identity Store, generate a CSR for download, and upload the signed certificate as PEM [7]. That matches the Lutra flow: the key is made on the PLC and never leaves it. AWS IoT Core, which signs the certificate, accepts RSA keys of at least 2048 bits and ECC keys on the NIST P-256, P-384 or P-521 curves [8]; choose one of those as the key type.
To be confirmed
For PLCnext firmware older than 2025.0 the Info Center documents importing a key pair and certificate into an Identity Store, but not generating a CSR on the controller [6]. Making the key on a computer and uploading it breaks the rule that the key never leaves the device. Whether Lutra accepts that for older firmware is not decided; ask Lutra first.
Step outline for PLCnext¶
- Check the firmware version of the controller in WBM. It decides which MQTT client options and which certificate pages you have.
- Register the device in Lutra Insight: open the pool, Own devices, Add own device. Note the device ID. See Team and administration.
- Create the identity on the controller: in WBM, under certificate management, add an Identity Store, generate a key pair (EC P-256, or RSA 2048 or larger), and generate a CSR with the common name exactly equal to the device ID. Download the CSR.
- Get the certificate: paste the CSR in the portal, choose Create certificate, download
lutra.crtand upload it as the certificate of that Identity Store. - Trust the server: add
AmazonRootCA1.pem(https://www.amazontrust.com/repository/AmazonRootCA1.pem) to a Trust Store. - Install the MQTT client: import the IIoT library from the PLCnext Store into your PLCnext Engineer project, or install your own app for HTTPS. For the inputs of the MQTT client (broker, port, client ID, TLS identity, QoS, topic) check the library documentation; Lutra does not document vendor function blocks.
- Map PLC variables to the message: build the JSON text in the program from your variables, in Lutra units (see the example). Leave out a quantity when the PLC knows its value is not valid (sensor fault, no flow through the measuring cell) instead of sending the last value.
- Publish every 60 to 300 seconds, plus on a clear change (pump starts or stops, refill valve opens). Never more than 12 messages per minute.
- Run the testing checklist.
Example: overflow pool with buffer tank¶
An overflow pool where the PLC runs the filter pump with a variable-speed drive, controls refill from float switches in the buffer tank, reads pH, ORP and free chlorine in a flow cell, and starts a heat pump. One message, built by the PLC every two minutes:
{
"v": 3,
"ts": 1795242969,
"seq": 1842,
"boot": 7,
"fw": "pool-plc 2.1",
"pts": {
"ph": 7.25,
"orp": 735,
"free_cl": 0.8,
"water_temp": 28.4,
"flow": true,
"flow_rate": 42.5,
"pump_running": true,
"pump_speed": 80,
"filter_pressure": 85,
"level_low": false,
"level_fill": false,
"level_high": false,
"fill_valve": false,
"backwash": false,
"heatpump_on": true,
"outdoor_temp": 14.2
}
}
| Quantity | From the PLC | Note |
|---|---|---|
ph, orp, free_cl |
measuring cell transmitters | Leave out when there is no flow through the cell or the transmitter reports a fault |
water_temp |
temperature sensor in the return line | °C |
flow |
flow switch on the measuring cell | true or false, never 1 or 0 |
flow_rate |
flow meter | m3/h |
pump_running, pump_speed |
drive status and speed | pump_speed in % of maximum |
filter_pressure |
pressure sensor before the filter | kPa: a value in bar times 100 (0.85 bar is 85) |
level_low, level_fill, level_high |
float switches in the buffer tank | The catalogue does not say which vessel; in an overflow pool these are the buffer tank switches that drive refill |
fill_valve, backwash |
output states | true while the valve is open or backwash runs |
heatpump_on |
output or feedback contact | |
outdoor_temp |
outdoor sensor | °C |
All keys are in the Quantities catalogue. Sending the pump state in every message keeps the device online during a planned pump pause, when the water readings are left out.
To be confirmed
Quantities for an overflow pool with analogue level and pressure measurement are planned but not in the catalogue yet: buffer tank level, pressure vessel pressure and overflow level (as a height in cm or m). Their keys, units and ranges are not decided. Until they are added, do not send them: an unknown key is dropped. Lutra adds new quantities to the catalogue for everyone; ask Lutra if you need one.
Commands from Lutra to the PLC¶
Not available. The external devices API is write only: the device certificate cannot subscribe or receive, so nothing from Lutra can reach the PLC. Setpoints, schedules and switching stay in the PLC program and its own HMI.
To be confirmed
Sending commands from Lutra to a PLC (for example starting a backwash) is a possible future option, and only for installations where the PLC itself enforces all interlocks, so that a command from Lutra can never bypass them. There is no design or date for it.
Testing checklist¶
- The device appears in Lutra Insight under Own devices of the right pool, with a certificate created.
- The PLC clock is synchronised to NTP, and
tsis UTC seconds since 1970, not local time. - One test message sent by hand (for example with the
curlcommand in External devices from a laptop with a test device, or a single publish from the PLC) shows up in the pool. - Every value is in the Lutra unit (kPa, m3/h, °C, mg/l, mV) and in range; booleans are
trueorfalse. - The message contains only
v,ts,ptsand the optional fields; noNaNorInfinity(not valid JSON). - The interval is 60 to 300 seconds; never more than 12 messages per minute, also after a restart or a reconnect with a backlog.
- During a planned pump pause the PLC keeps sending (pump state), and the device stays online.
- A sensor fault or no flow leaves that quantity out instead of repeating the last value.
- Unplugging the network for longer than 30 minutes shows the device offline, and it recovers on its own.
- The private key cannot be read from outside the PLC, and no copy exists elsewhere.
Troubleshooting¶
| Symptom | Likely cause | Check |
|---|---|---|
| TLS handshake fails | Wrong CA, certificate not matching the key, or TLS older than 1.2 | Trust Store holds AmazonRootCA1.pem; the certificate uploaded to the Identity Store is the one signed for this CSR; host is iot.lutrapool.com |
| No connection at all | Outbound port blocked | Firewall allows outbound TCP 8883 (MQTT) or 8443 (HTTPS); DNS works on the PLC |
| TLS fails right after commissioning, or after a battery change | PLC clock wrong, so the certificate looks not yet valid or expired | Set NTP; check date and time in WBM or the PLC |
| MQTT connects and is closed at once | Client ID is not exactly the device ID, a subscription was attempted, the topic is wrong, the retained flag is set, or the device was revoked | Client ID and topic lutra/v1/<device ID>/telemetry; no subscriptions; retain off; device status in the portal |
| HTTPS returns 403 | Device ID in the URL is wrong, or the device was revoked | URL-encoded topic in the path; device status in the portal |
| Accepted, but nothing appears | ts more than 7 days old or more than 2 minutes in the future (often local time instead of UTC); a field outside the envelope; v not 3; message larger than 4 KB |
Compare ts with the current UTC time; remove extra fields |
| Some readings missing | Unknown key, wrong type ("7.2" as text, 1 for a boolean) or value out of range |
Keys and ranges in Quantities |
| A value is a factor 100 off | Wrong unit, for example pressure in bar instead of kPa | Convert in the PLC; Lutra never converts |
| Gaps in the history | More than 12 messages per minute (extra ones dropped), or no message for 30 minutes | Publish interval; seq helps find gaps |
Sources¶
Checked on 2026-11-24.
- Phoenix Contact, PLCnext Info Center, "Communication via MQTT broker": https://plcnext.help/te/Communication_interfaces/Communication_via_MQTT.htm
- Phoenix Contact, PLCnext Info Center, WBM "Configuration: Proficloud services" (MQTT broker and time series data settings): https://plcnext.help/te/WBM/Configuration_Proficloud_Services.htm
- Phoenix Contact, PLCnext Info Center, "User rights": https://plcnext.help/te/Operating_System/Root_rights.htm
- Phoenix Contact, PLCnext Store Info Center, "App types": https://store.plcnext.help/st/App_types.htm
- Phoenix Contact, PLCnext Info Center, "PLCnext Store resources": https://plcnext.help/te/Functions_and_applications/PLCnext_Store_resources.htm
- Phoenix Contact, PLCnext Info Center, WBM "Certificate authentication" (firmware up to 2024.6): https://plcnext.help/te/WBM/Security_Certificate_authentication.htm
- Phoenix Contact, PLCnext Info Center, WBM 2 "Certificate management" (firmware 2025.0 and later): https://www.plcnext.help/te/WBM2/WBM2_Security_Certificate-management.htm
- AWS IoT Core API reference, "CreateCertificateFromCsr": https://docs.aws.amazon.com/iot/latest/apireference/API_CreateCertificateFromCsr.html
Related pages¶
Last reviewed: 2026-11-24. Applies to Lutra Lite 0.4.1.