HowTo: NodeRed – View system data of the RaspberryPi on the dashboard

In addition to the exciting data generated by a SmartHome, you should also take care of the status of the heart of the SmartHome. If you have installed your NodeRed installation on a RaspberrypPi (or other Linux system), you can use the example below to display some of the most important information of the RaspberryPi on the dashboard.

What you have to do is explained in the following article.

Hints for our lovely english readers: Basically, many of the articles on Nerdiy.de are translations from the original german articles. Therefore, it may happen here and there that some illustrations are not available in english and that some translations are weird/strange/full of mistakes or generally totaly wrong. So if you find some obvious (or also not obvious) mistakes don't hesitate to leave us a hint about that in the comment section. 
Also please don't get confused, that instead of a "dot" often a "comma" is used as decimal separator. 🙂


Safety instructions

I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/sicherheitshinweise/


Requirements

Helpful Articles:
Of course NodeRed should already be installed so that you can take over this configuration.
How to prepare a RaspberryPi and then install NodeRed on it, is described in the following articles.
RaspberryPi – Setting up for Nerdiys!
RaspberryPi – The first configuration
RaspberryPi – Controlling the RaspberryPi via SSH
NodeRed – Installing NodeRed on the RaspberryPi
NodeRed – Install New Nodes
NodeRed – Import and Export Node Code
NodeRed – Create a User Interface with dashboard nodes

Required tools:
-none-

Required material:

In the following list you will find all the parts you need to implement this article.


Log in to the NodeRed configuration interface

Before you can edit your NodeRed configuration you must - if activated - first log in to the NodeRed configuration interface.

View of the login screen. Here you have to enter the login details that you entered during the configuration of the login. Information about this can be found in the article NodeRed - User Login Setup.

Node Code

In addition to the dashboard node, only standard nodes and corresponding Linux commands are used for this display. Simply add the following node code and do not forget to position the Dashboard elements correctly on your Dashboard.

You can also find information about this in the article NodeRed – Create a User Interface with dashboard nodes.

This is how your dashboard can look with the Raspberry Pi information.
View of the linked nodes.

Node-Code:

[{"id":"fbbafb8d.8c3818","type":"exec","z":"ae220e4a.3c49d","command":"vcgencmd measure_temp","addpay":false,"append":"","useSpawn":"","timer":"","oldrc":false,"name":"RPi Temperatur","x":440,"y":200,"wires":[["17fa85a3.c0a5fa"],[],[]]},{"id":"610a759f.da34ec","type":"inject","z":"ae220e4a.3c49d","name":"aktualisierung 10sek","topic":"","payload":"","payloadType":"date","repeat":"10","crontab":"","once":false,"onceDelay":"","x":200,"y":200,"wires":[["fbbafb8d.8c3818","6b5302eb.fe0fbc","f8494c08.39fe8"]]},{"id":"17fa85a3.c0a5fa","type":"function","z":"ae220e4a.3c49d","name":"cutString","func":"str = msg.payload\nmsg.payload = str.substring(5,9);\nreturn msg;","outputs":1,"noerr":0,"x":660,"y":200,"wires":[["e8f154dc.299398","71f38a1c.ca6f64"]]},{"id":"4070b9bd.5796b8","type":"exec","z":"ae220e4a.3c49d","command":"sudo reboot","addpay":false,"append":"","useSpawn":"","timer":"","oldrc":false,"name":"Neustarten","x":430,"y":540,"wires":[[],[],[]]},{"id":"77a93271.11eabc","type":"exec","z":"ae220e4a.3c49d","command":"sudo shutdown -h now","addpay":false,"append":"","useSpawn":"","timer":"","oldrc":false,"name":"Herunterfahren","x":440,"y":620,"wires":[[],[],[]]},{"id":"6b5302eb.fe0fbc","type":"exec","z":"ae220e4a.3c49d","command":"top -d 1 -b -n2 | grep \"Cpu(s)\"|tail -n 1 | awk '{print $2 + $4}'","addpay":false,"append":"","useSpawn":"","timer":"","oldrc":false,"name":"CPU Last","x":420,"y":280,"wires":[["97612f41.a7f6e"],[],[]]},{"id":"f8494c08.39fe8","type":"exec","z":"ae220e4a.3c49d","command":"free | grep Mem | awk '{print 100*(($3+$5)/$2)}'","addpay":false,"append":"","useSpawn":"","timer":"","oldrc":false,"name":"RAM","x":410,"y":360,"wires":[["6ce43c7.2c89bc4"],[],[]]},{"id":"7b744c14.050354","type":"exec","z":"ae220e4a.3c49d","command":"df -h","addpay":false,"append":"","useSpawn":"","timer":"","oldrc":false,"name":"Speicherplatz","x":440,"y":440,"wires":[["403e1890.2fbab8"],[],[]]},{"id":"403e1890.2fbab8","type":"function","z":"ae220e4a.3c49d","name":"modifyString","func":"var re = /([0-9]{2})%/\nvar idx = msg.payload.search(re);\nvar str = msg.payload;\nif (idx >=0) {\n    str = msg.payload.substring(idx, idx + 2);\n}\nmsg.payload = str;\nreturn msg;","outputs":1,"noerr":0,"x":670,"y":440,"wires":[["f574e160.da0f1"]]},{"id":"da61973.d30f268","type":"inject","z":"ae220e4a.3c49d","name":"aktualisierung 1min","topic":"","payload":"","payloadType":"date","repeat":"60","crontab":"","once":false,"onceDelay":"","x":200,"y":440,"wires":[["7b744c14.050354"]]},{"id":"37bde909.05a676","type":"ui_button","z":"ae220e4a.3c49d","name":"","group":"5fe5a9b.a8a6158","order":3,"width":0,"height":0,"passthru":false,"label":"Neu starten","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":230,"y":540,"wires":[["4070b9bd.5796b8"]]},{"id":"12fa2be3.80e824","type":"ui_button","z":"ae220e4a.3c49d","name":"","group":"5fe5a9b.a8a6158","order":4,"width":0,"height":0,"passthru":false,"label":"Herunterfahren","color":"","bgcolor":"red","icon":"","payload":"","payloadType":"str","topic":"","x":240,"y":620,"wires":[["77a93271.11eabc"]]},{"id":"e8f154dc.299398","type":"ui_gauge","z":"ae220e4a.3c49d","name":"","group":"5fe5a9b.a8a6158","order":1,"width":0,"height":0,"gtype":"gage","title":"CPU Temperatur","label":"C","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":910,"y":180,"wires":[]},{"id":"638024a7.6ca05c","type":"ui_gauge","z":"ae220e4a.3c49d","name":"","group":"6b432a4a.06ad54","order":1,"width":0,"height":0,"gtype":"gage","title":"CPU","label":"CPU","format":"{{value}}%","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":870,"y":300,"wires":[]},{"id":"d80d6326.88202","type":"ui_gauge","z":"ae220e4a.3c49d","name":"","group":"6b432a4a.06ad54","order":1,"width":0,"height":0,"gtype":"gage","title":"Speicher","label":"RAM","format":"{{value}}%","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":880,"y":360,"wires":[]},{"id":"f574e160.da0f1","type":"ui_gauge","z":"ae220e4a.3c49d","name":"","group":"6b432a4a.06ad54","order":1,"width":0,"height":0,"gtype":"gage","title":"Disk","label":"Speicherplatz","format":"{{value}}%","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":870,"y":440,"wires":[]},{"id":"71f38a1c.ca6f64","type":"ui_chart","z":"ae220e4a.3c49d","name":"","group":"5fe5a9b.a8a6158","order":2,"width":0,"height":0,"label":"CPU Temperatur Verlauf","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"x":930,"y":240,"wires":[[],[]]},{"id":"6ce43c7.2c89bc4","type":"function","z":"ae220e4a.3c49d","name":"deleteWhitespace","func":"var str = msg.payload\nstr = str.trim();\nvar nr=parseInt(str);\nmsg.payload = nr.toFixed(1);\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":360,"wires":[["d80d6326.88202"]]},{"id":"97612f41.a7f6e","type":"function","z":"ae220e4a.3c49d","name":"deleteWhitespace","func":"str = msg.payload\nmsg.payload = str.trim();\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":280,"wires":[["638024a7.6ca05c"]]},{"id":"75f679fd.1125a8","type":"inject","z":"ae220e4a.3c49d","name":"Herunterfahren","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":260,"y":680,"wires":[["77a93271.11eabc"]]},{"id":"5fe5a9b.a8a6158","type":"ui_group","z":"ae220e4a.3c49d","name":"2","tab":"7e8708a2.0fc408","order":2,"disp":false,"width":"6","collapse":false},{"id":"6b432a4a.06ad54","type":"ui_group","z":"ae220e4a.3c49d","name":"1","tab":"7e8708a2.0fc408","order":1,"disp":false,"width":"6","collapse":false},{"id":"7e8708a2.0fc408","type":"ui_tab","z":"ae220e4a.3c49d","name":"Raspi Daten","icon":"dashboard","order":1}]

I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂

Fab

P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂

Buy Me a Coffee at ko-fi.com

Leave a Reply

Your email address will not be published. Required fields are marked *