visualize MQTT topic tree with shiftr.io

shiftr.io is a web based visualization for messages going through a MQTT broker. It is possible to use broker.shiftr.io directly as your public broker. Due to privacy considerations, I run my own broker. But since I enjoy the visualization very much, I use a very simple node-red flow to copy the data over from my own broker via node-red to the shiftr.io broker. I do this instead of bridging the brokers directly, since node-red offers me two additional functions:

  • I have a simple way of enabling/disabling the data bridge
  • I strip the measurement from the payload for privacy
[{"id":"57388f26.9cdc68","type":"mqtt out","z":"dfbad1a1.a09ee8","name":"data->shiftr.io","topic":"","qos":"","retain":"","broker":"fb69a6a5.d14a","x":940,"y":440,"wires":[]},{"id":"39a5b1c5.6f8ca6","type":"mqtt out","z":"dfbad1a1.a09ee8","name":"input->shiftr.io","topic":"","qos":"","retain":"","broker":"aa4043c2.6a1ef8","x":940,"y":200,"wires":[]},{"id":"54c50878.2978c8","type":"mqtt out","z":"dfbad1a1.a09ee8","name":"command->shiftr.io","topic":"","qos":"","retain":"","broker":"1e1e7393.973264","x":950,"y":280,"wires":[]},{"id":"5f6db9c9.39922","type":"mqtt in","z":"dfbad1a1.a09ee8","name":"","topic":"command/#","qos":"2","broker":"b04e7681.6fc4a","x":150,"y":280,"wires":[["fd0e5194.f7ce2"]]},{"id":"a90cd84b.8204f","type":"mqtt in","z":"dfbad1a1.a09ee8","name":"","topic":"input/#","qos":"2","broker":"b04e7681.6fc4a","x":130,"y":200,"wires":[["409cb4c1.a6e934"]]},{"id":"87577ca3.9c3f3","type":"inject","z":"dfbad1a1.a09ee8","name":"enable","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"x":150,"y":60,"wires":[["68067212.b844fc"]]},{"id":"4cdb6460.eeea04","type":"switch","z":"dfbad1a1.a09ee8","name":"gate","property":"gate","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","outputs":1,"x":770,"y":440,"wires":[["57388f26.9cdc68"]]},{"id":"a1a803de.05ca4","type":"inject","z":"dfbad1a1.a09ee8","name":"disable","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"x":150,"y":100,"wires":[["68067212.b844fc"]]},{"id":"68067212.b844fc","type":"change","z":"dfbad1a1.a09ee8","name":"set gate","rules":[{"t":"set","p":"gate","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":80,"wires":[["4cd22f89.03fa9"]]},{"id":"874d6719.abd66","type":"switch","z":"dfbad1a1.a09ee8","name":"gate","property":"gate","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","outputs":1,"x":770,"y":280,"wires":[["54c50878.2978c8"]]},{"id":"2ab57466.9d85ec","type":"switch","z":"dfbad1a1.a09ee8","name":"gate","property":"gate","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","outputs":1,"x":770,"y":200,"wires":[["39a5b1c5.6f8ca6"]]},{"id":"4cd22f89.03fa9","type":"debug","z":"dfbad1a1.a09ee8","name":"","active":true,"console":"false","complete":"true","x":500,"y":80,"wires":[]},{"id":"f460811.90c94","type":"mqtt out","z":"dfbad1a1.a09ee8","name":"sensors-> shiftr.io","topic":"","qos":"","retain":"","broker":"d4e53eb.b0f5cc","x":950,"y":360,"wires":[]},{"id":"412281de.f50f78","type":"switch","z":"dfbad1a1.a09ee8","name":"gate","property":"gate","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","outputs":1,"x":770,"y":360,"wires":[["f460811.90c94"]]},{"id":"48f9ef1a.25ffc8","type":"delay","z":"dfbad1a1.a09ee8","name":"","pauseType":"random","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"2","randomUnits":"seconds","drop":false,"x":460,"y":440,"wires":[["1080082a.0875b8"]]},{"id":"1467c090.3f78ef","type":"mqtt in","z":"dfbad1a1.a09ee8","name":"data/#","topic":"data/#","qos":"2","broker":"b04e7681.6fc4a","x":130,"y":440,"wires":[["d743c169.86569"]]},{"id":"d743c169.86569","type":"delay","z":"dfbad1a1.a09ee8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"2","randomUnits":"seconds","drop":false,"x":290,"y":440,"wires":[["48f9ef1a.25ffc8"]]},{"id":"b3440be9.1d97e","type":"mqtt in","z":"dfbad1a1.a09ee8","name":"","topic":"sensors/#","qos":"2","broker":"b04e7681.6fc4a","x":140,"y":360,"wires":[["4c441b15.b5637c"]]},{"id":"4c441b15.b5637c","type":"delay","z":"dfbad1a1.a09ee8","name":"","pauseType":"random","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"2","randomUnits":"seconds","drop":false,"x":300,"y":360,"wires":[["fb04139d.0aaa7"]]},{"id":"1080082a.0875b8","type":"change","z":"dfbad1a1.a09ee8","name":"privacy","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":440,"wires":[["4cdb6460.eeea04"]]},{"id":"409cb4c1.a6e934","type":"change","z":"dfbad1a1.a09ee8","name":"privacy","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":200,"wires":[["2ab57466.9d85ec"]]},{"id":"fd0e5194.f7ce2","type":"change","z":"dfbad1a1.a09ee8","name":"privacy","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":280,"wires":[["874d6719.abd66"]]},{"id":"fb04139d.0aaa7","type":"change","z":"dfbad1a1.a09ee8","name":"privacy","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":360,"wires":[["412281de.f50f78"]]},{"id":"fb69a6a5.d14a","type":"mqtt-broker","z":"","broker":"broker.shiftr.io","port":"1883","clientid":"data->","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""},{"id":"aa4043c2.6a1ef8","type":"mqtt-broker","z":"","broker":"broker.shiftr.io","port":"1883","clientid":"input->","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""},{"id":"1e1e7393.973264","type":"mqtt-broker","z":"","broker":"broker.shiftr.io","port":"1883","clientid":"command->","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""},{"id":"b04e7681.6fc4a","type":"mqtt-broker","z":"","broker":"localhost","port":"8883","tls":"4a6078de.6540e8","clientid":"","usetls":true,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""},{"id":"d4e53eb.b0f5cc","type":"mqtt-broker","z":"","broker":"broker.shiftr.io","port":"1883","clientid":"sensors->","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""},{"id":"4a6078de.6540e8","type":"tls-config","z":"","name":"central1","cert":"/etc/mosquitto/certs/central1.crt","key":"/etc/mosquitto/certs/central1.key","ca":"/etc/mosquitto/certs/ca.crt","verifyservercert":true}]
Urs-Eppenberger

Flow Info

created 2 months, 3 weeks ago

Node Types

Core
  • change (x5)
  • debug (x1)
  • delay (x3)
  • inject (x2)
  • mqtt in (x4)
  • mqtt out (x4)
  • mqtt-broker (x5)
  • switch (x4)
Other
  • tls-config (x1)

Tags

  • MQTT
  • broker
  • bridge
  • for
  • shiftr.io
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option