Not really hub related but advice on how to monitor internet speed

That works, thanks!

1 Like

That's pretty cool. You're doing all the device I'd, and WiFi stuff that Fing does on that? I'd be interested in that, as while I like the Fingbox, it's definitely a Black Box connected to the cloud.

I'm using an EdgeRouter and its built in firewall, so I'm reluctant to mess with that, but the Fingbox functionality seems appealing, and that box looks like it could do a lot with a decent amount of ram and storage. And it's cheap!

S.

1 Like

No, not that. I am using the ARP and PING nodes to monitor device connectivity. I never really used the WiFi monitoring. But I will get the ability to keep devices off the internet when I install opnsense.

So I managed to get this working (thanks @aaiyar for sharing your flow json!), and can even get a pushover notification.

But the speedtest node seems to have download speeds consistently ~200-300 mbps less than what I see when running a test from speedtest.net in a chrome window on the same PC that's running my node red server.

Anyone else seeing something like that? Or have any ideas why? I tried the "single" and "multi" connection toggle in the web speedtest but that didn't make a difference.

Yup same here. Zero difference when I have Node-RED running on a NUC 7. There's a 50 mbps difference when I have it running on an Odroid N2.

Weird, I'm using a NUC as well, it's got an 8th gen i5 CPU, seems like that shouldn't be a limiting factor? I guess I could try to keep track of whether it's approximately a consistent speed below the web speedtest throughput, and adjust my cutoff point for the node red flow accordingly.

Anyway, thanks again for clueing us into the speedtest node!

1 Like

