Skip to main content

MQTT Client

Requirements

  • Android application with version 4.0.394 or higher.
  • Windows application with version 4.0.87 or higher.
  • JSCore application with version 4.1.760 or higher.
NOTE

JsCore devices are only able to open connections to the broker through WebSocket. Ensure to configure your broker accordingly.

Setup

In order to utilize the MQTT client, it is necessary to apply a configuration to your device.
You have to configure the settings through the right-click menu on the device:

Device Properties >> Set >> Set sensor configuration

Minimum required configuration

{
"services":[
{
"uid":"mqtt_1",
"type":"MQTT",
"settings":{
"port":1884,
"rules":[
{
"pattern":"id\"\\s*:\\s*\"?([^\"{}]*)\"?\\s*,\\s*\"event\"\\s*:\\s*\"?([^\"{}]*)\"?\\s*,\\s*\"value\"\\s*:\\s*\"?([^\"{}]*)\"?",
"idGroupIndex":1,
"eventGroupIndex":2,
"valueGroupIndex":3
}
],
"topic":"wallboard/#",
"address":"mqtt://192.168.1.175",
}
}
]
}

Mqtt over WebSocket

If you want to use the Mqtt over WebSocket use this configuration

{
"services":[
{
"uid":"mqtt_1",
"type":"MQTT",
"settings":{
"port":8884,
"path":"mqtt",
"rules":[
{
"pattern":"id\"\\s*:\\s*\"?([^\"{}]*)\"?\\s*,\\s*\"event\"\\s*:\\s*\"?([^\"{}]*)\"?\\s*,\\s*\"value\"\\s*:\\s*\"?([^\"{}]*)\"?",
"idGroupIndex":1,
"eventGroupIndex":2,
"valueGroupIndex":3
}
],
"topic":"wallboard/#",
"address":"ws://192.168.1.175",
}
}
]
}
info

Do not add the / character at the start of the path parameter

Authentication

info

If you have configured your broker to authenticate client you can include your credentials in the configuration

{
"services":[
{
"uid":"mqtt_1",
"type":"MQTT",
"settings":{
"port":1884,
"rules":[
{
"pattern":"id\"\\s*:\\s*\"?([^\"{}]*)\"?\\s*,\\s*\"event\"\\s*:\\s*\"?([^\"{}]*)\"?\\s*,\\s*\"value\"\\s*:\\s*\"?([^\"{}]*)\"?",
"idGroupIndex":1,
"eventGroupIndex":2,
"valueGroupIndex":3
}
],
"topic":"wallboard/#",
"address":"mqtt://192.168.1.175",
"password":"exmaplePassword",
"username":"exampleUsername",
}
}
]
}

Status Reporting

You can configure the device to periodically (every two minutes) send messages to a topic of your choosing. That includes information about the status of the device (detailed below).

{
"services":[
{
"uid":"mqtt_1",
"type":"MQTT",
"settings":{
"port":1884,
"rules":[
{
"pattern":"id\"\\s*:\\s*\"?([^\"{}]*)\"?\\s*,\\s*\"event\"\\s*:\\s*\"?([^\"{}]*)\"?\\s*,\\s*\"value\"\\s*:\\s*\"?([^\"{}]*)\"?",
"idGroupIndex":1,
"eventGroupIndex":2,
"valueGroupIndex":3
}
],
"topic":"wallboard/#",
"address":"mqtt://192.168.1.175",
"password":"exmaplePassword",
"username":"exampleUsername",
"sendDeviceStatus":true,
"deviceStatusTopic":"wallboard"
}
}
]
}

Status Message format

{
deviceId: string; //Device's ID in Wallboards system
serverStatus: boolean; //Weather the devuce is able to connect to the server
battery: number; //Battery percentage of the device (if it has one, otherwise 0)
wifiDbm: number; //Wifi strength in Dbm (if connected, otherwise 0)
wifiLevel: number; //Wifi strength in Level (1-5) (if connected,otherwise 0)
startCount: number; //Number of applications starts in the last metrics cycle
crashCount: number; //Number of applications crashes in the last metrics cycle
}