Skip to content

Instantly share code, notes, and snippets.

@TotallyInformation
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TotallyInformation/b0fcb7b72fc05a30e55b to your computer and use it in GitHub Desktop.
Save TotallyInformation/b0fcb7b72fc05a30e55b to your computer and use it in GitHub Desktop.
Better debugging

The current debugging capability of Node-Red leaves a lot to be desired. While there are plans to improve it, these will take some time to complete.

In the meantime, I've created an alternative that is fairly easy for anyone to implement and seems to work well. I'm now using it in my projects.

The approach is to create a subflow that outputs a msg to MQTT instead of debug. Then to create a flow that creates a debug web page that receives the MQTT debug messages. The page creates a section for each message TOPIC so it is important to set that correctly before sending the msg to the subflow. Then each topic shows a formatted display of the full msg object. The topic display is updated each time a message with the same topic is sent out. A timestamp is included to show when each topic was last updated.

As there is both a flow and a subflow & some example images, I've put the example on github.

https://github.com/TotallyInformation/node-red-example-debug

Although labelled an example, it is fully working and can be simply added to your own instance and should work straight away. Please leave any issues and comments in the github issues list.

Note the dependencies. The main dependency is an implementation of a MQTT broker with websockets support. You should be able to use Mosca but I've tested this with Mosquitto 1.4 compiled with websockets support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment