Skip to content

Connect a PLC or a Modbus device via a gateway

Logable ingests HTTP and MQTT. A gateway reads your PLC or Modbus registers and publishes each reading on the device's topic.

A PLC or a Modbus device does not speak HTTP or MQTT. A gateway sits between them. It polls the equipment on its own protocol and republishes each reading to Logable over MQTT. Logable sees a normal MQTT device, nothing gateway-specific.

How it works#

The gateway does three things.

  1. It polls the equipment on the local network, over Modbus RTU, Modbus TCP, or a PLC's own protocol.
  2. It maps each register to a metric name from the device's type in Logable.
  3. It publishes the reading as JSON to devices/<DEVICE_ID>/data, using the device's id as the MQTT username and its token as the password.

This is the same MQTT contract every device uses. See Publish readings over MQTT for the topic, the payload shape, and the connection settings.

Set up the device in Logable#

Add the device in Logable first, the same way you would for any device. Pick its device type, then copy its id and token from the Connection tab. The gateway needs both before it can publish.

See Connect a device for the full walkthrough.

Configure the gateway#

Point the gateway's MQTT client at Logable. Most gateways ask for the same set of fields.

  • Broker host: mqtt.logable.app
  • Port: 8883, with TLS enabled
  • Client id: any unique value. logable-<DEVICE_ID> is a safe default.
  • Username: <DEVICE_ID>
  • Password: <DEVICE_TOKEN>
  • Topic: devices/<DEVICE_ID>/data
  • Publish interval: match the equipment's real reporting cadence, not faster.

The gateway's own JSON template needs to match the metric names Logable expects for that device's type. Reshape the template so each mapped register lands as a key inside a data object:

Gateway payload template
{
  "data": {
    "weight": 18750.5
  }
}

See Device types for the exact field names per type, with a full example payload.

Some gateways validate the broker certificate against a small built-in trust store and need a CA file uploaded by hand instead. Logable's device Credentials step carries a CA certificate download for exactly this case.

One gateway, many devices#

One Logable device represents one piece of equipment, never a whole gateway. A gateway polling ten PLCs needs ten Logable devices: ten ids, ten tokens, and ten separate topic settings on the gateway itself.

Each device behind the gateway is rate-limited on its own id, the same as any other device. The gateway's devices also share the organization's combined ceiling, since they belong to the same organization. See Limits.

Check it#

Open the device's Overview tab to see readings arrive. If nothing shows up, open the Connection tab's Device log to watch what arrives, and any rejection with its reason, while the gateway publishes.

Search the docs

Find a guide, an integration page, or a device type.