I have a total NOOB questions (since i'm 2 weeks new lol). what is this "flow" view? Thank you. Don't be too hard on me LOL

It's not a part of Hubitat per se, it's Node-RED, a very powerful tool for tying together a ton of IoT and other LAN/WAN connected devices, servers, APIs etc. It's possible to integrate Hubitat with node-red in various ways, there are a lot of forum threads that delve into the details.

https://nodered.org/

3 Likes

fantastic.. thanks for sharing the info!!!

1 Like

If you decide to go down that wormhole, the minimal additional hardware you'll need is a Raspberry Pi.

As @marktheknife said, there are multiple threads on the forum, but here's a couple good ones to start with:

1 Like

Or a docker container running on a NAS, or it can run natively on Windows :slight_smile:.

3 Likes

@marktheknife

I've been using a modified version this sequence for a couple days. The output is pasted above.

https://flows.nodered.org/flow/e3e8c7f4807f383ab85d61ff2dfda208

1 Like

Wow, this looks cool.

I'm still pretty dumb when it comes to node-red though. Can I simply remove that "call speedtest cli" node and substitute it with the node-red-contrib-speedtest node?

I haven't tried that. But you can install speedtest-cli with (apt-get install speedtest) - assuming you have something based off Debian on your NUC8.

Edit: That won't work. However, it can be done by modifying the sequence - replacing the function node with a bunch of change nodes and the exec node (call speedtest-cli) with the speedtest node. I won't get a chance to post it today, but I'll try to get it done tomorrow.

1 Like

thanks! Looking forward to trying that out whenever you get a chance. I just tried removing the call speedtest-cli exec node and putting the speedtest node in its place. Definitely didn't work.

@marktheknife

I got impatient. Here you go - you can import this sequence and it should work like the previous one, except it uses the speedtest node. Before you import it, you will have to install the simpletime node (if you don't have it):

Speed test sequence with speedtest node

[{"id":"fd9f742c.8b63c8","type":"file","z":"38287a9c.ed6b16","name":"Speed Test Data Save","filename":"speedtestData.json","appendNewline":false,"createDir":false,"overwriteFile":"true","x":1316.5,"y":307,"wires":[[]]},{"id":"5f6cea04.d3fee4","type":"ui_chart","z":"38287a9c.ed6b16","name":"Performance Chart","group":"6dbda234.52c8cc","order":2,"width":0,"height":0,"label":"Performance Chart","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"604800","cutout":"","useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":1086.5,"y":327.6666564941406,"wires":[["fd9f742c.8b63c8"]]},{"id":"396bf742.f9d9","type":"change","z":"38287a9c.ed6b16","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":760,"y":440,"wires":[["5e653827.8785","5f6cea04.d3fee4"]]},{"id":"6acde784.b9637","type":"change","z":"38287a9c.ed6b16","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":750,"y":480,"wires":[["e9d19890.e768","5f6cea04.d3fee4"]]},{"id":"c6ceb4b4.b89518","type":"json","z":"38287a9c.ed6b16","name":"","x":1280.5,"y":251,"wires":[["5f6cea04.d3fee4"]]},{"id":"26548c9f.0a8ae4","type":"speedtest","z":"38287a9c.ed6b16","name":"Speedtest","serverId":"","maxTime":"120000","x":490,"y":500,"wires":[["396bf742.f9d9","6acde784.b9637","de54e40c.adbb6","172c2780.bc60a9","49bd430f.a2ce7c"]]},{"id":"5e653827.8785","type":"ui_gauge","z":"38287a9c.ed6b16","name":"","group":"2a046f7e.21973","order":6,"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":1070,"y":540,"wires":[]},{"id":"e9d19890.e768","type":"ui_gauge","z":"38287a9c.ed6b16","name":"","group":"2a046f7e.21973","order":7,"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":1069.5,"y":593,"wires":[]},{"id":"746fb82b.bef8","type":"file in","z":"38287a9c.ed6b16","name":"Speed Test Data Restore","filename":"speedtestData.json","format":"utf8","x":1319.5,"y":360,"wires":[["c6ceb4b4.b89518"]]},{"id":"de54e40c.adbb6","type":"change","z":"38287a9c.ed6b16","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":750,"y":560,"wires":[["7be6dd65.0679a4","246ebc72.ad1ffc"]]},{"id":"172c2780.bc60a9","type":"change","z":"38287a9c.ed6b16","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":760,"y":600,"wires":[["b6118169.72dc48","246ebc72.ad1ffc"]]},{"id":"49bd430f.a2ce7c","type":"change","z":"38287a9c.ed6b16","name":"ISP","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.server.sponsor","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":640,"wires":[["462b8881.bf2868"]]},{"id":"3a9fda45.9290c6","type":"rbe","z":"38287a9c.ed6b16","name":"","func":"rbe","gap":"","start":"","inout":"out","x":487,"y":400,"wires":[["26548c9f.0a8ae4","32a441c6.6008c6"]]},{"id":"215587eb.e0e4a8","type":"ui_button","z":"38287a9c.ed6b16","name":"","group":"2a046f7e.21973","order":2,"width":0,"height":0,"label":"SpeedTest Now!","color":"","icon":"","payload":"","payloadType":"date","topic":"","x":240,"y":540,"wires":[["26548c9f.0a8ae4","32a441c6.6008c6"]]},{"id":"1122ef5f.e68229","type":"inject","z":"38287a9c.ed6b16","name":"","topic":"","payload":"restore","payloadType":"str","repeat":"","crontab":"","once":true,"x":1052.5,"y":392,"wires":[["746fb82b.bef8","6facbb75.c62ad4"]]},{"id":"7be6dd65.0679a4","type":"ui_text","z":"38287a9c.ed6b16","group":"2a046f7e.21973","order":3,"width":0,"height":0,"name":"","label":"Ping Time","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":1051.5,"y":688,"wires":[]},{"id":"246ebc72.ad1ffc","type":"ui_chart","z":"38287a9c.ed6b16","name":"Latency Chart","group":"6dbda234.52c8cc","order":1,"width":0,"height":0,"label":"Latency Chart","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"604800","cutout":"","useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":1080,"y":440,"wires":[["d699828f.59d9d8"]]},{"id":"b6118169.72dc48","type":"ui_text","z":"38287a9c.ed6b16","group":"2a046f7e.21973","order":4,"width":0,"height":0,"name":"","label":"Distance","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":1049.5,"y":727,"wires":[]},{"id":"462b8881.bf2868","type":"ui_text","z":"38287a9c.ed6b16","group":"2a046f7e.21973","order":1,"width":0,"height":0,"name":"","label":"Hosted By","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":1061,"y":765,"wires":[]},{"id":"c33c2e19.b1a018","type":"function","z":"38287a9c.ed6b16","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":350,"y":400,"wires":[["3a9fda45.9290c6"]]},{"id":"32a441c6.6008c6","type":"delay","z":"38287a9c.ed6b16","name":"2 mins","pauseType":"delay","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":490,"y":540,"wires":[["106aee5e.e0264a"]]},{"id":"6facbb75.c62ad4","type":"file in","z":"38287a9c.ed6b16","name":"Speed Test Data Restore","filename":"speedtestDataPD.json","format":"utf8","x":1319,"y":452,"wires":[["75617693.7c66f"]]},{"id":"d699828f.59d9d8","type":"file","z":"38287a9c.ed6b16","name":"Speed Test Data Save","filename":"speedtestDataPD.json","appendNewline":false,"createDir":false,"overwriteFile":"true","x":1311,"y":403,"wires":[[]]},{"id":"75617693.7c66f","type":"json","z":"38287a9c.ed6b16","name":"","x":1285.5,"y":519,"wires":[["246ebc72.ad1ffc"]]},{"id":"ca1ce4c5.db7db8","type":"inject","z":"38287a9c.ed6b16","name":"Second Tick","topic":"","payload":"","payloadType":"date","repeat":"60","crontab":"","once":false,"onceDelay":"","x":180,"y":400,"wires":[["c33c2e19.b1a018"]]},{"id":"106aee5e.e0264a","type":"simpletime","z":"38287a9c.ed6b16","name":"","x":490,"y":580,"wires":[["3c9ecd69.3628da"]]},{"id":"3c9ecd69.3628da","type":"template","z":"38287a9c.ed6b16","name":"time","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{mydate}} {{mytimes}}","output":"str","x":750,"y":520,"wires":[["d6650ca2.aff488"]]},{"id":"d6650ca2.aff488","type":"ui_text","z":"38287a9c.ed6b16","group":"2a046f7e.21973","order":5,"width":0,"height":0,"name":"Last Speedtest","label":"Last Speedtest","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":1068,"y":642,"wires":[]},{"id":"6dbda234.52c8cc","type":"ui_group","z":"","name":"Charts","tab":"929d3236.90d2","order":2,"disp":true,"width":"10","collapse":true},{"id":"2a046f7e.21973","type":"ui_group","z":"","name":"Graphs","tab":"929d3236.90d2","order":1,"disp":true,"width":"6","collapse":true},{"id":"929d3236.90d2","type":"ui_tab","z":"","name":"Internet Speed","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

:metal: I’m gonna try it out in a min.

1 Like

hmm, I'm seeing an error in the debug console from the "speedtest data restore" nodes:

"Error: ENOENT: no such file or directory, open 'C:\Windows\system32\speedtestData.json'"

And then after the flow tried to execute (looks like the speedtest node itself was working), errors from the "speedtest data save" nodes:

"failed to write to file: Error: EPERM: operation not permitted, open 'C:\Windows\system32\speedtestData.json'"

Edit: I'm not sure if I need to point the restore and save nodes to a different path so they don't default to that Windows directory? Or maybe check the "create directory if it doesn't exist" option to allow the save nodes to create those json files?

1 Like

I don't use Windows, but I know what's going on, and it is fixable. The sequence needs to create two files:

speedtestData.json
speedtestDataPD.json

On Windows, it is trying to create this in a directory that Node-RED doesn't have write permissions for (C:\Windows\system32).

To fix it, you need to open the two file nodes and the two file-in nodes (i.e, these four)

Screen Shot 2020-05-20 at 13.49.34

and change

speedtestData.json
speedtestDataPD.json

to something like:

C:\mark_directory\home\desktop

(Whatever your home directory is. You can put the files on your Desktop for example).

And then it will work for sure.