HowTo: Node Red – Show internet connection information in the dashboard

The following article explains how you can view information about your Internet connection. The current Internet IP address is retrieved every hour and a speed test is carried out to show you the download and upload speed.


Safety instructions

I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/

Affiliate links/advertising links

The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂 


Requirements

Helpful articles:
So that you can install new nodes, NodeRed should of course already be installed.
How to prepare a RaspberryPi and then install NodeRed on it is described in the following articles.

The following three articles describe what needs to be done to prepare the RaspberryPi:
RaspberryPi – setup for nerdiys!
RaspberryPi – The first configuration!
RaspberryPi – Control the RaspberryPi via SSH

NodeRed – Installing NodeRed on the RaspberryPi
NodeRed – Install new nodes
NodeRed - Create a user interface with dashboard nodes

Required tool:
-no-

Required material:

In the following list you will find all the parts you need to implement this article.


Log into the NodeRed configuration interface

Before you can edit your NodeRed configuration, you must - if activated - first log into the NodeRed configuration interface.

View of the login dialog. Here you have to enter the login data that you specified during the configuration of the login. You can find information about this in the article NodeRed - set up user login.

Install Speedtest Node

First you need to install the node that will perform the speed test for you.
To do this, install the node "node-red-contrib-speedtest".
How to install nodes is described in this article:
NodeRed – Install new nodes


Node code for speed test display

After you have inserted the node code below, you only need to position the dashboard elements correctly on your dashboard. You can also find information on this in the article NodeRed - Create a user interface with dashboard nodes.

You can run the speed test manually using the "Run speed test" inject node. Don't be surprised if you don't get an immediate evaluation, the speed test takes a few seconds.
You can also set the query interval for the Internet data in the inject node. I would not choose a query interval that is too short, as the test server may block too frequent queries at some point. In addition, you would also "block" your own Internet connection with the frequent speed tests.

This is how the Internet data could be displayed in your dashboard.
This is what the flow looks like in the configuration menu.

The following node code contains the configuration shown above.

[{"id":"6ba1b514.1a8ffc","type":"inject","z":"bcba3320.cf832","name":"Run speed test","topic":"","payload": "","payloadType":"date","repeat":"3600","crontab":"","once":false,"onceDelay":0.1,"x":460,"y":1880, "wires":[["d8c672a4.02c62"]]},{"id":"60085e2a.ceb88","type":"debug","z":"bcba3320.cf832","name":"" ,"active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":910,"y":1960,"wires":[ ]},{"id":"d8c672a4.02c62","type":"speedtest","z":"bcba3320.cf832","name":"","maxTime":5000,"x":660 ,"y":1880,"wires":[["60085e2a.ceb88","7166b0b4.0fb4e","559c3c96.63f474","9e7a000d.72622","7efb5657.f7c238"]]},{"id" :"7efb5657.f7c238","type":"change","z":"bcba3320.cf832","name":"IP address","rules":[{"t":"set"," p":"payload","pt":"msg","to":"payload.client.ip","tot":"msg"}],"action":"","property":"" ,"from":"","to":"","reg":false,"x":930,"y":1800,"wires":[["528c8196.97579"]]},{" id":"9e7a000d.72622","type":"change","z":"bcba3320.cf832","name":"Download speed","rules":[{"t":"set " ,"p":"payload","pt":"msg","to":"payload.speeds.download","tot":"msg"}],"action":"","property": "","from":"","to":"","reg":false,"x":950,"y":1840,"wires":[["68c5b12e.30c4f"]]}, {"id":"559c3c96.63f474","type":"change","z":"bcba3320.cf832","name":"Upload speed","rules":[{"t": "set","p":"payload","pt":"msg","to":"payload.speeds.upload","tot":"msg"}],"action":""," property":"","from":"","to":"","reg":false,"x":940,"y":1880,"wires":[["bdd0dacf.8f0bc8"] ]},{"id":"7166b0b4.0fb4e","type":"change","z":"bcba3320.cf832","name":"Ping","rules":[{"t": "set","p":"payload","pt":"msg","to":"payload.server.ping","tot":"msg"}],"action":""," property":"","from":"","to":"","reg":false,"x":910,"y":1920,"wires":[["c0dd272d.26b458"] ]},{"id":"528c8196.97579","type":"ui_text","z":"bcba3320.cf832","group":"56d04a8f.ecd7a4","order":0,"width ":0,"height":0,"name":"","label":"Internet IP address:","format":"{{msg.payload}}","layout":"row -spread","x":1320,"y":1800,"wires":[]},{"id":"68c5b12e.30c4f","type":"ui_text","z":"bc ba3320.cf832","group":"56d04a8f.ecd7a4","order":0,"width":0,"height":0,"name":"","label":"Download speed:" ,"format":"{{msg.payload}}Mbps","layout":"row-spread","x":1340,"y":1840,"wires":[]},{"id" :"bdd0dacf.8f0bc8","type":"ui_text","z":"bcba3320.cf832","group":"56d04a8f.ecd7a4","order":0,"width":0,"height" :0,"name":"","label":"Upload speed:","format":"{{msg.payload}}Mbps","layout":"row-spread","x": 1330,"y":1880,"wires":[]},{"id":"c0dd272d.26b458","type":"ui_text","z":"bcba3320.cf832","group":" 56d04a8f.ecd7a4","order":0,"width":0,"height":0,"name":"","label":"Ping:","format":"{{msg.payload} }ms","layout":"row-spread","x":1270,"y":1920,"wires":[]},{"id":"56d04a8f.ecd7a4","type":" ui_group","z":"","name":"System","tab":"77aad24e.6a657c","disp":true,"width":"6","collapse":false},{ "id":"77aad24e.6a657c","type":"ui_tab","z":"","name":"Settings","icon":"dashboard"}]

Have fun with the project

I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂

PS Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂

Buy Me a Coffee at ko-fi.com       

7 comments

  1. Hello,
    the speed test worked wonderfully for a long time.
    Since 03.09.2022 there are no more values and the node 'Speedtest' shows the following message:
    "Error: No server found, verify your proxy/network".

    Do you know what could be causing this behavior? I sent the query every 15 minutes, was that too short?

    Thanks and regards

    Martin

    1. Hi Martin,
      I've just tried it. It didn't work for me either (anymore).
      This is probably due to an old version. After I updated the node via the palette manager (and restarted NodeRed) it works again.
      But first you have to accept the data protection rules (setting in the Speedtest Node).
      Hope it works for you too. 🙂
      Best regards
      Fabian

  2. Hi Fabian,

    Thank you for your quick response.
    I've been trying to update all evening.
    1) Update did not work
    2) Now 'node-red-contrib-speedtest' is greyed out and cannot be uninstalled either. Neither from the palette management nor via the console 'npm uninstall node-red-contrib-speedtest'.

    I run Node-Red on a Raspberry with Debian.

    greeting

    Martin

  3. Hi Fabian,

    solved: I removed the Speedtest section in the '.node-red/.config.nodes.json' file, stopped and restarted Node-Red, installed Speedtest via the palette management, now it works.

    Thank you for your support.

    Greetings
    Martin

  4. Hello,

    which are the last nodes on your pic or also in your code?

    with me it says that these do not exist

    Greeting

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert

This site uses Akismet to reduce spam. Learn how your comment data is processed.