• Medium One

Step by Step Guide on MQTT.fx and Medium One

Updated: Mar 1

In this tutorial, we will explain how to send MQTT messages to Medium One’s IoT Platform using MQTT.fx. This is a useful tutorial to get started on understanding how Medium One's MQTT broker works before implementing in your device.


  1. Medium One Production account (this will not work with a sandbox account)

  2. Download http://mqttfx.org/

Estimated time: 10-20 mins

Prerequisite: Please go through our 10 Min Quick Start Guide before attempting this

How to get MQTT username:

The username is <project_id>/<mqtt_user_id>

In this example, the mqtt_username is: AfzvMXSqmrM/4KEHYifLft0 .

How to get the MQTT password:

mqtt_password = <api_key>/<user_password>

Here’s the api key.

You should know the user password. If not, you can reset it here.

How to setup MQTT.fx

Click the settings gear box to configure (below).

Important: Be sure to click on the “Generate” button beside the “Client ID” field.  MQTT requires a unique ID to be used.

Enter the MQTT Username and password from above here:

Click OK when done, then click connect. You should see a green box on the right (below)

Next, we'll publish an event by going to the "Publish" tab. To publish to your user, specify the Topic in the dropdown using the format 0/<project MQTT ID>/<user MQTT ID>/<device>. The device can be anything. Make sure to put {“event_data”:{“hello”:”world”}} as the text to send as the Payload and then click "Publish"

How to See Events in Medium One Dashboard

On the Medium One dashboard, select the real-time log widget and the user to see the event come in.

If you want to enable the events for Workflows, go to Config > Data Streams > raw. You will need to do this for the "Build a workflow to respond to to Mqtt.fx" step.

For any tag you want to enable, click the checkbox in the row for the corresponding tag name and click "Save Data Stream".

How to subscribe to an event on Mqtt.fx

Go back to Mqtt.fx and click the "Subscribe" tab. To subscribe to data from your account, the format is 1/<project_mqtt_id>/<user_mqtt_id>/<device>/event. Note that the last parameter is the word “event” and does not change.  Remember what you put in for <device>, you will need it in the next step. We put “test_device” for this example. Click on “Subscribe.”

Build a workflow to respond to to Mqtt.fx

Log into your Medium One account. Click on “Workflow Studio" and then “Create a New Workflow.” Name it “MQTT Response”. Under Tags and Triggers in the righthand sidebar, click on raw->hello. Drag and drop this tag onto the screen.

Under “Modules,” find Foundation->Base Python. Drag this onto the screen as well. Connect out1 from the green box into in1 in the blue box. Your workflow should look like this.

Double click on the blue box and replace the code in there with the following python code:

import MQTT MQTT.publish_event_to_client('test_device', '{"hi": "back"}', encoding='utf-8')

Make sure to replace ‘test_device’ with whatever device name you subscribed to in the previous step.

Click “Save and Activate.”

See the communication flow in Mqtt.fx

Go to the Publish tab Mqtt.fx and click “Publish.” Wait a few moments. Click on the subscribe tab. You should see that a new event came in. Click on it.

In the black box, you should see the text specified in the workflow.

Congratulations! You have written a workflow that can publish events back to an MQTT client.


© 2018 Medium One   All Rights Reserved

4633 Old Ironsides Dr. #280, Santa Clara, CA  95054                



  • LinkedIn - White Circle
  • Twitter - White Circle
  • YouTube - White Circle
  • Google+ - White Circle