[OH3] New Binding - Speedtest

Thank you. This solution worked for me too.

Hi, I installed the binding org.openhab.binding.speedtest-3.1.0-SNAPSHOT.jar, it works fine. Can you pls help me and post a rule that triggers the test. Basically I dont know how to access the results. And I want to get the speedtest working with a rule. Running on Raspi4b with OH3.2.

I tried this:

    val String ruleId = "Speedtest"
    // Speedtest init placeholder
    val Number lDownloadSpeedThresholdSLA = 80 // If the speedtest shows a download speed below 80mbps then measure more often

    rule "Speedtest"


        //Time cron "0 0 5,13 * * ?" or
        Time cron "0 0/2 * * * ?" or //was set to 15min
        Item Speedtest_Trigger changed from OFF to ON or
        Item Speedtest_Trigger received command ON


        logInfo(ruleId, "--> Execute a speedtest...")
        logInfo(ruleId, "--> Download speed= " + Speedtest_DownloadBandwidth.State.toString)

But the send command does not work.

And why does

        logInfo(ruleId, "--> Download speed= " + Speedtest_DownloadBandwidth.State.toString)

not work?

        logInfo(ruleId, "--> Download speed= " + Speedtest_DownloadBandwidth.toString)

yields the following output in the log:

2022-01-22 17:48:00.420 [INFO ] [.openhab.core.model.script.Speedtest] - --> Download speed= Speedtest_DownloadBandwidth (Type=NumberItem, State=92.326, Label=Download Bandwidth, Category=, Tags=[Point], Groups=[Speedtest])

My item looks like this:

You don’t need a rule to trigger a test.

First, I see you are trying to trigger your rule on a regular time basis. The binding already does this on its own. Go to Settings->Things->Speedtest Binding->Configuration->Refresh Rate and select how often you want it to run.

Second, I see you also have an item called “Speedtest_Trigger” to manually trigger tests. If you do want to run it manually, there is a channel under the Speedtest Binding item called “Test Trigger” that you can connect to your Speedtest_Trigger item (needs to be a switch type). Turning that switch on or off will manually trigger a test to run. No rules needed.

Just came here to say thank you to @bhomeyer for making this binding. I tried the old speedtest binding back in OH2 and it broke many many times. Then when I moved to OH3 I tried using the network binding speedtest and it has no documentation on how to configure it to make it work, but seemingly doesn’t work for me. This binding simply dropped in, downloaded and installed speedtest, connected my already existing items from previous tried and it just worked out of the box. No fuss. Quickly reading through this thread it appears that nearly all of the people who have issues didn’t understand how to set the exec permissions correctly for the speedtest binary.

@bhomeyer - is this eventually going to become a released binding rather than having to manually install? Thanks for putting this together!

Thx Tom for your feedback. It does not help tough as I need a rule to do more stuff than just triggering a speedtest measurement. The item “Speedtest_Trigger” is part of the binding. With this you can manually trigger a rule.

I will use a rule to trigger extra measurements when a certain speed threshold is not met, trigger other actions/calculations/monitoring actions. Basically I want to work on a more elaborate “measurement” tool to identify issues in my home network or at the network provider side… just that you get more insights why I am seaching for a possibility to trigger a rule based on when a measurement actually has happened. BTW, I tried also the trigger “item Speedtest_DownloadBandwidth changed” which fired the rule but unfortunately endlessly every 0.1 of a second…not what I want as you can imagine;)


Hi @Alexollon

Yes, I do things after speedtests are run too. In my example below, I trigger on the download rate being updated, I then create a datetime item to timestamp when the test was run, and I calculate the 7 day averages.

rule "Speedtest last run"
		Item downlinkRate received update
		postUpdate(speedTestLastCompleted, new DateTimeType())	//sets new date/time stamp
		postUpdate(downlinkRate7DAve, downlinkRate.averageSince(now.minusDays(7), "influxdb")as Number)
		postUpdate(uplinkRate7DAve, (uplinkRate.averageSince(now.minusDays(7), "influxdb")as Number))

Thx Tom, that worked - “received update” is the key!


1 Like

@tommycw10, reading through your post #129, I get the impression that you read this thread very quickly and superficially. @bhomeyer was last here in August last year and we are very concerned!

I get an “CONFIGURATION_ERROR” after the bundle was running for a few weeks with no problems. The speedtest is located in usr/bin

-rwxr-xr-x 1 root root 2219064 Jul 7 18:23 speedtest

As far as I know the permissions should be finde. I can even find nearby Servers in the Thing in the configuration.

Anybody any idea?

There can be various reasons for this. Your information is a bit flimsy. Did you update openhab? Which Speedtest version are you using?
I have provided instructions above. There you can read about the installation again.
My Speedtest now runs under Openhab 3.3 in Docker.

I need to start ./speedtest manually from time to time in order to accept the license terms:

Do you accept the license? [type YES to accept]: YES
License acceptance recorded. Continuing.

Be aware, that you need to use the right user, e.g. openhab and not your default user.

I compiled a new version of the binding which is now automatically accepting also GDBR in addition to the license terms only.

/openhab/conf/scripts/speedtest/speedtest -f json --accept-license

/openhab/conf/scripts/speedtest/speedtest -f json --accept-license --accept-gdpr

I hope that solves the repeatedly raised issues arround that reported CONFIGURATION_ERROR.

1 Like

The latest version of this Binding is now also available on MarketPlace:

1 Like

I don’t have your GDBR issue using OH3.3 and the 3.1 snapshot. I wonder if it’s due to something changing in Speedtest, which I haven’t updated in awhile.

Whatever the case, thanks for picking this up and adding it to the Marketplace. It doesn’t look like bhomeyer will be back, so I hope they’re alright and have just decided to move on from OH.

The binding uploaded to market place received some additional improvements and incompatible changes:

  • rebased to openHAB 3.4.0 Snaphot
  • channel names in lowerCamelCase
  • introduced UOM
  • improved Docu

When I try to install speedtest, as per Ookla’s instructions for Debian (rpi 4), I get errors:

openhabian@openhabian:~ $ sudo apt-get install speedtest
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package speedtest

The previous steps were all successful.

Please advise. Thx!

I downloaded the Linux armhf binary from the bottom of the Ookla instructions page, ran speedtest once to accept the T&Cs, stop/started the speedtest binding and it’s now Online!

I am getting the same result

The repository is setup! You can now install packages.
openhabian@openhabian:~ $ sudo apt-get install speedtest
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package speedtest

Speedtest Binding is not working for me. The Thing stays UNKNOWN.
Please help

did you run sudo apt update before running sudo apt-get install speedtest
according to the error message the package was not found. Reason for this might be that the package indexes were not updated locally.

openhabian@openhabian:~ $ sudo apt update
Get:1 http://davesteele.github.io/comitup/repo comitup InRelease [4,659 B]
Get:2 http://raspbian.raspberrypi.org/raspbian bullseye InRelease [15.0 kB]
Get:3 http://archive.raspberrypi.org/debian bullseye InRelease [23.6 kB]
Hit:4 https://deb.nodesource.com/node_14.x bullseye InRelease
Hit:5 https://repos.influxdata.com/debian bullseye InRelease
Ign:6 https://packagecloud.io/ookla/speedtest-cli/raspbian bullseye InRelease
Hit:7 https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable InRelease
Err:8 https://packagecloud.io/ookla/speedtest-cli/raspbian bullseye Release
  404  Not Found [IP: 2600:1f1c:2e5:6900:b931:927:7098:932c 443]
Get:9 http://archive.raspberrypi.org/debian bullseye/main armhf Packages [308 kB]
Reading package lists... Done
E: The repository 'https://packagecloud.io/ookla/speedtest-cli/raspbian bullseye Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
openhabian@openhabian:~ $ curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
Detected operating system as raspbian/bullseye.
Checking for curl...
Detected curl...
Checking for gpg...
Detected gpg...
Detected apt version as 2.2.4
Running apt-get update... done.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/ookla_speedtest-cli.list...done.
Importing packagecloud gpg key... Packagecloud gpg key imported to /etc/apt/keyrings/ookla_speedtest-cli-archive-keyring.gpg
Running apt-get update... done.

The repository is setup! You can now install packages.
openhabian@openhabian:~ $ sudo apt-get install speedtest
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package speedtest
openhabian@openhabian:~ $