MQTT Tests with Paho

What is Paho?

Paho is an Eclipse tool to connect to an MQTT broker. Further information on the tool can be found at the project page

A description on how to install paho can be found here

Preconditions

OpenSSL

To format the certificates, openssl is required.

Install TrustStore

To communicate with the agrirouter via MQTT two certificates are involved. The first certificate is the server certificate, the second certificate is the one that is client specific.

The server certificate is signed by a common public intermediate CA whose root CA is already present in most system and software trust stores.

Setup Endpoint in MQTT

Create Keystore

Onboarding an MQTT endpoint provides a certificate, an MQTT client id and two topics; see onboarding.

Alternatively, the connection can be setup using a router device.

The certificate received from onboarding process needs to be formatted to work with PAHO (PAHO only, not needed for most of the other clients):

  • Copy the whole certificate field, replace the "\n" with line breaks (\r+\n) and save it to a *.pem file

  • Call the following command from within the folder you stored the *.pem file:

openssl pkcs12 -export -in myCert.pem -inkey myCert.pem -out myCert.jks

Setup Paho SSL Connection

Open the connection options and enable SSL. Then add the keystore (your onboarding results certificate).

image5

Setup the connection criteria of Paho:

Read the connection criteria from the onboarding result and click on connect.

Example for an onboarding result
Figure 1. Example for an onboarding result
Paho UserInterface
Figure 2. Paho User Interface

Basic functions

Basic Functions in Paho UI
Figure 3. Basic Functions in Paho UI