Oct 08

MQTT.fx 0.0.18 released

You can download latest binaries at mqttfx.org.
Bugs and feature requests can be reported via the issue tracker.

0.0.18 Release Notes

[New] Issue #56: Add a “Generate” button for the ClientID.

I have added a Button to generate a unique ClientID in respect to Lady Ada’s nice MQTT.fx tutorial to prevent the need of 3rd party tools ;-):

[Fixed] Issue #51, #50, #46: SSL/TLS certificate issues

You now can also choose a certain CA certificate file:

[Fixed] Issue #55: Abnormal memory usage: Introducing the option or enable/disable

I added an option to the settings dialog to enable/disable subscriptions to $SYS-Topics.
If disabled $SYS related messages are just use to update the “Broker Status” tab, then the messages are released:

[Fixed] Issue #52: subscription didn’t work in some cases

[Fixed] MenuBar issues in OS X

[Fixed] Notification issues

[Changed] Switched to ControlsFX 8.40.10 in respect to JDK 8u60

Sep 25

MQTT.fx 0.0.17 is here!

You can download latest binaries at mqttfx.org.
Bugs and feature requests can be reported via the issue tracker.

0.0.17 Release Notes

[New] Issue #44: Quick Connect Bar is now available

Now you can switch via the leading icon how the connection should be done:

via a connection profile:


via quick-connect by setting the broker address and broker port:


[Fixed] App starting issues: Linux version couldn’t locate main class since JDK >=u40

Since I change the underlying JRE from 1.8.0u25 to 1.8.0u40 (an newer) people reported issues when running on Linux. MQTT.fx could not be started as the app main class could not be found:

No main class specified
Failed to launch JVM

To create the bundled application packaged I am using javafx-maven-plugin which was initially created by Daniel Zwolenski and is maintained by Danny Althoff (@fibrefox) since quite a while. It turns out that the since JDK 1.8.0.u40 there is a tricky bug in libpackager.so (aka the loading library): using a “.” in the application name (e.g. MQTT.fx) prevents the launcher to start correctly as the “.cfg” filename is not parsed/extracted correctly.

Kudos to Danny for spending debugging effort ! He quickly provided a new javafx-maven-plugin release and its fixed now with a workaround in 8.1.5.

[Fixed] Issue #49: connection settings dialog now fits on 1366×768 screens

Sep 18

How to instantly replace existing Raspberry Pis by the ESP8266

For my outdoor sensors I used an RaspberryPi with BMP180 + TSL2561 via I2C transferring the sensor data via MQTT messages.

During an IoT Meetup Session at codecentric office in Frankfurt we discussed the usage of an esp8266 and I was thrilled to get one and play with it.

Adafruit HUZAAH ESP8266 breakout highlights

  • 80-MHz-Mikrocontroller
  • Wi-Fi Direct (P2P), soft-AP
  • Integrated TCP/IP protocol stack with DNS Support
  • Wake up and transmit packets in < 2ms
  • 4 MB Flash-Chip
  • Onboard-Antenna
  • Status LEDs
  • Reset button
  • User button that can also put the chip into bootloading mode,
  • I/O:
    • 1 x Analog input (1.8V max)
    • 9 x GPIO (3.3V logic), which can also be used for I2C or SPI
    • 2 x UART pins
    • 2 x 3-12V power inputs, reset, enable, LDO-disable, 3.3V output

It turns out very quickly that the esp8266 is a really great piece of hardware and I planned to replace my Raspberry Pis acting as sensor hosts in my network. With its wifi capabilities the esp8266 lets me still run the I2C sensors with my MQTT approach.

E. g. the current Raspberry Pi installed outdoors sends values to these topics

  • sweethome/sensors/outdoor/temperature
  • sweethome/sensors/outdoor/pressure
  • sweethome/sensors/outdoor/lux

and if get the esp8266 to publish to these topics too the rest of my network won’t event recognize there was a change…

The Plan: Keep the I2C sensors but replace the “brain”.

replace_this by_that
Raspberry Pi HUZAAH ESP8266 breakout
40€ 10€
SD-Card: 4€
WLAN-Stick 8€
Total: 52€ 10€
Power Consumption: 3W 1W



