IoT MQTT Panel Pro Device Prefix

As mentioned in my ‘Getting Started’ post, I create separate ‘devices’ for my different Arduino sketches, such as mqtt-LED, mqtt-fire2012xy, mqtt-mesh, and so on. In addition, I may have more than 1 of each type of lantern displaying at the same time. To do so, I will serialize each lantern (it’s in the code) and using a combo box widget, I can then select one or ALL of each device type and publish that to the broker, which will then get picked up by the subscribing device. I’ll then use another widget to send hue, brightness to other information to the selected devices.

In order to support these multiple device types (aka sketches), I’ll add a device prefix to the topic.

For a fire2012 lantern, the published topic can look like this:

  • fire/lantern
  • fire/hue

The fire/lantern widget is a combo box that allows you to select which fire lantern to control. The fire/hue widget is a slider that publishes the updated hue to your previously selected lantern (or ALL fire lanterns if supported by your Arduino code). For my mqtt-mesh lanterns, the topics would be:

  • mesh/lantern
  • mesh/hue
  • and so on. . .

To configure a Device prefix such as ‘fire’ or ‘mesh’, you can either enter it for each topic that you wish to public, or you can configure it as an option for your device type. In the case of the latter, from the main screen, press the broker that you wish to, in this case ‘S9’:

From there, you’ll be in the the currently selected Control Panel.

Press the 3 lines at the top left in the blue bar of the screen. The grayed out device is the currently selected one, so you can now press ‘DEVICE CONFIGURATIONS’:

 and you’ll see the ‘Edit Device’ screen:

Here, you can enter your Device prefix topic, and then save the configuration.

Now, when you edit any of the widgets for that device, it’ll show up with a Device prefix:

Note: Don’t forget to save any configuration settings.

Comments are closed.