LINORTEK
iTrixx MQTT Gateway & WFMN Bundle Setting Instructions
NOTE: The configuration demonstrated in this document is intended only to validate communication between a client and the iTrixx-GW MQTT Gateway (Raspberry Pi with Mosquitto broker). This environment is not meant to represent a full production environment since no access control or security are detailed below. Please consult a qualified MQTT consultant for best practices regarding setting up a production MQTT environment, or refer to the MQTT documentation linked here: https://mosquitto.org/documentation/
This guide shows how to configure and implement iTrixx MQTT Gateway and to configure Linortek products to publish data to the broker. To see the published messages, Use Mqtt-spy on Windows, and MQTT Client on Android to confirm functionality.
Setup the Broker
The iTrixx MQTT Gateway is a tiny, dual-display, desktop computer. For initial setup, you will need a monitor, a keyboard, and a mouse. First, ensure the device is plugged into the included power supply and connected to the network. The process for connecting the device to the network is similar to connecting a desktop computer. Connect the device to a monitor using the included HDMI cord and connect a mouse and keyboard to the device. Once connected, the Gateway will function as a fully operational Linux computer. You can connect to the network via an Ethernet cable or WiFi. The Terminal application can be found on the bottom left of the screen.
[Image Description: Screenshot of a Linux desktop environment, likely Raspberry Pi OS. The 'Terminal' application icon is visible on the bottom left. A 'WIFI' indicator is shown on the top right. The overall desktop shows a scenic image of clouds and a body of water.]
Configuring the Broker
The Mosquitto MQTT broker has already been installed on the Gateway. If you need to re-install it for any reason, type the following commands into the Terminal:
sudo apt update
sudo apt upgrade
sudo apt install mosquitto -y
sudo apt install mosquitto-clients -y
At this time, the WFMN publishes under the topic: lt1000/xx:xx:xx:xx:xx:xx/tele
, where xx:xx:xx:xx:xx:xx
represents the device's MAC address. It currently sends a single payload in JSON format to the configured broker at a 1-minute interval with QoS 0. To run Mosquitto, click the Terminal icon. A window will open; enter the command: mosquitto_sub -t lt1000/#
.
[Image Description: Screenshot of a terminal window. The prompt shows 'pi@raspberrypi:~ $'. The command mosquitto_sub -t lt1000/#
is entered and executed, indicating the subscription to the specified MQTT topic.]
Your broker is now subscribed to the lt1000/#
topic.
Setting WFMN to Publish to the Broker
After setting up your broker, you will need to configure the WFMN to connect to it. In this example, the WFMN is on the same local network as the broker. The broker's address will be the IP address of the Gateway where it is running. Using telnet, log in to your WFMN and enter the following commands:
Set the host: mqtthost=brokeraddress
. In this case, the command is: mqtthost=172.16.1.41
.
Set the port: mqttport=xxxx
, which defaults to 1883. Refer to your broker installation instructions and procedures for details regarding the broker's port number. In this case, the command is: mqttport=1883
.
The WFMN will now publish its payload at a 1-minute interval.
Configuring Clients
As many clients may now subscribe to lt1000/#
, this example will use Mqtt-spy on Windows and MQTT Client on Android.
Mqtt-spy
Mqtt-spy is an open-source Java application for monitoring MQTT topics. Mqtt-spy is free to download at https://www.eclipse.org/paho/components/mqtt-spy/. After downloading it, open the application and click on the Configuration dropdown menu and select Restore Defaults. Then select “Configure mqtt-spy using sample settings.” Next, click the Connections dropdown menu and select New Connection. A window will open, allowing you to configure your connection to the MQTT broker.
[Image Description: Screenshot of the Mqtt-spy application's main control panel. It shows connection status messages like 'Configuration file loaded successfully' and 'You have 4 connections configured'. Options to edit connections and connect to sample local or public brokers are visible.]
From this configuration window, you can set a Connection Name, Server URI, and Client ID. The Server URI is the address of the server. Change the Server URI to the Raspberry Pi's IP address. If you set your broker to require a username and password, this can be entered in the Security tab. Once you are finished, click Open Connection.
[Image Description: Screenshot of the Mqtt-spy connection configuration window. Fields include 'Connection name', 'Server URI(s)' (showing an IP address like 192.168.0.247), 'Client ID', and buttons like 'Apply', 'Undo', 'Open connection'. Below this, another screenshot shows the topic filter input field where 'lt1000/#' is entered, with a 'Subscribe' button.]
A new tab will open on the main window with your new connection. Click New under Subscriptions and received messages, and enter the topic you wish to subscribe to. In this case, as there are two Raspberry Pis connected to the broker, to receive data from both, type in lt1000/#
.
Click Subscribe, and it will begin receiving data from your WIFI Mini Hour Meter.
[Image Description: Screenshot of the Mqtt-spy application displaying received MQTT messages. One message is shown with its topic ('It1000/F8:F0:05:E6:13:52/tele') and a detailed JSON payload containing device information, sensor readings (input_voltage, onboard_temp01), digital inputs (din), analog inputs (ain), hour meter readings, and relay states. A summary table of received messages is also visible.]
MQTT Client
MQTT Client is a free client available for Android from Google Play. Upon first opening the app, you will be presented with a blank screen with a "+" sign in the bottom right. Tap to add your broker. On the next screen, tap Enabled, assign a Nick Name, enter your Host's IP or web address and Port number. You may enter a Username and Password if you have set your broker to require credentials, and enter a Client ID. Once complete, tap the Save icon in the upper-right, and your configured broker will be added to the main screen.
[Image Description: Two screenshots of the MQTT Client mobile application's 'Pi Test - Edit' screen. The first shows fields for 'Enabled', 'Nick Name', 'Enable SSL', 'Use Websockets', 'Host' (192.168.0.247), 'Port' (1883), 'Username', 'Password', and 'Keep-Alive Interval'. The second screen shows 'Password', 'Keep-Alive Interval', 'Client ID' (Roberto), 'Clean Session', 'CA crt file path', 'Client Certificate', 'Client Key file', 'Client.p12 file', 'Client Key Password', and 'Last-will topic'.]
Tap your broker, and you will come to a new screen where you can add topics to subscribe to. Tap Subscribe to a Topic on the bottom of the screen and enter the topic. In this case, there are two Raspberry Pis connected to the broker, so to receive data from both, the topic lt1000/#
will be used. Once entered, tap SUBSCRIBE.
[Image Description: Two screenshots of the MQTT Client mobile application. The first shows a list of received messages, with a topic 'It1000/#'. The second screenshot displays a detailed JSON payload for a specific message, similar to the data shown in Mqtt-spy, including device details and sensor readings. It confirms the phone is connected and communicating with the broker.]
It is now verified that the phone is connected to and communicating with the broker.
Version 1.0 Date: July 14, 2021