Handy UI page for locally hosted Mosquitto and Node-RED

This is something I have put on two raspberry pi's I have setup for friends recently to use for basic automations. Rasoberry Pi's setup to monitor and control various sensors and Tasmota devices.

The flows simply build a little control panel for the server with some basic information and status on the services running. For somebody not familiar with Raspberry Pi, Linux, Node-RED, MQTT and more concerned with making stuff work then knowing that everything is running is gold. Having some browser tools for graceful shutdown or restarts is also a safe option.

[{"id":"37d58a3f.c5e8d6","type":"tab","label":"Server Utilities","disabled":false,"info":""},{"id":"7d6a2758.99adb8","type":"inject","z":"37d58a3f.c5e8d6","name":"Flasher pulser timer thing","topic":"","payload":"true","payloadType":"bool","repeat":"1","crontab":"","once":true,"onceDelay":"1","x":200,"y":200,"wires":[["fd7d2044.127d"]]},{"id":"fd7d2044.127d","type":"function","z":"37d58a3f.c5e8d6","name":"Colour changer","func":"ledState = flow.get(\"ledState\");\nif (ledState !== true){\nmsg.payload = true;\nflow.set(\"ledState\", msg.payload)\nreturn msg;\n}\nif (ledState === true){\nmsg.payload = false;\nflow.set(\"ledState\", msg.payload)\nreturn msg;\n}\n","outputs":1,"noerr":0,"x":440,"y":200,"wires":[["a368ef0c.094d2"]]},{"id":"40e26258.d29b9c","type":"ui_led","z":"37d58a3f.c5e8d6","group":"2a044b0.a8a64b6","order":2,"width":0,"height":0,"label":"<b>Mosquitto broker heartbeat</b>","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"white","value":"false","valueType":"str"},{"color":"green","value":"true","valueType":"str"}],"allowColorForValueInMessage":false,"name":"","x":650,"y":280,"wires":[]},{"id":"78d7a0a9.6501e","type":"ui_button","z":"37d58a3f.c5e8d6","name":"","group":"2a044b0.a8a64b6","order":5,"width":0,"height":0,"passthru":false,"label":"Restart","tooltip":"Use this to restart the server","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":120,"y":40,"wires":[["c99064b4.793888"]]},{"id":"b2bd1b15.9f6708","type":"ui_button","z":"37d58a3f.c5e8d6","name":"","group":"2a044b0.a8a64b6","order":6,"width":0,"height":0,"passthru":false,"label":"Shutdown","tooltip":"Use this to shut down the server !!! Needs power cycle to restart !!!","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":120,"y":120,"wires":[["6fbd3e7e.781e6"]]},{"id":"c99064b4.793888","type":"exec","z":"37d58a3f.c5e8d6","command":"sudo reboot","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Reboot command","x":610,"y":40,"wires":[[],[],[]]},{"id":"6fbd3e7e.781e6","type":"exec","z":"37d58a3f.c5e8d6","command":"sudo shutdown -h now","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Shutdown command","x":600,"y":120,"wires":[[],[],[]]},{"id":"e3347cf5.2f23e","type":"mqtt in","z":"37d58a3f.c5e8d6","name":"","topic":"MQTT-test","qos":"2","datatype":"auto","broker":"c8c1abe9.313f78","x":120,"y":280,"wires":[["40e26258.d29b9c"]]},{"id":"a368ef0c.094d2","type":"mqtt out","z":"37d58a3f.c5e8d6","name":"","topic":"MQTT-test","qos":"","retain":"","broker":"c8c1abe9.313f78","x":630,"y":200,"wires":[]},{"id":"c00480b8.53fd5","type":"exec","z":"37d58a3f.c5e8d6","command":"/opt/vc/bin/vcgencmd measure_temp","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Request temp","x":380,"y":360,"wires":[["917f9de9.d13f7"],[],[]]},{"id":"917f9de9.d13f7","type":"ui_text","z":"37d58a3f.c5e8d6","group":"2a044b0.a8a64b6","order":1,"width":0,"height":0,"name":"Display Temp","label":"<b>Server CPU </b>","format":"{{msg.payload}}","layout":"row-center","x":620,"y":360,"wires":[]},{"id":"cfe9ab3d.555438","type":"inject","z":"37d58a3f.c5e8d6","name":"Check °C","topic":"","payload":"","payloadType":"str","repeat":"10","crontab":"","once":true,"onceDelay":"","x":150,"y":360,"wires":[["c00480b8.53fd5"]]},{"id":"5707cbe2.e8d254","type":"ui_audio","z":"37d58a3f.c5e8d6","name":"Speech output","group":"2a044b0.a8a64b6","voice":"en-GB","always":"","x":620,"y":460,"wires":[]},{"id":"5d127a9e.9e6734","type":"ui_button","z":"37d58a3f.c5e8d6","name":"MQTT Test","group":"2a044b0.a8a64b6","order":3,"width":0,"height":0,"passthru":false,"label":"Test MQTT","tooltip":"Press this to check MQTT service","color":"","bgcolor":"","icon":"","payload":"Well,     that was a success!","payloadType":"str","topic":"","x":130,"y":460,"wires":[["202e9053.1c3c8"]]},{"id":"202e9053.1c3c8","type":"mqtt out","z":"37d58a3f.c5e8d6","name":"","topic":"audiotest","qos":"","retain":"","broker":"c8c1abe9.313f78","x":360,"y":420,"wires":[]},{"id":"62e8909f.e4be3","type":"mqtt in","z":"37d58a3f.c5e8d6","name":"","topic":"audiotest","qos":"2","datatype":"auto","broker":"c8c1abe9.313f78","x":360,"y":480,"wires":[["5707cbe2.e8d254","b4f1f74e.a23778"]]},{"id":"b4f1f74e.a23778","type":"ui_toast","z":"37d58a3f.c5e8d6","position":"dialog","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"Call Ghostbusters","raw":false,"topic":"audiotest","name":"Popup","x":590,"y":500,"wires":[[]]},{"id":"2a044b0.a8a64b6","type":"ui_group","z":"","name":"Server","tab":"760fa050.08b18","order":1,"disp":true,"width":"6","collapse":false},{"id":"c8c1abe9.313f78","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"760fa050.08b18","type":"ui_tab","z":"","name":"Server Utils Dashboard","icon":"dashboard","disabled":false,"hidden":false}]
2 Likes