LINORTEK iTrixx MQTT Gateway & iTrixx-WFMN Setting Instructions

June 4, 2024
LINORTEK

LINORTEK iTrixx MQTT Gateway & iTrixx-WFMN Setting

LINORTEK-iTrixx-MQTT-Gateway -amp;-iTrixx-WFMN-Setting-
PRODUCT

iTrixx MQTT Gateway & iTrixx-WFMN 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, you will need a monitor, a keyboard and a mouse for initial setup. First, make sure 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 doing so on a desktop computer. Connect the device to a monitor using the included HDMI cord and connect a mouse and keyboard to the device. Once done, the Gateway will work like a fully functioning Linux computer. You can connect to the network via an Ethernet cable, or WiFi. Also, the Terminal can be found on the bottom left of the screen.

LINORTEK-iTrixx-MQTT-Gateway -amp;-iTrixx-WFMN-Setting-
FIG1

If you don’t have an HDMI screen to connect to the Raspberry pi, please download VNC viewer to your Windows. With the initial setup we already enabled it on your Raspi. You need to find the IP address for the Raspberry pi on your network and connect to this IP address using VNC viewer. Default Username: pi, Password: raspberry.

LINORTEK-iTrixx-MQTT-Gateway -amp;-iTrixx-WFMN-Setting-
FIG2

Once connected to the internet, you can proceed to the next steps.

Configuring the Broker
We have already installed & configured the Mosquitto MQTT broker on the Gateway. You can skip this step unless you want to re-install. For some reasons if you need to re-install, type in the following commands into the Terminal:

  • sudo apt update.
  • sudo apt upgrade
  • sudo apt install mosquitto -y
  • sudo apt install mosquitto-clients -y

By default your MQTT broker will listen on Local host only. To make it listen to devices on ipv4 IP address you need to perform these steps:

  • sudo nano /etc/mosquito/conf.d/config.conf on this file add: allow_anonymous true listener 1883 (ex.: listener 1883 172.168.1.210) to save: Ctrl X, Y, Enter.
  • Then restart MQTT: sudo service mosquito restart

At this time, the WFMN only publishes under the topic: lt1000/xx:xx:xx:xx:xx:xx/tele – where xx:xx:xx:xx:xx:xx is the device’s MAC address. It currently sends a single payload in JSON format to the configured broker on a 1-minute interval at QoS 0. To run Mosquitto, click the Terminal icon, a window will be opened, enter the command: mosquitto_sub -t lt1000/#.

LINORTEK-iTrixx-MQTT-Gateway -amp;-iTrixx-WFMN-Setting-
FIG3

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 the broker. 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 it is running on. Using telnet, log in to your WFMN and enter the command: mqtthost=brokeraddress. In this case thecommand is: mqtthost=172.16.1.41. Then set the port by entering the command: mqttport=xxxx which is defaults to 1883. Refer to your broker installation instructions and procedure 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. Here are the complete commands:

  • mqtthost=172.16.1.41

  • mqttport=1883

  • save

Note: You might need to port forward your Raspberry pi in case if you want to connect to your MQTT broker devices through the Internet. Use 1883 port number, TCP protocol. Don’t forget to create a reservation for Raspberry pi IP address or set Static IP address for it by changing ‘dhcpcd.conf’ file. As soon as it is port forwarded you can use your network public IP address to set WFMN.
Configuring Clients
As there are many clients that may now subscribe to lt1000/#, this example will use Mqtt-spy on Windows and MQTT Client on Android, Linortek DataCollector desktop app for remote monitoring.

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. Then, click the Connections dropdown menu and select New Connection. A window will open allowing you to configure your connection to the MQTT broker.LINORTEK-iTrixx-MQTT-Gateway
-amp;-iTrixx-WFMN-Setting-FIG4

From here, you can set a Connection Name, Server URI, and Client ID. 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. 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 there are two Raspberry PIs connected to the broker so to receive data from both, type in lt1000/#.LINORTEK-iTrixx-
MQTT-Gateway -amp;-iTrixx-WFMN-Setting-FIG5

Click Subscribe and it will begin receiving data from your iTrixx-WFMN Hour Meter.LINORTEK-iTrixx-MQTT-Gateway -amp;-iTrixx-WFMN-Setting-
FIG6

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 .LINORTEK-iTrixx-MQTT-Gateway -amp;-iTrixx-WFMN-Setting-
FIG7

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. The topic will display on the screen with a preview of the payload contents. Tap the topic to view. It is now verified that the phone is connected to and communicating with the broker. Please see the screenshot on next page for details.

LINORTEK-iTrixx-MQTT-Gateway -amp;-iTrixx-WFMN-Setting-
FIG8

Use DataCollector Desktop App to Monitor Data Remotely with MQTT Gateway
If you have multiple iTrixx hour meter devices installed on different locations but want to monitor all device data from remote locations. You can use our free DataCollector desktop app as an MQTT client as long as all your Matrixx devices are connected to the same gateway (broker). In order for the iTrixx from different locations to publish the data to the gateway, you first need to port the gateway to the Internet. For how to port a network-enabled device to the Internet, please consult the Internet. Once the gateway is ported, you can connect your Matrixx devices to the gateway using the new IP address. Install the Data collector app on the computer to monitor the data, connect the Data collector app to the same gateway, can monitor all device data connected to that gateway. For instructions on how to install the DataCollector app on your computer, please visit our website www.linortek.com, and go to the Downloads- Documentation page to download the Linortek Data Collector App Setting Instruction. Here is the concept of how to monitor the hour readings from a remote computer:

LINORTEK-iTrixx-MQTT-Gateway -amp;-iTrixx-WFMN-Setting-
FIG9

In our example, when we port the gateway to the Internet, we have a new IP address for the gateway (98.25.185.186), the port number stays the same (1883). Connect iTrixx to the gateway new IP address: On Telnet, type in the following commands:

  • mqtthost=98.25.185.186

  • mqttport=1883

  • save

The WFMN is now publishing its payload at a 1-minute interval. See the screenshot below:

LINORTEK-iTrixx-MQTT-Gateway -amp;-iTrixx-WFMN-Setting-
FIG10

Open Datacollector App, add the gateway information to the app:

LINORTEK-iTrixx-MQTT-Gateway -amp;-iTrixx-WFMN-Setting-
FIG11

Once you click save, click the Data Display tab on the app, and you will see all device’s data connected to the gateway.

LINORTEK-iTrixx-MQTT-Gateway -amp;-iTrixx-WFMN-Setting-
FIG12

Linor Technology, Inc. www.linortek.com
Information is subject to change without notice.

References

Read User Manual Online (PDF format)

Loading......

Download This Manual (PDF format)

Download this manual  >>

LINORTEK User Manuals

Related Manuals