Sdomotica

SpeedTest

Aug 5th, 2021
808
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [{"id":"1096901fcb930cd1","type":"tab","label":"Speedtest","disabled":false,"info":""},{"id":"ce56eb75.26c998","type":"exec","z":"1096901fcb930cd1","command":"/home/pi/sdomotica/tmp/speedtest/speedtest-cli","addpay":false,"append":"","useSpawn":"","timer":"","winHide":false,"name":"Call Speedtest-cli","x":270,"y":340,"wires":[["94166ade.706f58","249a5e1c4411a0a1"],["249a5e1c4411a0a1"],["249a5e1c4411a0a1"]]},{"id":"94166ade.706f58","type":"function","z":"1096901fcb930cd1","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":529.5,"y":329.3333435058594,"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":"1096901fcb930cd1","name":"Second Tick","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"1","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":112,"y":129.33334350585938,"wires":[["3f5b327f.c29e1e"]]},{"id":"6045fb71.a8e564","type":"debug","z":"1096901fcb930cd1","name":"","active":true,"console":"false","complete":"true","x":730,"y":160,"wires":[]},{"id":"70d2e4d4.f12c4c","type":"ui_chart","z":"1096901fcb930cd1","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","outputs":1,"x":942,"y":211.33334350585938,"wires":[["fbfbb7f2.6c9f08"]]},{"id":"fbfbb7f2.6c9f08","type":"file","z":"1096901fcb930cd1","name":"Speed Test Data Save","filename":"speedtestData.json","appendNewline":false,"createDir":false,"overwriteFile":"true","x":1180,"y":179.33334350585938,"wires":[[]]},{"id":"81b8d40a.a899c8","type":"file in","z":"1096901fcb930cd1","name":"Speed Test Data Restore","filename":"speedtestData.json","format":"utf8","x":1183,"y":232.33334350585938,"wires":[["ffcd7703.b04478"]]},{"id":"ffcd7703.b04478","type":"json","z":"1096901fcb930cd1","name":"","x":1144,"y":123.33334350585938,"wires":[["70d2e4d4.f12c4c"]]},{"id":"bdfe0e4.729ddf","type":"ui_gauge","z":"1096901fcb930cd1","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":930,"y":367.3333435058594,"wires":[]},{"id":"ffb5dc4.a20f12","type":"ui_gauge","z":"1096901fcb930cd1","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":929.5,"y":420.3333435058594,"wires":[]},{"id":"bc28449f.5b32f8","type":"ui_text","z":"1096901fcb930cd1","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":938,"y":469.3333435058594,"wires":[]},{"id":"b4c22453.c329d8","type":"ui_button","z":"1096901fcb930cd1","name":"","group":"a1aa2891.55e438","order":3,"width":0,"height":0,"label":"SpeedTest Now!","color":"","icon":"","payload":"","payloadType":"date","topic":"","x":131,"y":487.3333435058594,"wires":[["ce56eb75.26c998"]]},{"id":"a97c5c09.b8dc4","type":"inject","z":"1096901fcb930cd1","name":"","repeat":"","crontab":"","once":true,"topic":"","payload":"restore","payloadType":"str","x":916,"y":264.3333435058594,"wires":[["81b8d40a.a899c8","33685a3a.458306"]]},{"id":"3f5b327f.c29e1e","type":"function","z":"1096901fcb930cd1","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":282,"y":129.33334350585938,"wires":[["4f17a87f.cc5ba8"]]},{"id":"4f17a87f.cc5ba8","type":"rbe","z":"1096901fcb930cd1","name":"","func":"rbe","gap":"","start":"","inout":"out","x":419,"y":129.33334350585938,"wires":[["ce56eb75.26c998"]]},{"id":"e97e7ff1.291b1","type":"ui_text","z":"1096901fcb930cd1","group":"a1aa2891.55e438","order":2,"width":0,"height":0,"name":"","label":"Hosted By","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":921,"y":592.3333435058594,"wires":[]},{"id":"ccdd57a9.f416d8","type":"ui_text","z":"1096901fcb930cd1","group":"a1aa2891.55e438","order":5,"width":0,"height":0,"name":"","label":"Distance","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":909.5,"y":554.3333435058594,"wires":[]},{"id":"2ef6b383.b6375c","type":"ui_text","z":"1096901fcb930cd1","group":"a1aa2891.55e438","order":4,"width":0,"height":0,"name":"","label":"Ping Time","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":911.5,"y":515.3333435058594,"wires":[]},{"id":"c0e5af5.a4e385","type":"file","z":"1096901fcb930cd1","name":"Speed Test Data Save","filename":"speedtestDataPD.json","appendNewline":false,"createDir":false,"overwriteFile":"true","x":1174.5,"y":275.3333435058594,"wires":[[]]},{"id":"33685a3a.458306","type":"file in","z":"1096901fcb930cd1","name":"Speed Test Data Restore","filename":"speedtestDataPD.json","format":"utf8","x":1182.5,"y":324.3333435058594,"wires":[["446f355b.a0592c"]]},{"id":"446f355b.a0592c","type":"json","z":"1096901fcb930cd1","name":"","x":1149,"y":391.3333435058594,"wires":[["ea99deea.4cbb1"]]},{"id":"ea99deea.4cbb1","type":"ui_chart","z":"1096901fcb930cd1","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","outputs":2,"x":943.5,"y":312.3333435058594,"wires":[["c0e5af5.a4e385"],[]]},{"id":"249a5e1c4411a0a1","type":"debug","z":"1096901fcb930cd1","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":450,"y":480,"wires":[]},{"id":"6ad43cb5.1fb1e4","type":"ui_group","name":"Chart","tab":"ca2c9b5d.7d3298","order":2,"disp":false,"width":"12"},{"id":"a1aa2891.55e438","type":"ui_group","name":"Graphs","tab":"ca2c9b5d.7d3298","order":1,"disp":false,"width":"6"},{"id":"ca2c9b5d.7d3298","type":"ui_tab","name":"SpeedTest History","icon":"dashboard","order":3}]
RAW Paste Data