Internet Speedtest (with Charts and Guages)

This flow is based on the excellent flow developed by "bloigge". The original flow can be found here: http://flows.nodered.org/flow/b79e4d9cfc4b474b9975a8bb3b80fb64

This flow checks the current Internet Speed and logs the data to various gauges and charts in a UI Dashboard. It runs on the hour of each hour, i.e. 10am, 11am, 12pm etc. It also allows the test to be invoked manually should the user want to do an immediate test from the dashboard.

PreSettings (as per the original instructions):

Install speedtest_cli:

wget -O speedtest-cli https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py chmod +x speedtest-cli

Requires: Node-Red UI (http://flows.nodered.org/node/node-red-contrib-ui)

[{"id":"ce56eb75.26c998","type":"exec","z":"8fde001d.7f357","command":"/home/deeppurple/speedtest-cli","addpay":false,"append":"","useSpawn":"","timer":"","name":"Call Speedtest-cli","x":287.5,"y":359.6666564941406,"wires":[["94166ade.706f58"],[],[]]},{"id":"94166ade.706f58","type":"function","z":"8fde001d.7f357","name":"Data Preparation for File","func":"var content = msg.payload.split(\"\\n\");\nvar msgDown = {topic: \"Download\", payload: parseFloat(content[6].split(\" \")[1])};\nvar msgUp = {topic: \"Upload\", payload: parseFloat(content[8].split(\" \")[1])};\n\nvar hostedBy = content[4];\nvar ping = {topic: \"Ping\", payload: hostedBy.split(\":\")[1]};\nvar distance = {topic: \"Distance\", payload: hostedBy.split(\"[\")[1].split(\"]\")[0]};\nvar ISP = {payload: hostedBy.split(\"Hosted by\")[1].split(\"[\")[0]};\n\nfunction getTimeStamp() {\n    var date = new Date();\n    var year = date.getFullYear();\n    var month = (\"0\"+(date.getMonth()+1)).substr(-2);\n    var day = (\"0\"+date.getDate()).substr(-2);\n    var hour = (\"0\"+date.getHours()).substr(-2);\n    var minutes = (\"0\"+date.getMinutes()).substr(-2);\n    var seconds = (\"0\"+date.getSeconds()).substr(-2);\n    return year+\"-\"+month+\"-\"+day+\" \"+hour+\":\"+minutes+\":\"+seconds;\n}\n    \nvar time = {payload: getTimeStamp()};\n\nreturn [msgDown, msgUp, time, ping, distance, ISP];","outputs":"6","noerr":0,"x":547,"y":349,"wires":[["6045fb71.a8e564","70d2e4d4.f12c4c","bdfe0e4.729ddf"],["70d2e4d4.f12c4c","6045fb71.a8e564","ffb5dc4.a20f12"],["bc28449f.5b32f8","6045fb71.a8e564"],["2ef6b383.b6375c","ea99deea.4cbb1"],["ccdd57a9.f416d8","ea99deea.4cbb1"],["e97e7ff1.291b1"]]},{"id":"378e1aeb.490496","type":"inject","z":"8fde001d.7f357","name":"Second Tick","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"x":129.5,"y":149,"wires":[["3f5b327f.c29e1e"]]},{"id":"6045fb71.a8e564","type":"debug","z":"8fde001d.7f357","name":"","active":false,"console":"false","complete":"true","x":956.5,"y":165,"wires":[]},{"id":"70d2e4d4.f12c4c","type":"ui_chart","z":"8fde001d.7f357","name":"Performance Chart","group":"6ad43cb5.1fb1e4","order":0,"width":0,"height":0,"label":"Performance Chart","chartType":"line","legend":"true","xformat":"%H:%M:%S","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderUnit":"604800","x":959.5,"y":231,"wires":[["fbfbb7f2.6c9f08"],[]]},{"id":"fbfbb7f2.6c9f08","type":"file","z":"8fde001d.7f357","name":"Speed Test Data Save","filename":"speedtestData.json","appendNewline":false,"createDir":false,"overwriteFile":"true","x":1197.5,"y":199,"wires":[]},{"id":"81b8d40a.a899c8","type":"file in","z":"8fde001d.7f357","name":"Speed Test Data Restore","filename":"speedtestData.json","format":"utf8","x":1200.5,"y":252,"wires":[["ffcd7703.b04478"]]},{"id":"ffcd7703.b04478","type":"json","z":"8fde001d.7f357","name":"","x":1161.5,"y":143,"wires":[["70d2e4d4.f12c4c"]]},{"id":"bdfe0e4.729ddf","type":"ui_gauge","z":"8fde001d.7f357","name":"","group":"a1aa2891.55e438","order":6,"width":0,"height":0,"gtype":"gage","title":"Download Speed","label":"Download Mbits","format":"{{value}}","min":0,"max":"20","colors":["#ff002d","#e4b400","#03f81f"],"x":947.5,"y":387,"wires":[]},{"id":"ffb5dc4.a20f12","type":"ui_gauge","z":"8fde001d.7f357","name":"","group":"a1aa2891.55e438","order":7,"width":0,"height":0,"gtype":"gage","title":"Upload Speed","label":"Upload MBits","format":"{{value}}","min":0,"max":"20","colors":["#ff002d","#ffed36","#03f81f"],"x":947,"y":440,"wires":[]},{"id":"bc28449f.5b32f8","type":"ui_text","z":"8fde001d.7f357","group":"a1aa2891.55e438","order":1,"width":0,"height":0,"name":"Latest Speedtest","label":"Lastest Speedtest","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":955.5,"y":489,"wires":[]},{"id":"b4c22453.c329d8","type":"ui_button","z":"8fde001d.7f357","name":"","group":"a1aa2891.55e438","order":3,"width":0,"height":0,"label":"SpeedTest Now!","color":"","icon":"","payload":"","payloadType":"date","topic":"","x":148.5,"y":507,"wires":[["ce56eb75.26c998"]]},{"id":"a97c5c09.b8dc4","type":"inject","z":"8fde001d.7f357","name":"","topic":"","payload":"restore","payloadType":"str","repeat":"","crontab":"","once":true,"x":933.5,"y":284,"wires":[["81b8d40a.a899c8","33685a3a.458306"]]},{"id":"3f5b327f.c29e1e","type":"function","z":"8fde001d.7f357","name":"Get Hour","func":"function gethour() {\n    var date = new Date();\n    var hour = (\"0\"+date.getHours()).substr(-2);\n    return hour;\n}\n\nvar hour=gethour();\n\nmsg = {payload:hour};\nreturn msg;\n","outputs":1,"noerr":0,"x":299.5,"y":149,"wires":[["4f17a87f.cc5ba8"]]},{"id":"4f17a87f.cc5ba8","type":"rbe","z":"8fde001d.7f357","name":"","func":"rbe","gap":"","start":"","inout":"out","x":436.5,"y":149,"wires":[["ce56eb75.26c998"]]},{"id":"e97e7ff1.291b1","type":"ui_text","z":"8fde001d.7f357","group":"a1aa2891.55e438","order":2,"width":0,"height":0,"name":"","label":"Hosted By","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":938.5,"y":612,"wires":[]},{"id":"ccdd57a9.f416d8","type":"ui_text","z":"8fde001d.7f357","group":"a1aa2891.55e438","order":5,"width":0,"height":0,"name":"","label":"Distance","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":927,"y":574,"wires":[]},{"id":"2ef6b383.b6375c","type":"ui_text","z":"8fde001d.7f357","group":"a1aa2891.55e438","order":4,"width":0,"height":0,"name":"","label":"Ping Time","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":929,"y":535,"wires":[]},{"id":"c0e5af5.a4e385","type":"file","z":"8fde001d.7f357","name":"Speed Test Data Save","filename":"speedtestDataPD.json","appendNewline":false,"createDir":false,"overwriteFile":"true","x":1192,"y":295,"wires":[]},{"id":"33685a3a.458306","type":"file in","z":"8fde001d.7f357","name":"Speed Test Data Restore","filename":"speedtestDataPD.json","format":"utf8","x":1200,"y":344,"wires":[["446f355b.a0592c"]]},{"id":"446f355b.a0592c","type":"json","z":"8fde001d.7f357","name":"","x":1166.5,"y":411,"wires":[["ea99deea.4cbb1"]]},{"id":"ea99deea.4cbb1","type":"ui_chart","z":"8fde001d.7f357","name":"Latency Chart","group":"6ad43cb5.1fb1e4","order":0,"width":0,"height":0,"label":"Latency Chart","chartType":"line","legend":"true","xformat":"%H:%M:%S","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderUnit":"604800","x":961,"y":332,"wires":[["c0e5af5.a4e385"],[]]},{"id":"6ad43cb5.1fb1e4","type":"ui_group","z":"","name":"Chart","tab":"ca2c9b5d.7d3298","order":2,"disp":false,"width":"12"},{"id":"a1aa2891.55e438","type":"ui_group","z":"","name":"Graphs","tab":"ca2c9b5d.7d3298","order":1,"disp":false,"width":"6"},{"id":"ca2c9b5d.7d3298","type":"ui_tab","z":"","name":"SpeedTest History","icon":"dashboard","order":3}]

Flow Info

Created 8 years ago
Updated 7 years, 2 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • debug (x1)
  • exec (x1)
  • file (x2)
  • file in (x2)
  • function (x2)
  • inject (x2)
  • json (x2)
  • rbe (x1)
Other
  • ui_button (x1)
  • ui_chart (x2)
  • ui_gauge (x2)
  • ui_group (x2)
  • ui_tab (x1)
  • ui_text (x4)

Tags

  • Speedtest
  • UI
  • Chart
  • Guage
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option