Arduino IDE


The Libraries almost all there, can be easily installed via the Arduino IDE Library Manager.
Except for the esp8266 support the an additional Board Manager URL has to be set:


  • ESP8266WiFi
  • Adafruit BMP085 Unified
  • Adafruit TSL2561 Unified
  • Adafruit MQTT Library



The esp8266 breakout has a build-in support for LUA, but I decided to flash it to be ready for usage with Arduino IDE and C++ (mostly because the drivers are all well supported by Adafruit).

#include <ESP8266WiFi.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>
#include <Adafruit_TSL2561_U.h>

/************************* WiFi Access Point *********************************/

#define WLAN_SSID       "Lummerland"
#define WLAN_PASS       "****************"

/************************* MQTT Broker Setup *********************************/

const int MQTT_PORT = 1883;
const char MQTT_SERVER[] PROGMEM    = "";
const char MQTT_USERNAME[] PROGMEM  = "********";
const char MQTT_PASSWORD[] PROGMEM  = "********";

// Create an ESP8266 WiFiClient class to connect to the MQTT server.
WiFiClient client;


/****************************** Feeds ***************************************/
const char TEMPERATURE_FEED[] PROGMEM = "sweethome/sensors/outdoor/temperature";
Adafruit_MQTT_Publish temperature_topic = Adafruit_MQTT_Publish(&mqtt, TEMPERATURE_FEED);

const char PRESSURE_FEED[] PROGMEM = "sweethome/sensors/outdoor/pressure";
Adafruit_MQTT_Publish pressure_topic = Adafruit_MQTT_Publish(&mqtt, PRESSURE_FEED);

const char LUMINOSITY_FEED[] PROGMEM = "sweethome/sensors/outdoor/lux";
Adafruit_MQTT_Publish luminosity_topic = Adafruit_MQTT_Publish(&mqtt, LUMINOSITY_FEED);

Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);
Adafruit_TSL2561_Unified tsl = Adafruit_TSL2561_Unified(TSL2561_ADDR_FLOAT, 12345);

/*************************** Sketch Code ************************************/

void setup() {

  Serial.println("Sensor Test");
  if (!bmp.begin())
    Serial.print("Ooops, no BMP180 detected ... Check your wiring or I2C ADDR!");
    while (1);
  else {
    Serial.println("BMP180 ready.");
  if (!tsl.begin())
    Serial.print("Ooops, no TSL2561 detected ... Check your wiring or I2C ADDR!");
    while (1);
  else {
    Serial.println("TSL2561 ready.");


  // Connect to WiFi access point.
  Serial.print("Connecting to ");

  while (WiFi.status() != WL_CONNECTED) {

  Serial.println("WiFi connected");
  Serial.println("IP address: "); Serial.println(WiFi.localIP());

void loop() {

  /* Get a new sensor event */
  sensors_event_t bmpEvent;

  if (bmpEvent.pressure)
    float temperature;
    Serial.print("Temperature: ");
    Serial.println(" C");
    Serial.print("Publish Temperature: ");
    if (! temperature_topic.publish(temperature)) {
    } else {

    float pressure = bmpEvent.pressure;
    Serial.print("Pressure:    ");
    Serial.println(" hPa");
    Serial.print("Publish Pressure: ");
    if (! pressure_topic.publish(pressure)) {
    } else {
    Serial.println("Sensor error");

  sensors_event_t tslEvent;
  unsigned int luminosity = 0;
  if (tslEvent.light)
    luminosity = tslEvent.light;

  Serial.print("Luminosity:   ");
  Serial.println(" lux");
  Serial.print("Publish Luminosity: ");
  if (! luminosity_topic.publish(luminosity)) {
  } else {


void configureTSL2561()
  /* You can also manually set the gain or enable auto-gain support */
  // tsl.setGain(TSL2561_GAIN_1X);      /* No gain ... use in bright light to avoid sensor saturation */
  // tsl.setGain(TSL2561_GAIN_16X);     /* 16x gain ... use in low light to boost sensitivity */
  tsl.enableAutoRange(true);            /* Auto-gain ... switches automatically between 1x and 16x */

  /* Changing the integration time gives you better sensor resolution (402ms = 16-bit data) */
  tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_13MS);      /* fast but low resolution */
  // tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_101MS);  /* medium resolution and speed   */
  // tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_402MS);  /* 16-bit data but slowest conversions */

void MQTT_connect() {
  int8_t ret;

  // Stop if already connected.
  if (mqtt.connected()) {

  Serial.print("Connecting to MQTT... ");

  while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected
    switch (ret) {
      case 1: Serial.println("Wrong protocol"); break;
      case 2: Serial.println("ID rejected"); break;
      case 3: Serial.println("Server unavailable"); break;
      case 4: Serial.println("Bad user/password"); break;
      case 5: Serial.println("Not authenticated"); break;
      case 6: Serial.println("Failed to subscribe"); break;
      default: Serial.print("Couldn't connect to server, code: ");
    Serial.println("Retrying MQTT connection in 5 seconds...");
    delay(5000);  // wait 5 seconds
  Serial.println("MQTT Connected!");

To get the program running on the esp board you have to

Get the esp8266 into flash mode

press + hold “Reset” button
press + hold “GPIO0” button
release “Reset” button
release “GPIO0” button
-> the red LED turns on (with lower brightness)


Ready for uploading

Open the Serial Monitor to see what’s going on:


Note the “Board”, “CPU Frequency”, “Upload Speed” and the “Port” settings! 

Before uploading you can build the program by click on “Verify”:

click_upload output_verify

Then start uploading:

click_upload output_uploadThe program starts immediately and the Serial Monitor shows whats going on:


To debug/monitor the MQTT messages I am using MQTT.fx (of course ;-)):


No changes had to made to other components of my networks. The replacement was transparent to the (Mobile) Clients also:


Jun 30

MQTT.fx 0.0.16 released

You can download latest binaries at mqttfx.org.
Bugs and feature requests can be reported via the issue tracker.

Release Notes

  • [Changed/New] Issue #14 Now TLS/SSL without client certificate authentication is supported
  • ssl

  • [New] Issue #35 Subscribe to $SYS topics is now supported
  • sys_subscription

  • [New] Improved Error Prevention: Profile Editor now supports validation
  • In facts it’s a mix of ControlsFX Validation and Bean Validation

  • [Fixed] Issue #38 Application crash on startup if one script is wrong
  • Now scripts are not checked during startup time but execution errors are logged and printed to console:

  • [Fixed] Issue #37 java.io.FileNotFoundException if CA Certificate only is set
  • was fixed/implemented together with Issue #14

May 22

MQTT.fx 0.0.15 released

You can download latest binaries at mqttfx.org.
Bugs and feature requests can be reported via the issue tracker.


  • [Fixed] Issue #31 Unsubscribe + Disconnect from a Broker didn’t clean messages from the client.
  • [Changed/New] Bound new Output-Handler to Script execution
    • System.out is not bound to the script console anymore!
    • You should now use “output” instead of System.out in Scripts.
    • e.g.: output.print(“Hello from Script”);
  • script

  • [Changed] JRE 8 update 45 support
  • [Changed] Logging:
    • better readable logging format
    • now using sl4j (with log4j)
  • log

Feb 23

MQTT.fx – bug fix release

You can download latest binaries at mqttfx.org.
Bugs and feature requests can be reported via the issue tracker.

Version contains some bug fixes (since 0.0.14 release):

  • [Fixed] Issue #27 Disconnection when publishing to a second broker
  • [Fixed] bug when to show only latest messages
  • [Fixed] bug when receiving broker status messages ($SYS-topics)
Feb 07

MQTT.fx 0.0.14 released

As always you can download latest binaries at mqttfx.org.
Bugs and feature requests can be reported via the issue tracker.
Also the Update Feature of 0.0.13 should inform you, that there are updates available (See NNOTE 1 at bottom of this page)!

Reviewed Clipboard Messages

  • Order can now be changed by Drag-and-Drop
  • Can be published instantly by click on Button
  • Changes are now stored immediately


All new approach with topics and messages

  • Rendering revisited
  • Colors of topics can now be customized (messages are colored accordingly)
  • Colors of topics are persisted in configuration
  • Topics can now be unsubscribed by click on “-” (messaged will be removed accordingly)
  • Number of received messages per topic is shown
  • Messages also do show the wildcard topics to which they have matched
  • Only longer payloads are expandable now, one-liner are shown as subject
  • “Copy Payload” is now accessible without expanding the payload
  • Improved performance



Support for HTTPS proxy connection options
In respect to Dino Tsoumakis 😉
https proxy

Anything else?

  • Fixed an issue with unrecognized (but allowed) characters in topics

I was asked how to add new Scripts
I mentioned this before in a post (but this was 6 month ago ;-)).

New scripts can be easily made available for execution via the UI.
The app is scanning a folder named “scripts” located at the MQTT.fx working directory:

[USER_HOME]/Library/Application Support/MQTT-FX/scripts



If this folder does not exists it is created by MQTT.fx containing scripts.
Naming convention:

[INDEX] controls the order of the entry in the drop down menu
__ delimiter between index and name
[NAME the name of the menu entry (words are delimit by ‘_’)

E.g.: With these files in the “scripts” folder

the menu looks like this:
scripts menu

NOTE 1: In 0.0.13 the Update Feature has a bug!
The new install packages are loaded but yet not always renamed on Windows and Linux (this is fixed in 0.0.14). You will find the packages ending with postfix “.download”. You have to rename it manually.

NOTE 2: The format of the configuration has changed!
You may have to delete you current configuration and restart MQTT.fx. MQTT.fx will create a new default configuration for you!

Feb 06

SweetHomeHub: Home Control with Raspberry Pi and MQTT – Part 1

Since quite a long time I am working on my universal Raspberry Pi based Intertechno-Remote (see former posts 1 2 3 4):

intertechno remote

I tried different approaches to trigger/control my remote control service via a custom HTTPServer/-Handler and a simple Vert.x verticle.
Since MQTT v3.1.1 turns out as on of the de-facto standard protocols for the IoT I also implemented an MQTT client.

This MQTT client basically follows two design patterns:

1. One topic for each device
For each device a topic is defined. Its state can be controlled by publishing a message with payload “ON” or “OFF”.

  • the user must not know about the address code of the Intertechno device
  • changes of the address must not be published
  • the message is simply “ON” or “OFF to control the device


  • the user must know the topic for each device
  • the user can only control configured devices

2. One topic for a JSON message

  • very flexible to control the devices


  • the user must know about the syntax of the JSON and the coding of devices

Provide both options 😉

One topic for each device


My configuration is very simple
On start-up the Client is searching for sweethomehub-config.xml in the users home directory which is then unmarshalled from JAXB.
This configuration contains the codes and the topic for each device and the MQTT settings for the broker connection:

            <name>Light Front-Door</name>
            <name>Light Terrace</name>
            <name>Light Garden</name>
            <name>Light Living Room</name>

And there is one additional topic awaiting the JSON commands:

        "name": "Light Front-Door",
        "houseCode": "a",
        "groupId": "1",
        "deviceId": "1"
        "name": "Light Terrace",
        "houseCode": "a",
        "groupId": "1",
        "deviceId": "2"
        "name": "Light Living Room",
        "houseCode": "a",
        "groupId": "1",
        "deviceId": "3"

The central method to handle arrived messages:


The JsonDeviceCommandProcessor:


And the doSwitch methods:


MQTT Client running on the Raspberry Pi waiting for messages:

… and receiving command messages:


Testing the receiver with MQTT.fx


Complete code can be found at BitBucket.

Jan 16

MQTT.fx 0.0.13 released

Download latest binaries at mqttfx.org.
Bugs and feature requests can be reported via the issue tracker.

New in this version:

Extended Scripting Features

  • fixed issues with starting external editor to edit scripts
  • support for subscribe/unsubscribe to Mqtt-Scripting interface

Redesinged and extended Settings Dialog

  • option to choose whether the default system editor should be use or a custom edit command
  • option to choose whether to check for updates on app start




Build in Update Feature

  • Added support Refuel API for application updates




KUDOs to my friend Dino Tsoumakis for his great work on his application update tool for Java 8 “Refuel” (view on github)!