Node-Red Flow Samples/Sharing

Title: Periodic internet speed test

Summary:
This sequence keeps track of my internet speed (every hour) and plots the data out in NR dashboard. I'm posting it because it gives a simple example of how to save and retrieve data.

Summary

[{"id":"f11a13be.36e21","type":"simpletime","z":"641677fe.7efb8","name":"","x":410,"y":660,"wires":[["c48f441a.c64868","12bb40d7.cee35f"]]},{"id":"c48f441a.c64868","type":"template","z":"641677fe.7efb8","name":"time","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{mydate}} {{mytimes}}","output":"str","x":650,"y":620,"wires":[["ef753891.93342"]]},{"id":"12bb40d7.cee35f","type":"switch","z":"641677fe.7efb8","name":"down < 100","property":"payload.speeds.download","propertyType":"msg","rules":[{"t":"lt","v":"100","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":670,"y":820,"wires":[["ff368af4.ae96d"]]},{"id":"9e3f58fe.e530e","type":"speedtest","z":"641677fe.7efb8","name":"Speedtest","serverId":"","maxTime":"120000","x":410,"y":600,"wires":[["aa623598.74eb98","b2a90ab2.32421","dbc3c3e7.20861","6755d730.02674","a012c307.cb4028","f11a13be.36e21"]]},{"id":"ef753891.93342","type":"ui_text","z":"641677fe.7efb8","group":"2a046f7e.21973","order":6,"width":0,"height":0,"name":"Last Speedtest","label":"Last Speedtest","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":920,"y":620,"wires":[]},{"id":"ff368af4.ae96d","type":"change","z":"641677fe.7efb8","name":"Speed Test","rules":[{"t":"set","p":"topic","pt":"msg","to":"Speed Test","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":820,"wires":[["aa219933.4c2e6"]]},{"id":"aa623598.74eb98","type":"change","z":"641677fe.7efb8","name":"download","rules":[{"t":"set","p":"topic","pt":"msg","to":"Download","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload.speeds.download","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":540,"wires":[["b61f1f5e.41d8b8","288318fc.e25458"]]},{"id":"b2a90ab2.32421","type":"change","z":"641677fe.7efb8","name":"upload","rules":[{"t":"set","p":"topic","pt":"msg","to":"Upload","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload.speeds.upload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":580,"wires":[["bd35f52c.df077","288318fc.e25458"]]},{"id":"dbc3c3e7.20861","type":"change","z":"641677fe.7efb8","name":"ping","rules":[{"t":"set","p":"topic","pt":"msg","to":"Ping","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload.server.ping","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":660,"wires":[["8b605dac.f72bd","1ee5385b.d78bb"]]},{"id":"6755d730.02674","type":"change","z":"641677fe.7efb8","name":"distance","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.server.distanceMi","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"Distance","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":700,"wires":[["4402db66.176ac4","1ee5385b.d78bb"]]},{"id":"a012c307.cb4028","type":"change","z":"641677fe.7efb8","name":"ISP","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.server.sponsor","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":740,"wires":[["ce98fa70.5faaa"]]},{"id":"9015ffc1.ef6a1","type":"ui_button","z":"641677fe.7efb8","name":"","group":"2a046f7e.21973","order":3,"width":0,"height":0,"label":"SpeedTest Now!","color":"","icon":"","payload":"","payloadType":"date","topic":"","x":190,"y":560,"wires":[["9e3f58fe.e530e"]]},{"id":"5493692d.1d584","type":"cronplus","z":"641677fe.7efb8","name":"5 minutes past the hour","outputField":"payload","timeZone":"","outputs":1,"options":[{"topic":"5 past every hour","payload":"start","type":"str","expression":"5 * * * *","name":"5 past every hour"}],"x":170,"y":640,"wires":[["9e3f58fe.e530e"]]},{"id":"aa219933.4c2e6","type":"template","z":"641677fe.7efb8","name":"SMS","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Internet speed was {{payload.speeds.download}}/{{payload.speeds.upload}} (down/up Mbits/s) at {{mytimes}} on {{mymonthn}}/{{mydom}}. Speedtest server was {{payload.server.sponsor}}.","output":"str","x":1010,"y":820,"wires":[["5b712b3b.4d3b0c"]]},{"id":"b61f1f5e.41d8b8","type":"ui_gauge","z":"641677fe.7efb8","name":"","group":"2a046f7e.21973","order":7,"width":0,"height":0,"gtype":"gage","title":"Download Speed","label":"Download Mbits","format":"{{value}}","min":0,"max":"150","colors":["#ff002d","#e4b400","#03f81f"],"seg1":"50","seg2":"100","x":930,"y":540,"wires":[]},{"id":"288318fc.e25458","type":"ui_chart","z":"641677fe.7efb8","name":"Performance Chart","group":"6dbda234.52c8cc","order":2,"width":12,"height":6,"label":"Performance Chart","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"86400","cutout":"","useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":930,"y":340,"wires":[["4860da2.4f503a4"]]},{"id":"bd35f52c.df077","type":"ui_gauge","z":"641677fe.7efb8","name":"","group":"2a046f7e.21973","order":8,"width":0,"height":0,"gtype":"gage","title":"Upload Speed","label":"Upload MBits","format":"{{value}}","min":0,"max":"15","colors":["#ff002d","#ffed36","#03f81f"],"seg1":"2","seg2":"8","x":920,"y":580,"wires":[]},{"id":"8b605dac.f72bd","type":"ui_text","z":"641677fe.7efb8","group":"2a046f7e.21973","order":4,"width":0,"height":0,"name":"","label":"Ping Time","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":910,"y":660,"wires":[]},{"id":"1ee5385b.d78bb","type":"ui_chart","z":"641677fe.7efb8","name":"Latency Chart","group":"6dbda234.52c8cc","order":4,"width":12,"height":6,"label":"Latency Chart","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"86400","cutout":"","useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":920,"y":460,"wires":[["84fc2070.d9275"]]},{"id":"4402db66.176ac4","type":"ui_text","z":"641677fe.7efb8","group":"2a046f7e.21973","order":5,"width":0,"height":0,"name":"","label":"Distance","format":"<font color=\"cyan\">{{msg.payload}} mi</font>","layout":"col-center","x":900,"y":700,"wires":[]},{"id":"ce98fa70.5faaa","type":"ui_text","z":"641677fe.7efb8","group":"2a046f7e.21973","order":2,"width":0,"height":0,"name":"","label":"Hosted By","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":910,"y":740,"wires":[]},{"id":"5b712b3b.4d3b0c","type":"e-mail","z":"641677fe.7efb8","server":"localhost","port":"25","secure":false,"tls":false,"name":"5042727138@msg.fi.google.com","dname":"SMS Notification","x":1190,"y":820,"wires":[]},{"id":"4860da2.4f503a4","type":"file","z":"641677fe.7efb8","name":"Speed Test Data Save","filename":"/home/odroid/.node-red/data/speedtest/speedtestData.json","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":1180,"y":340,"wires":[[]]},{"id":"976aad37.93366","type":"json","z":"641677fe.7efb8","name":"","x":1150,"y":280,"wires":[["288318fc.e25458"]]},{"id":"84fc2070.d9275","type":"file","z":"641677fe.7efb8","name":"Speed Test Data Save","filename":"/home/odroid/.node-red/data/speedtest/speedtestDataPD.json","appendNewline":false,"createDir":false,"overwriteFile":"true","x":1180,"y":420,"wires":[[]]},{"id":"1b6007eb.95fd98","type":"json","z":"641677fe.7efb8","name":"","x":1150,"y":520,"wires":[["1ee5385b.d78bb"]]},{"id":"559e7829.3d7fb","type":"file in","z":"641677fe.7efb8","name":"Speed Test Data Restore","filename":"/home/odroid/.node-red/data/speedtest/speedtestData.json","format":"utf8","x":1190,"y":380,"wires":[["976aad37.93366"]]},{"id":"1d72d587.de0bd2","type":"file in","z":"641677fe.7efb8","name":"Speed Test Data Restore","filename":"/home/odroid/.node-red/data/speedtest/speedtestDataPD.json","format":"utf8","x":1190,"y":460,"wires":[["1b6007eb.95fd98"]]},{"id":"e65149c6.542d","type":"inject","z":"641677fe.7efb8","name":"","repeat":"","crontab":"","once":true,"topic":"","payload":"restore","payloadType":"str","x":920,"y":400,"wires":[["559e7829.3d7fb","1d72d587.de0bd2"]]},{"id":"2a046f7e.21973","type":"ui_group","z":"","name":"Graphs","tab":"929d3236.90d2","order":1,"disp":false,"width":"6","collapse":false},{"id":"6dbda234.52c8cc","type":"ui_group","z":"","name":"Charts","tab":"929d3236.90d2","order":2,"disp":false,"width":"12","collapse":false},{"id":"929d3236.90d2","type":"ui_tab","z":"","name":"Internet Speed","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

13 Likes