Ookla Speedtest CLI integration

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

joosty
Posts: 2
Joined: Saturday 28 March 2020 10:19
Target OS: Raspberry Pi / ODroid
Domoticz version: v2020.01
Location: Netherlands
Contact:

Ookla Speedtest CLI integration

Post by joosty »

Have been using the speedtest-cli integration for some years, but yesterday swapped to the "speedtest" CLI provided by Ookla. The original speedtest-cli worked well, except for the latency/ping measurements. The Ookla speedtest does measure the ping correctly, so therefore a step forward.

Please note that you can't have them both installed at same time ;-)

Maybe this info saves some other people a bit of time to get this running.

1) create dummy sensors

2) store scripts somewhere (e.g. ~/domoticz/scripts)
see below for content

3) modify IDXs in script with IDXs of your virtual sensors

4a) remove speedtest-cli (if installed)
sudo apt-get remove speedtest-cli

4b) install speedtest from Ookla,
see https://www.speedtest.net/apps/cli (see Ubuntu/Debian)
check it works

5) install jq
sudo apt-get install jq)

6) verify the script works
check the port on which domoticz runs ;-)

7) create a crontab entry to schedule it.
#speedtest
5,20,35,50 * * * * ~/domoticz/scripts/ooklaspeed.sh > /dev/null 2>&1
Speedtest.jpg
Speedtest.jpg (99.89 KiB) Viewed 11722 times
speedtest trend.jpg
speedtest trend.jpg (121.03 KiB) Viewed 11722 times
------------script content----------------------
#!/bin/bash
# make sure jq is installed
# sudo apt-get install jq

# define domoticz connection
host=127.0.0.1
port=80

# define ids for domoticz sensors
idxpng=69
idxul=70
idxdl=71
idxjit=122

# define location for file
file=~/ookla.json

# execute the speedtest and store result.
speedtest -f json-pretty > $file

downraw=$(jq -r '.download.bandwidth' $file)
download=$(printf %.2f\\n "$((downraw * 8))e-6")

upraw=$(jq -r '.upload.bandwidth' $file)
upload=$(printf %.2f\\n "$((upraw * 8))e-6")

png=$(jq -r '.ping.latency' $file)

jit=$(jq -r '.ping.jitter' $file)

#output if you run it manually
echo "download = $download Mbps"
echo "upload =  $upload Mbps"
echo "ping =  $png ms"
echo "jitter = $jit ms"

# upload result to Domiticz
curl "http://$host:$port/json.htm?type=command&param=udevice&idx=$idxdl&svalue=$download" > /dev/null 2>&1
curl "http://$host:$port/json.htm?type=command&param=udevice&idx=$idxul&svalue=$upload" > /dev/null 2>&1
curl "http://$host:$port/json.htm?type=command&param=udevice&idx=$idxpng&svalue=$png" > /dev/null 2>&1
curl "http://$host:$port/json.htm?type=command&param=udevice&idx=$idxjit&svalue=$jit" > /dev/null 2>&1
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Ookla Speedtest CLI integration

Post by FireWizard »

Hello,

@joosty.

Good initiative, as the Ookla Speedtest uses a much more modern approach then the speedtest-cli, developed by Sivel and used in @xorfor's plugin.
Be aware that the version in the (Buster) repositories contains a bug.

See: viewtopic.php?f=6&t=31267&p=236103&hili ... st#p236103

Another issue is that from time to time we all get faster internet, because of the competition between the providers.
Be aware that the measurements are not influenced by the speed of your Ethernet port.
You can't measure a "Download" speed of 500 Mbps with e.g. a Raspberry Pi 3B+ or lower.
See: https://magpi.raspberrypi.org/articles/ ... benchmarks

As the provider recently upgraded my "Download" speed from 100 Mbps to 200 Mbps, my Raspberry Pi 2B throttled the results.
I installed The Ookla Speedtest directly on my router/gateway and pushes the results with MQTT to Domoticz.
If someone is interested in the solution and the simple Node Red flow, let me know.

