Skip to content

Instantly share code, notes, and snippets.

@matr1xp
Created February 8, 2017 09:17
Show Gist options
  • Save matr1xp/3ebec29262b697bed8a863b1df770977 to your computer and use it in GitHub Desktop.
Save matr1xp/3ebec29262b697bed8a863b1df770977 to your computer and use it in GitHub Desktop.
Node-RED Raspberry Pi Dashboard
[
{
"id": "277bfe7c.1ba7f2",
"type": "ui_gauge",
"z": "8fb8cb67.969a38",
"name": "",
"group": "e3441e7f.58bb3",
"order": 2,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "CPU Temperature",
"label": "C",
"format": "{{value}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"x": 691,
"y": 56,
"wires": []
},
{
"id": "6f6f94cf.3f61dc",
"type": "exec",
"z": "8fb8cb67.969a38",
"command": "vcgencmd measure_temp",
"addpay": false,
"append": "",
"useSpawn": "",
"timer": "",
"name": "RPi Temp.",
"x": 331,
"y": 56,
"wires": [
[
"6cf396.3d906c6c"
],
[],
[]
]
},
{
"id": "274aefc4.a1b9d",
"type": "inject",
"z": "8fb8cb67.969a38",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "10",
"crontab": "",
"once": false,
"x": 125.5,
"y": 64.25,
"wires": [
[
"6f6f94cf.3f61dc",
"5d84cb.21ac1b34",
"eb054e78.fcc8c"
]
]
},
{
"id": "6cf396.3d906c6c",
"type": "function",
"z": "8fb8cb67.969a38",
"name": "",
"func": "str = msg.payload\nmsg.payload = str.substring(5,9);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 511,
"y": 56,
"wires": [
[
"277bfe7c.1ba7f2",
"e0c269f8.376aa8"
]
]
},
{
"id": "fdef9dc8.a672a",
"type": "ui_button",
"z": "8fb8cb67.969a38",
"name": "",
"group": "2f015ed.7ba73a2",
"order": 2,
"width": 0,
"height": 0,
"label": "Reboot",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "Are you sure you wish to reboot?",
"payloadType": "str",
"topic": "",
"x": 101,
"y": 436,
"wires": [
[
"9b3e14bd.bf8a38"
]
]
},
{
"id": "49522fa4.16107",
"type": "exec",
"z": "8fb8cb67.969a38",
"command": "sudo reboot",
"addpay": false,
"append": "",
"useSpawn": "",
"timer": "",
"name": "Reboot",
"x": 688.0000152587891,
"y": 412.0000305175781,
"wires": [
[],
[],
[]
]
},
{
"id": "64822cea.4ca4a4",
"type": "ui_button",
"z": "8fb8cb67.969a38",
"name": "",
"group": "2f015ed.7ba73a2",
"order": 3,
"width": 0,
"height": 0,
"label": "Shutdown",
"color": "",
"bgcolor": "red",
"icon": "",
"payload": "Shutdown Raspberry Pi?",
"payloadType": "str",
"topic": "",
"x": 109.5,
"y": 480.25,
"wires": [
[
"e2efdef1.f0126"
]
]
},
{
"id": "4143443c.b982dc",
"type": "exec",
"z": "8fb8cb67.969a38",
"command": "sudo shutdown -h now",
"addpay": false,
"append": "",
"useSpawn": "",
"timer": "",
"name": "Shutdown",
"x": 698.5000152587891,
"y": 509.2500305175781,
"wires": [
[],
[],
[]
]
},
{
"id": "e0c269f8.376aa8",
"type": "ui_chart",
"z": "8fb8cb67.969a38",
"name": "",
"group": "e3441e7f.58bb3",
"order": 3,
"width": 0,
"height": 0,
"label": "",
"chartType": "line",
"legend": "false",
"xformat": "HH:mm:ss",
"interpolate": "linear",
"nodata": "",
"ymin": "",
"ymax": "",
"removeOlder": "24",
"removeOlderPoints": "",
"removeOlderUnit": "3600",
"cutout": 0,
"x": 691,
"y": 96,
"wires": [
[],
[]
]
},
{
"id": "5d84cb.21ac1b34",
"type": "exec",
"z": "8fb8cb67.969a38",
"command": "top -d 0.5 -b -n2 | grep \"Cpu(s)\"|tail -n 1 | awk '{print $2 + $4}'",
"addpay": false,
"append": "",
"useSpawn": "",
"timer": "",
"name": "CPU Load",
"x": 331,
"y": 136,
"wires": [
[
"2637b97e.f22646"
],
[],
[]
]
},
{
"id": "eb054e78.fcc8c",
"type": "exec",
"z": "8fb8cb67.969a38",
"command": "free | grep Mem | awk '{print 100*($4+$6+$7)/$2}'",
"addpay": false,
"append": "",
"useSpawn": "",
"timer": "",
"name": "Free Memory",
"x": 331,
"y": 216,
"wires": [
[
"80557a7b.3b1098"
],
[],
[]
]
},
{
"id": "2637b97e.f22646",
"type": "ui_gauge",
"z": "8fb8cb67.969a38",
"name": "",
"group": "e3441e7f.58bb3",
"order": 1,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Processor",
"label": "CPU",
"format": "{{value}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"x": 691,
"y": 136,
"wires": []
},
{
"id": "80557a7b.3b1098",
"type": "ui_gauge",
"z": "8fb8cb67.969a38",
"name": "",
"group": "b5a198fb.7b58e8",
"order": 1,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Memory",
"label": "RAM",
"format": "{{value.toFixed(1)}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"x": 691,
"y": 216,
"wires": []
},
{
"id": "c70f031e.ef11",
"type": "exec",
"z": "8fb8cb67.969a38",
"command": "df -h",
"addpay": false,
"append": "",
"useSpawn": "",
"timer": "",
"name": "Disk Usage",
"x": 331,
"y": 296,
"wires": [
[
"60d1bbb0.5797a4"
],
[],
[]
]
},
{
"id": "fb42b567.098148",
"type": "ui_gauge",
"z": "8fb8cb67.969a38",
"name": "",
"group": "8cdd8a49.3bcc38",
"order": 1,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Disk",
"label": "Usage",
"format": "{{value}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"x": 691,
"y": 296,
"wires": []
},
{
"id": "60d1bbb0.5797a4",
"type": "function",
"z": "8fb8cb67.969a38",
"name": "",
"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": 511,
"y": 296,
"wires": [
[
"fb42b567.098148"
]
]
},
{
"id": "1ff92f84.354f3",
"type": "inject",
"z": "8fb8cb67.969a38",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "60",
"crontab": "",
"once": false,
"x": 131,
"y": 296,
"wires": [
[
"c70f031e.ef11"
]
]
},
{
"id": "9b3e14bd.bf8a38",
"type": "ui_toast",
"z": "8fb8cb67.969a38",
"position": "dialog",
"displayTime": "3",
"outputs": 1,
"ok": "OK",
"cancel": "Cancel",
"topic": "Reboot Raspberry Pi",
"name": "",
"x": 335.3000030517578,
"y": 426.2000427246094,
"wires": [
[
"45350474.f5027c"
]
]
},
{
"id": "45350474.f5027c",
"type": "switch",
"z": "8fb8cb67.969a38",
"name": "Confirm",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "OK",
"vt": "str"
}
],
"checkall": "true",
"outputs": 1,
"x": 509.3000030517578,
"y": 421.8000793457031,
"wires": [
[
"49522fa4.16107"
]
]
},
{
"id": "74042d6b.895744",
"type": "switch",
"z": "8fb8cb67.969a38",
"name": "Confirm",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "OK",
"vt": "str"
}
],
"checkall": "true",
"outputs": 1,
"x": 505.00001525878906,
"y": 515.0000305175781,
"wires": [
[
"4143443c.b982dc"
]
]
},
{
"id": "e2efdef1.f0126",
"type": "ui_toast",
"z": "8fb8cb67.969a38",
"position": "dialog",
"displayTime": "3",
"outputs": 1,
"ok": "OK",
"cancel": "Cancel",
"topic": "Shutdown Raspberry Pi",
"name": "",
"x": 336.00001525878906,
"y": 505.0000305175781,
"wires": [
[
"74042d6b.895744"
]
]
},
{
"id": "e3441e7f.58bb3",
"type": "ui_group",
"z": "",
"name": "Col1",
"tab": "4074dba3.5d15c4",
"order": 1,
"disp": false,
"width": "6"
},
{
"id": "2f015ed.7ba73a2",
"type": "ui_group",
"z": "",
"name": "Actions",
"tab": "4074dba3.5d15c4",
"order": 4,
"disp": true,
"width": "6"
},
{
"id": "b5a198fb.7b58e8",
"type": "ui_group",
"z": "",
"name": "Col2",
"tab": "4074dba3.5d15c4",
"order": 2,
"disp": false,
"width": "6"
},
{
"id": "8cdd8a49.3bcc38",
"type": "ui_group",
"z": "",
"name": "Col3",
"tab": "4074dba3.5d15c4",
"order": 3,
"disp": false,
"width": "6"
},
{
"id": "4074dba3.5d15c4",
"type": "ui_tab",
"z": "",
"name": "RPi Control",
"icon": "dashboard",
"order": 1
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment