Neben den spannenden Daten die ein SmartHome erzeugt sollte man sich auch ein wenig um den Status des Herzstückes des SmartHome kümmern. Habt Ihr Eure NodeRed-Installation auf einem RaspberrypPi(oder anderem Linux-System) installiert so könnt Ihr euch mit dem nachfolgendem Beispiel ein paar der wichtigsten Informationen des RaspberryPi auf dem Dashboard anzeigen lassen.
Was Ihr dazu machen müsst ist im folgenden Artikel erklärt.
Safety instructions
I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/
Affiliate links/advertising links
The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂
Requirements
Helpful articles:
So that you can install new nodes, NodeRed should of course already be installed.
How to prepare a RaspberryPi and then install NodeRed on it is described in the following articles.
The following three articles describe what needs to be done to prepare the RaspberryPi:
RaspberryPi – setup for nerdiys!
RaspberryPi – The first configuration!
RaspberryPi – Control the RaspberryPi via SSH
NodeRed – Installing NodeRed on the RaspberryPi
NodeRed – Install new nodes
NodeRed - Create a user interface with dashboard nodes
Required material:
-no-
Required material:
In the following list you will find all the parts you need to implement this article.
Log into the NodeRed configuration interface
Before you can edit your NodeRed configuration, you must - if activated - first log into the NodeRed configuration interface.

Node code
Für diese Anzeige werden neben der Dashboard-Node nur Standard-Nodes und entsprechende Linux-Befehle genutzt. Fügt dazu einfach nachfolgenden Node-Code ein und vergesst danach nicht die Dashboard-Elemente auf Eurem Dashboard korrekt zu positionieren.
Informationen dazu findet Ihr auch in dem Artikel NodeRed - Create a user interface with dashboard 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 msg.payload = str.substring(5,9); return 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})%/ var idx = msg.payload.search(re); var str = msg.payload; if (idx >=0) { str = msg.payload.substring(idx, idx + 2); } msg.payload = str; return 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 str = str.trim(); var nr=parseInt(str); msg.payload = nr.toFixed(1); return 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 msg.payload = str.trim(); return 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}]
Have fun with the project
I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂
PS 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 think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂
Hi, very nice flow. I'm a beginner with node-red and can learn a lot with it.
CPU temperature and history running. For the node RAM, I replaced "mem" with "RAM" (German Raspian :-), works too. But the commands for "memory space" and "CPU" do not work and unfortunately my knowledge is not sufficient for a change. Could you adapt that for a German version?
Thanks and regards, Hajo.
Hi hajo,
I just tested it all again. "Unfortunately" everything works for me. Can you give me some more info what isn't working for you? 🙂
Best regards
Fabian
2/13/2023, 9:04:19 am node: modifyString
function : (error)
"TypeError: msg.payload.search is not a function"
???
Hallo Nerdy,
habe (bin auch noch Anfänger) den Flow heruntergeladen und installiert.
Hat super funktioniert …
Nachdem ich nun das System von der SD-Karte auf eine HD übertragen habe werden in CPU, Speicher und Disk keine Werte mehr angezeigt …
CPUTempertur funktioniert.
Hast mglw. einen Tip für mich?
Beste Grüsse
Jurgen
Hi Jürgen,
ja das liegt sehr wahrscheinlich daran, dass die Festplatte einen anderen Mountpoint/Pfad hat als die SD Karte.
Kannst du mir mal die Ausgabe von „df -h“ (einfach in die Konsole eingeben) schicken? Dann kann ich dir sagen wie der aktuelle Mountpoint lautet und wir können den NodeRed Code entsprechend anpassen. 🙂
Best regards
Fabian