Screenshot_Speedtest_Ookla.png
Screenshot_Speedtest_Ookla.png (135.74 KiB) Viewed 11711 times
Regards
Last edited by FireWizard on Monday 06 December 2021 16:14, edited 1 time in total.
joosty
Posts: 2
Joined: Saturday 28 March 2020 10:19
Target OS: Raspberry Pi / ODroid
Domoticz version: v2020.01
Location: Netherlands
Contact:

Re: Ookla Speedtest CLI integration

Post by joosty »

I am on VDSL, where every provider is having issues to even provide a stable 50 Mbps. I mainly use the speedtest graphs to address issues with the ISPs.

I have raspberry 3b and I know from the unifi controller it can deliver around 80 Mbps on ethernet. Being stuck on VDSL that will be more then enough for coming years :cry:
Bigted
Posts: 68
Joined: Friday 12 December 2014 14:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Contact:

Re: Ookla Speedtest CLI integration

Post by Bigted »

FireWizard wrote: Saturday 28 March 2020 16:43

As the provider recently upgraded my "Download" speed from 100 Mbps to 200 Mbps, my Raspberry Pi 2B throttled the results.
I installed The Ookla Speedtest directly on my router/gateway and pushes the results with MQTT to Domoticz.
If someone is interested in the solution and the simple Node Red flow, let me know.


Regards
Can you post how you did that, I tried running Speedtest from my PI but it is being throttled
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Ookla Speedtest CLI integration

Post by FireWizard »

Hi,

@Bigted wrote:
Can you post how you did that, I tried running Speedtest from my PI but it is being throttled
Of course I can and I will do so :D .

