Skip to content

MQTT connection

mqtt-properties Set MQTT Properties at configuration page

Service Ui MQTT Server

mqttdrawio1

  • Service Ui is MQTT Server
  • PLC opens a MQTT connection to Service Ui backend

MQTT Properties:

  • MQTT mode: Server
  • MQTT broker: not required.
  • MQTT port: use default 1883 if not used by another service. 8883 alternatively.
  • MQTT PLC ID: does not really care, since point to point connection between PLC and Service Ui.

Service Ui "Broker" IP address

Since the PLC must open the MQTT connection to Service Ui Backend, it should know the IP where Service Ui backend is running. It is set by Service Ui backend over OPC-UA/ADS to PLC:

  • Beckhoff: framework.serviceUi.serviceUiIf.parameter.ipAddress
  • S7Tia: fbAEServiceUi01.If.parameter.ipAddress
  • B&R: ::ServiceUi:If.parameter.ipAddress

Consider that the PLC does not support multiple MQTT connections. Because of that constraints, only one Service Ui instance is supported at same time. For multiple instance support, please use Service Ui with an external Broker.

Determination of IP

  • Get PLC IP address configured at backend
  • If PLC name instead of IP defined: DNS resolution is used to get IP
  • If more than one network connection exists at machine which Service Ui is running (WiFi, multiple ethernet adapters, virtual machine networks, ...):
  • The network address is used, which has best match to PLC IP, example:
    • PLC IP: 192.168.0.23
    • Service Ui host IPs:
    • 192.168.1.10
    • 10.10.0.23
    • Service Ui determines 192.168.1.10 as best match.

Service Ui with external broker

mqttdrawio1

  • Service Ui opens a MQTT connection to a broker
  • PLC opens a MQTT connection to a broker

With this use case multiple MQTT clients are supported. If item communication is handled over MQTT too (not supported yet). There is no direct connection between Service Ui backend and PLC required.

MQTT Properties:

  • MQTT mode: Client
  • MQTT broker: host, IP of existing broker
  • MQTT port: use default 1883 if not used by another service.
  • MQTT PLC ID: Unique PLC ID is required to access PLC_1 or PLC_2

Configured broker and PLC ID is set by Service Ui Backend to PLC over OPC-UA.