This is a tutorial on how to connect to Tago MQTT and publish to a topic. For this tutorial, we will use the software Mqttfx. To download and learn more about Mqttfx go to their website www.mqttfx.org.

If you prefer, watch this tutorial here.

Connecting to Tago

To connect to the Tago MQTT and publish to any topic, first, we need to add a device. Go to 'Device' and add a device. Then, go to the section tokens and copy your device-token.

https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/-ErmtRxNxjzVPhwhJXBVXZ17EoKU2WPpBTSZj5h4v6U/device_token-LxY.png

Open Mqttfx, and click on the gear icon

https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/TP0PKhyIZmLuzbo6Z4cNxoLA5QeOCUJmylThupp5xIs/mqttfx_1-Ifw.png

On the Connection Profile window, set the following information:

  • Profile Name: “Any name”
  • Broker Address: mqtt.tago.io
  • Broker Port: 8883 (TLS) or 1883 (NO TLS)
  • Client ID: “Any value”

On the section User credentials, use:

  • User Name: “Any value” TagoIO validates users only by the Token 
  • Password: “Paste Your Device Token”
https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/LR2-TKTBPhpUwgE1r1FaJGmHa8Ln51o_JRMLko-DX-E/mqttfx_2-tYw.png

On the SSL/TLS section, check the option Enable SSL/TLS, and click OK

https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/fL0wEyZ62-b7Fvy65SjGhx4aRhZgiMbk9hQnffmQ7fk/mqttfx_3-Up8.png

Now, you can connect to Tago using the configuration you just set up. Select the connection profile that you just created, and click Connect

https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/pknGQrfEFr2EOyUndcnBWe1EfKzHmuCTGm5BBlD5YY0/mqttfx_4-vbQ.png

When you are connected, the connection indicator will become green

https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/r3OgcM4zhlws8gc06ckm3Y_UkVJ6Pql-NIkJpHLHHYE/mqttfx_5-yW0.png

Publishing as a Device

To send data to Tago as a device, we need to use the correct topic. If you go to the MQTT documentation then on the section “Publishing to TagoIO” you can see the default topics.

For this tutorial we will use the topic tago/data/post. On the Mqttfx go to the publish section and type the topic url.

https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/XR2uEvKMBk25CONO4YEuQYcO6Mv_ehOF0nwVPRw-bT8/mqttfx_6-rRY.png

Now, you need to send the data to Tago, remember that you need to follow the correct data format to be able to post to TagoIO. Click here to check the data format documentation.

For this tutorial, let’s send the data showed on the documentation link above

{
    "variable": "temperature",
    "unit"    : "F",
    "value"   : 55,
    "time"    : "2015-11-03 13:44:33",
    "location": {"lat": 42.2974279, "lng": -85.628292}
}

Copy the code above and paste it on Mqttfx. Then, click Publish.

https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/t7Svswxhtmjm6hY-FXYl7Uxnjzadz9M0eHf1D6MxU9Y/mqttfx_7-5mg.png

Go back to your account at TagoIO, enter into the Buckets section, then under Variables you will see the variable that you have just sent to tago using MQTT.


https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/YFMkFTGjRBVdQo3fQs1mngmv5D5P3hnxtCXRUpFoX4w/mqttfx_8-UwM.png