As said, especially older versions of the Raspberry Pi, will, because of the limitation of their Ethernet port, throttle the results of the speedtest application, if used with high speed networks.
Therefore it might not be useful to run speedtest-cli, as provided by Sivel (https://github.com/sivel/speedtest-cli) to run on older models of RPi.
Do not use the speedtest-cli, as installed from the repo, as it contains a bug.

To have the most reliable result from Speedtest, which is not influenced by other hardware, such as switches, etc, it is recommended to install the test on a device with direct connection to your internet modem/router. Of course the Ethernet port of that device should be capable of handling the download and upload speed. Perhaps you can install it on your router/gateway.

In my case I have installed it on a ClearOS (CentOS based) server, running on a HP Microserver GEN 8. This is Linux based!
You can download the OOKLA Speedtest at: https://www.speedtest.net/apps/cli and choose your platform.

Install the program for your platform and run it once installed. The first time, you have to accept the license. The key is stored on your machine and you don't have to bother about it.

As I have running this program on a Linux based machine and as I wanted to have the data published on my MQTT server, you have to install, at least, mosquitto_pub on your hardware. This is part of the mosquitto_client package, but may differ for your platform.

I wanted to have the same functionality as provided by xorfor's python script for Domoticz. So that means 3 sensors for resp. Ping, Download speed and Upload speed. In addition 1 push button to activate the test manually.

For the last function I needed another program, called mqtt-launcher, provided by J.P. Mens: https://github.com/jpmens/mqtt-launcher.
Install also the requirements for this program. See the README file.

I copied this program in the directory /usr/local/bin.
If you do not need/want the manual push-button in Domoticz, you do not need to install mqtt-launcher.
In this case you have to activate the speedtest by means off a cronjob.

In the same directory I created a script file, called speedtest2mqtt.sh.

The contents of this file (I included also the "help" file of speedtest in it) is as follows:

Code: Select all

#!/bin/bash

# Speedtest by Ookla is the official command line client for testing the speed and performance of your internet connection.
#
# Version: speedtest 1.0.0.2
#
# Usage: speedtest [<options>]
#  -h, --help                        Print usage information
#  -V, --version                     Print version number
#  -L, --servers                     List nearest servers
#  -s, --server-id=#                 Specify a server from the server list using its id
#  -I, --interface=ARG               Attempt to bind to the specified interface when connecting to servers
#  -i, --ip=ARG                      Attempt to bind to the specified IP address when connecting to servers
#  -o, --host=ARG                    Specify a server, from the server list, using its host's fully qualified domain name
#  -p, --progress=yes|no             Enable or disable progress bar (Note: only available for 'human-readable'
#                                    or 'json' and defaults to yes when interactive)
#  -P, --precision=#                 Number of decimals to use (0-8, default=2)
#  -f, --format=ARG                  Output format (see below for valid formats)
#  -u, --unit[=ARG]                  Output unit for displaying speeds (Note: this is only applicable
#                                    for ‘human-readable’ output format and the default unit is Mbps)
#  -a                                Shortcut for [-u auto-decimal-bits]
#  -A                                Shortcut for [-u auto-decimal-bytes]
#  -b                                Shortcut for [-u auto-binary-bits]
#  -B                                Shortcut for [-u auto-binary-bytes]
#      --selection-details           Show server selection details
#      --ca-certificate=ARG          CA Certificate bundle path
#  -v                                Logging verbosity. Specify multiple times for higher verbosity
#      --output-header               Show output header for CSV and TSV formats
#
# Valid output formats: human-readable (default), csv, tsv, json, jsonl, json-pretty
#
# Machine readable formats (csv, tsv, json, jsonl, json-pretty) use bytes as the unit of measure with max precision
#
# Valid units for [-u] flag: 
#   Decimal prefix, bits per second:  bps, kbps, Mbps, Gbps
#   Decimal prefix, bytes per second: B/s, kB/s, MB/s, GB/s
#   Binary prefix, bits per second:   kibps, Mibps, Gibps
#   Binary prefix, bytes per second:  kiB/s, MiB/s, GiB/s
#   Auto-scaled prefix: auto-binary-bits, auto-binary-bytes, auto-decimal-bits, auto-decimal-bytes
#
# Script to push speedtest results to mqtt server (Mosquitto)
# Uses mosquitto_pub
# In order to use crontab use full path

/usr/bin/speedtest --format=json | /usr/bin/mosquitto_pub -L mqtt://user:password@<IP_address>:1883/speedtest/status -s
Insert your own IP address of the MQTT server after @. If you have protected your MQTT server with a username and password, insert this as well.
This will publish the data to your MQTT server under the topic speedtest/status. You can change that, if you want it.

In case you have choosen to use the manual activation button in Domoticz you have to configure "launcher.conf", which is used by mqtt-launcher.
See also the installed example file.

The contents of this file is as follows:

Code: Select all

logfile         = '/usr/local/bin/mqtt-launcher.log'
mqtt_broker     = 'IP_address'                 # default: 'localhost'. If using TLS, this must be set to the domain name signed by your TLS certificate.
mqtt_port       = 1883                         # default: 1883
mqtt_clientid   = 'mqtt-launcher-2'
mqtt_username   = 'user'
mqtt_password   = 'password'
mqtt_tls        = None                         # default: No TLS

topiclist = {

    # topic                     payload value           program & arguments

    "speedtest/cmd":            {
                                     'on'               :   [ '/usr/local/bin/speedtest2mqtt.sh' ],
                                },
}
Insert your IP adress between ' ' and if you have your MQTT server protected insert username and password between ' '.

In the directory /user/local/bin I have now the following programs:

Code: Select all

-rw-r--r-- 1 root root    689 Feb 14 16:49 launcher.conf
-rw-r--r-- 1 root root   1732 Feb 13 19:09 launcher.conf.example
-rw-r--r-- 1 root root    286 Feb 14 16:47 mqtt-launcher
-rw-r--r-- 1 root root 133309 Mar 29 16:00 mqtt-launcher.log
-rwxr-xr-x 1 root root   5234 Feb 13 19:09 mqtt-launcher.py
-rw-r--r-- 1 root root   3925 Feb 13 19:09 README.md
-rwxr-xr-x 1 root root   2790 Feb 15 14:10 speedtest2mqtt.sh
The next step is to prepare the flow in Node Red.

The flow in Node Red consist of two parts.

1. The incoming flow from your device, that runs speedtest, to Domoticz (Upper part)
2. The outgoing flow from Domoticz and Node Red to activate the speedtest-cli command (Lower part)

If you do not want to use the push button in Domoticz, you do not need the Lower part of the flow.
However in this case, you have to setup a cronjob in the device, which has speedtest-cli installed

Screenshot_speedtest flow1.png
Screenshot_speedtest flow1.png (27.93 KiB) Viewed 11668 times
1. Incoming flow

The first node is a MQTT input node. You have to insert the topic, that you use in the mosquitto_publish command on the device, that has
speedtest-cli installed. In this case speedtest/status.

Screenshot_speedtest flow2.png
Screenshot_speedtest flow2.png (18.67 KiB) Viewed 11668 times
The JSON node has its default configuration followed by the Function node, with the following contents:

Code: Select all

var msg1 ={};
var msg2 ={};
var msg3 ={};
msg1.payload = {"command":"udevice","idx":119,"nvalue":0,"svalue":msg.payload.ping.latency.toString()};
msg2.payload = {"command":"udevice","idx":120,"nvalue":0,"svalue":(parseFloat((msg.payload.download.bytes*8/msg.payload.download.elapsed)/1000).toFixed(3)).toString()};
msg3.payload = {"command":"udevice","idx":121,"nvalue":0,"svalue":(parseFloat((msg.payload.upload.bytes*8/msg.payload.upload.elapsed)/1000).toFixed(3)).toString()};
return [[msg1,msg2,msg3]];
The outgoing node is a MQTT output node.

Do not forget, if you have not done yet, to configure Domoticz with the right custom sensors and replace the idx numbers with your idx's.

The next part is in a next post.
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Ookla Speedtest CLI integration

Post by FireWizard »

If you have decided to include the push button in Domoticz, you need the lower part of the flow as well.

The first node is the default MQTT Output node, which is subscribed to domoticz/out, followed by the default JSON node.
The next node is anon-default node, that has to be installed from the palette.
This node filters the idx of the push button in Node Red. So check that idx number.

Install this node: node-red-contrib-filter.

It is configured as follows:

Screenshot_speedtest flow3.png
Screenshot_speedtest flow3.png (16.53 KiB) Viewed 11666 times

Replace the idx number with your idx.

The next node is a function node to send the correct data to the device, that has mqtt-launcher and speedtest-cli installed.
The contents is as follows:

Code: Select all

if (msg.payload.nvalue === 1) {
    msg.payload = "on";
}
return msg;
This payload is send to a MQTT Output node, which is configured as follows:

Screenshot_speedtest flow4.png
Screenshot_speedtest flow4.png (21.82 KiB) Viewed 11666 times
This flow sends the push button command to your device, that has speedtest-cli installed.

The regular timing is done by an inject node that injects the correct payload to the same MQTT Output node.
It is configured as follows:

Screenshot_speedtest flow5.png
Screenshot_speedtest flow5.png (33 KiB) Viewed 11666 times
Below you will find the complete flows:

Code: Select all

[{"id":"8395ba46.a4eb1","type":"mqtt in","z":"ab5ccf37.8faeb8","name":"Server Speedtest In","topic":"speedtest/status","qos":"0","datatype":"auto","broker":"f9f13036.e28b58","x":190,"y":100,"wires":[["2eb9c765.43fa"]]},{"id":"2eb9c765.43fa","type":"json","z":"ab5ccf37.8faeb8","name":"","property":"payload","action":"","pretty":false,"x":390,"y":100,"wires":[["813c9c3b.7fb578"]]},{"id":"813c9c3b.7fb578","type":"function","z":"ab5ccf37.8faeb8","name":"To Domoticz","func":"var msg1 ={};\nvar msg2 ={};\nvar msg3 ={};\nmsg1.payload = {\"command\":\"udevice\",\"idx\":119,\"nvalue\":0,\"svalue\":msg.payload.ping.latency.toString()};\nmsg2.payload = {\"command\":\"udevice\",\"idx\":120,\"nvalue\":0,\"svalue\":(parseFloat((msg.payload.download.bytes*8/msg.payload.download.elapsed)/1000).toFixed(3)).toString()};\nmsg3.payload = {\"command\":\"udevice\",\"idx\":121,\"nvalue\":0,\"svalue\":(parseFloat((msg.payload.upload.bytes*8/msg.payload.upload.elapsed)/1000).toFixed(3)).toString()};\nreturn [[msg1,msg2,msg3]];","outputs":1,"noerr":0,"x":570,"y":100,"wires":[["ed6c10df.d23618"]]},{"id":"ed6c10df.d23618","type":"mqtt out","z":"ab5ccf37.8faeb8","name":"Domoticz In","topic":"domoticz/in","qos":"2","retain":"false","broker":"f9f13036.e28b58","x":770,"y":100,"wires":[]},{"id":"ec89ae7.ce185d","type":"mqtt in","z":"ab5ccf37.8faeb8","name":"Domoticz Out","topic":"domoticz/out","qos":"2","datatype":"auto","broker":"f9f13036.e28b58","x":170,"y":220,"wires":[["8f15b75e.0a94e"]]},{"id":"451753bf.8d4d14","type":"filter","z":"ab5ccf37.8faeb8","name":"Filter Button","property":"payload.idx","propertyType":"msg","asArray":false,"itemProperty":"","itemPropertyType":"item","rules":[{"t":"eq","v":"122","vt":"num","output":1}],"checkall":"true","outputs":1,"x":530,"y":220,"wires":[["d6e722d6.125e5"]]},{"id":"8f15b75e.0a94e","type":"json","z":"ab5ccf37.8faeb8","name":"","property":"payload","action":"","pretty":false,"x":350,"y":220,"wires":[["451753bf.8d4d14"]]},{"id":"d6e722d6.125e5","type":"function","z":"ab5ccf37.8faeb8","name":"To Speedtest","func":"if (msg.payload.nvalue === 1) {\n    msg.payload = \"on\";\n}\nreturn msg;","outputs":1,"noerr":0,"x":740,"y":220,"wires":[["64d59364.f1eb74"]]},{"id":"64d59364.f1eb74","type":"mqtt out","z":"ab5ccf37.8faeb8","name":"Server Speedtest Out","topic":"speedtest/cmd","qos":"0","retain":"false","broker":"f9f13036.e28b58","x":980,"y":220,"wires":[]},{"id":"681cf784.d0b4d8","type":"inject","z":"ab5ccf37.8faeb8","name":"Hourly Speedtest ","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"0 0-23 * * *","once":false,"onceDelay":0.1,"x":730,"y":160,"wires":[["64d59364.f1eb74"]]},{"id":"f9f13036.e28b58","type":"mqtt-broker","z":null,"name":"RPI1_ MQTT_Broker","broker":"192.168.10.51","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
In case of questions, do not hesitate to ask.

Regards
Z0eff
Posts: 3
Joined: Thursday 30 January 2020 16:04
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Ookla Speedtest CLI integration

Post by Z0eff »

This looks interesting! Is there a way to only measure ping and jitter? (Video streams will buffer whenever a download test is being performed)
-- Z0eff
HW: Pi4B w/ Aeotec Z-Stick Gen5 and HANK/Fibaro/Qubino Smart Plugs
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Ookla Speedtest CLI integration

Post by FireWizard »

HI,

@Z0eff

You wrote:
Is there a way to only measure ping and jitter?
No, unfortunately not. The OOKLA speed test command line tool has no option to exclude the download and/or the upload test.

However, the python script from Sivel has that option.
See: https://github.com/sivel/speedtest-cli

Do not install this tool from the repos, as there is a bug. See above.

Regards
Z0eff
Posts: 3
Joined: Thursday 30 January 2020 16:04
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Ookla Speedtest CLI integration

Post by Z0eff »

FireWizard wrote: Thursday 28 May 2020 19:52 HI,

@Z0eff

You wrote:
Is there a way to only measure ping and jitter?
No, unfortunately not. The OOKLA speed test command line tool has no option to exclude the download and/or the upload test.

However, the python script from Sivel has that option.
See: https://github.com/sivel/speedtest-cli

Do not install this tool from the repos, as there is a bug. See above.

Regards
It doesn't look like that tool measures jitter though :(
-- Z0eff
HW: Pi4B w/ Aeotec Z-Stick Gen5 and HANK/Fibaro/Qubino Smart Plugs
grutter
Posts: 1
Joined: Friday 20 March 2020 21:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ookla Speedtest CLI integration

Post by grutter »

thanks for post! two remarks
joosty wrote: Saturday 28 March 2020 16:15
4a) remove speedtest-cli (if installed)
sudo apt-get remove speedtest-cli
had installed speedtest via:
https://pimylifeup.com/raspberry-pi-int ... d-monitor/

uninstall speedtest:
sudo pip3 uninstall speedtest-cli

changed script for running once:
speedtest --accept-license --accept-gdpr -f json-pretty > $file
SavioThecnic
Posts: 13
Joined: Thursday 27 August 2020 9:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Italy
Contact:

Re: Ookla Speedtest CLI integration

Post by SavioThecnic »

Guys but something happened
I notice that it hasn't worked for a few months
If I try from the terminal and I start the script from this error


pi@raspberrypi:/home/domoticz/domoticz/scripts $ sudo ./ooklaspeed.sh
./ooklaspeed.sh: riga 19: speedtest: comando non trovato
download = 0,00 Mbps
upload = 0,00 Mbps
ping = ms
jitter = ms
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Ookla Speedtest CLI integration

Post by FireWizard »

Hello @SavioThecnic

From time to time Ookla Speedtest requires that you accept their license.
You will not see this, until you open a terminal and activate the speedtest-cli manually..
However it is indicated in Domoticz with a red bar above your widget, that it has exceed the maximum time for that sensor.

In the first version of the script, the first part of the command was as follows:

Code: Select all

/usr/bin/speedtest --format=json 
Currently I use:

Code: Select all

/usr/bin/speedtest --accept-gdpr --format=json
This works fine for me, so far.
But you may want to add --accept-licence as well. See the @grutter post.

You can test from the command line in a terminal.

Regards
SavioThecnic
Posts: 13
Joined: Thursday 27 August 2020 9:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Italy
Contact:

Re: Ookla Speedtest CLI integration

Post by SavioThecnic »

Thank you dear friend of the quick reply
I tried to send your commands but they give an error
it is not clear to me how I install the license if you give me some commands I can try again I am attaching photos of how my config is and of the result I have.
Attachments
EsempioKO.jpg
EsempioKO.jpg (135.76 KiB) Viewed 7656 times
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Ookla Speedtest CLI integration

Post by FireWizard »

Hello @SavioThecnic

From your screenshot I see that you use the bash script provided by @joosty in his first post.

You might have seen that I use another method as I do not run the script on the same device as Domoticz.
I run the script on my Linux server/gateway/firewall and push the results with MQTT to the MQTT server.
From there with Node RED I prepare the data for Domoticz and send it to my Domoticz server.

However this should not be a problem. A quick scan of the bash script shows that this script might work well.

But I see something else in the small window.
speedtest: comando non trovato
A check with Google translate tells me that that means 'command not found"
That can mean two things, either you installed the speedtest-cli program at the wrong place or it has not been installed at all.

To install it on your Raspberry PI, you may want to use the following guide line:
https://pimylifeup.com/raspberry-pi-int ... d-monitor/

Do not use the Python script.

Regards
manjh
Posts: 708
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Ookla Speedtest CLI integration

Post by manjh »

I ran speedtest-cli but it proved to be unreliable: sometimes it runs OK, but many times it fails somehow.

I then tried the Ookla test, but it will not install on my R-Pi 4 with current OS. This is the error:

Code: Select all

curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash
This distribution version is not currently supported via package management, please use the direct download builds per architecture found at https://www.speedtest.net/apps/cli

What can I do? The Ookla site gives some options for Linux downloads, should I try one of those?
Hans
zicht
Posts: 251
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: Ookla Speedtest CLI integration

Post by zicht »

for anyone using ookla,

Ookla has implemented a mechanisme to detect to many test in x time by automatic scripts like above

So if you see errors or a low value , please check if you are redirected to one of their "abuse" servers giving shit values.
I have discovered this by accident when i did ookla test on my browser and saw a obvious server name and values.
The name will tell you instantly that you have been redirected, can't remember is now, but is was really clear.

Now (with local python to txt file) only once in 15 minutes during the times that counts for me most.
Since then is works fine.
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Ookla Speedtest CLI integration

Post by FireWizard »

Hello Hans,

I used the install method as indicated on the Ookla site.
However I did not install it on an Debian server but on a server running CentOS

So you can choose the one, that correspondents with you distribution.
See: Speedtest CLI and then Install Options

Perhaps it will work for you, but I did never see that error message.
I assume curl has been installed?

Code: Select all

sudo apt-get install curl
Regards
zicht
Posts: 251
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: Ookla Speedtest CLI integration

Post by zicht »

for anyone using ookla Cli,

Ookla has implemented a mechanisme to detect to many test in x time by automatic scripts like above.
It works by IP and includes also manual tests in your browser.

So if you see errors or a low value , please check if you are redirected to one of their "abuse" servers giving low values.
I have discovered this by accident when i did ookla test on my browser and saw a obvious server name and values.
The name will tell you instantly that you have been redirected, can't remember the name, but is was really clear.

Now (with local python to txt file) max once in 15 minutes during the day times that counts for me most.
Since then is works fine.
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
manjh
Posts: 708
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Ookla Speedtest CLI integration

Post by manjh »

After a lot of trial/error, I finally found a setup that works without a glitch.

First removed everything from the R-Pi: all remnants of speedtest installations that I have tried before.

Then re-installed speedtest-cli using apt-get .
That's all for the Pi.

In Domoticz, I use a virtual switch to trigger the speedtest. Also have two custom sensors for download and upload speeds.
For now, I ignore the ping.

Next, created a flow in Node-Red. The flow is triggered by the domoticz trigger switch, and starts the speedtest-cli module in an exec node. The output is pushed through a json node, and output from that is processed in a normal function node to update the two sensor nodes, and also switch off the trigger.
Back in Domoticz, I have an event script that reacts to a change of the download sensor, and accumulates the values in a file.

Sounds complicated, but it really isn't...

This setup has now been running for a while, no problems at all.

Building on the growing data file, I have created another Node-Red flow to read the file, compress it into a single (average) value per date, and display it in a bar chart on Node-Red dashboard.
Hans
SavioThecnic
Posts: 13
Joined: Thursday 27 August 2020 9:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Italy
Contact:

Re: Ookla Speedtest CLI integration

Post by SavioThecnic »

FireWizard wrote: Saturday 28 March 2020 16:43If someone is interested in the solution and the simple Node Red flow, let me know.
I had installed the script but it hasn't worked for months
Since I also installed the red node
I would be happy if you can share your flow
so i try to import it into my red node and see if it works Thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest