Debugging your flow

The flow editor provides some handy features to help you debug your flow.  We'll use the simple email example created in the flow library topic earlier which has been subscribed to the topic "test".

Send a test message

For cases where you don't have a device available to publish messages to your flow, you can use the "Send Test Message" option from the Message menu.


Still need help?

If you need more help or have any questions, please send an email to services-support@u-blox.com.

Pick a Thing that the message should appear to come from.  Doing this sets up a number of extra pieces of metadata related to the Thing which you can refer to from the flow

The send message screen is automatically populated with the device ID of the Thing that you selected in the previous step and the topic that your flow is subscribed to.  You can then set the message body to be sent and, if you like, the MQTT quality of service to be used.  The example here is a simple "Hello World" string, but this could just as easily be a JSON object e.g. {"Hello":"World"}.  Note that if you want to send JSON, make sure you use the JSON parser node in your flow so that you can work with the object.

When you press "Send", the message will be sent and the flow will be executed.  You will see the value of msg.payload displayed in the debug tab.  Hovering over the output in the debug tag will highlight the node that produced that output, in this case it is the debug node.

If you want to change the value output by the debug node, simply double click on the node and edit it.  You can pick any specific msg variable, or show the entire msg object.

You'll find some useful metadata in the msg object that you can refer to in a JavaScript function node.  Have a go at changing the debug output, and now you can use the "Replay Last Message" option from the Message menu to re-send the last message processed by the flow.

In addition to the debug nodes, you can also log output from a JavaScript function node using the node.log function.  In the example below the value of msg.to is output

When you execute the flow again, you'll see the new value added to the debug tab.  Hovering over the output will highlight the node that produced it