Ookla's Speedtest Binding [3.2.0;3.9.0)

It was! However I am not able to get the execPath working.

I installed Python, downloaded the speedtest-cli, I have the binding, the items and the thing. Running in docker on Synology DSM. I can execute the speedtest using the terminal command ./speedtest-cli

image

I tried leaving the execPath empty since DSM is a linux system. Also tried ./ and ./speedtest-cli.

The outcome is always “Speedtest executable not found”.

image

It might be a naming problem or something? I installed the CLI doing this because I had no clue how to install it using the link provided:

wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli

Let’s review:
You’re running the wrong speedtest for starters.
Please read the following instructions, here
And check the screenshot below:

Ooklas instructions actually tell you to remove the speed test-cli application.

Once you have the correct one installed, consider the following:
You have the speedtest application installed somewhere (maybe your user folder? I don’t recall) but you have your docker files somewhere else. Additionally, in your docker information you defined the mount points of the folders - and you probably did not account for files other than openHAB.
Remember, docker cannot look outside of its image and folders you mounted, so, if you’re running docker, and you’re running an application outside the docker container that you want to access, you’re… kind of stuck.
What you can do is:
install speedtest inside of the docker container - but - every update you’ll lose it.
Or
Mount the location of the speedtest install folder onto the openHAB disk mounts so that it will be accessible by the binding. But if there’s a Java update on something it might break. If openHAB uses a different Java version, you may end up with other problems.

And that’s it. Once the executable is visible to openHAB it will run. It’s actually super cool and I’ve been having fun with it. I just miss a channel with the date and time of the last speedtest run :slight_smile:

I can’t remove it. There is no apt-get in the Synology world.

admin@DS918plus:~$ sudo apt-get update
sudo: apt-get: command not found

Now how do I find out what the command I executed downloaded to remove it? This is the repo:

I have read now that the sivel package is incompatible with the binding. Sadly read it too late.

Without apt-get I can’t install curl as well.

But you can do that easily on your own if the binding is working already :slight_smile:

Humm then just delete the files, and install the ookla version afterwards. That’s what I had to do because my version was manually installed.

Yeah it’s easy enough to store that data for sure, not complaining, but it would be quite useful if it is already part of the binding, that’s it :slight_smile:

I downloaded the .tgz for Linux now, extracted it and placed it for testing purposes into my openHAB folder assuming I have chosen the right .tgz version. I am not 100% sure which one I have to choose for my NAS after some research.

/docker/openHAB/speedtest mounted to /speedtest:
image

But still the thing is not able to find the executable. Which is placed in that folder.
execPath: /speedtest

Pretty sure it is an easy fix but I need to dig deeper. As usual :stuck_out_tongue:

I am wondering what happens on a Synology NAS system in the switch case statement evaluating the operating system:

This here solved my problems:

Mounting the speedtest file in docker in /usr/bin/

/volume1/docker/openhab/speedtest:/usr/bin/speedtest

1 Like

Ah crap came too late. Yes the binding is looking for the executable in a specific location, you you can’t mount it to /speedtest, but instead to the whole path.

I just hope we won’t get any issues down the line :smiley:

1 Like

Synology DS918+ runs a Intel Celeron J3455 CPU.
ookla-speedtest-1.2.0-linux-x86_64.tgz should be the right one for your docker installation. Don’t forget to extract the *.tgz.

I am wondering what happens on a Synology NAS system in the switch case statement evaluating the operating system

Linux.
Therefore it’s using /usr/bin/speedtest as a default (if not configured / configuration empty).

If /speedtest is a directory (mounted from directory /docker/openHAB/speedtest) and the executable in the docker is /speedtest/speedtest, you need to configure /speedtest/speedtest in the binding. Could this have been the problem in your case?

Always make sure that the speedtest program is executable from the user that runs openhab in the docker. The latest version of speedtest should report an issue if this is not the case.

Any clue how I can use the Speedtest_Download_Bandwith in a rule comparing it to a threshold?

I will do something like this but I am struggling with the if-statement. I have read the UnitOfMeasurement documentation but was not able to find anything for actually comparing the different QuantityTypes/UoM to other values.

rule "Send an email when downstream < 300"
when
    Item Speedtest_Download_Bandwith received update
then
	if (Speedtest_Download_Bandwith.state <= 300.0)  { // this is broken
		// send an email
	}

end

In DSL something like the following should do the trick:

val Double downloadBandwith = (Speedtest_Download_Bandwith.state as QuantityType<Number>).toUnit("Mbit/s").doubleValue
if (downloadBandwith <= 300.0)  {
	// send an email
}

That approach a little bit over worked.

if((Speedtest_Download_Bandwidth.state as QuantityType<?>) <= 300.0|GB/s) { // I'm guessing that's what the 300 units should be

Or if you don’t want to mess with the cast swap the arguments and I think it will work.

if(300.0|GB/s >= Speedtest_Download_Bandwidth.state) {

Thank you for this, its working great for me (openHAB in Docker on Synology).

The only thing that throws me off is Speedtest_TriggerTest. After setting the switch ON Speedtest runs as expected but leaves the switch on which seemed a little confusing to me. I tried using a one second expire on the Item but that caused the speedtest to run a second time as soon as the first run finished…

Perhaps the binding could set Speedtest_TriggerTest OFF at the end?

i am using the expiration timer in the items metadata exactly for this and it works very well. I use 10 seconds. It just triggers once.

You are right. The binding reacts on any command (ON or OFF) on that channel.
In addition it does not reset the switch to OFF.
I will update the binding and let you know once done.

@muelli1967, if you add a rule like the following I believe you’ll see the speedtest is actually running twice. I use 1s for the expire.

rule SpeedtestRunRule
when Item Speedtest_ResultURL changed 
then {logInfo("SpeedtestRunRule","URL: {}", Speedtest_ResultURL.state) 
}
end

These are the log entries from setting the test switch on once:

2023-01-20 09:02:12.911 [INFO ] [b.core.model.script.SpeedtestRunRule] - URL: https://www.speedtest.net/result/c/d147d707-ecc8-4289-941d-1252e1xxxxxx
2023-01-20 09:02:26.112 [INFO ] [b.core.model.script.SpeedtestRunRule] - URL: https://www.speedtest.net/result/c/9a0be940-3b22-4e4c-875c-4d3581xxxxxx

@MikeTheTux, thank you, that is great news.

Agree, because the expire config using command=OFF is again triggering a measurement.
It should work if you configure state=OFF instead.

This should be a proper workaround until the issue in the Binding is fixed.

Perfect! That worked for me.

Thanks again.

Hi there,
Can anybody give me a hand with this binding. For some reason I cannot finish the installation. I am running openhabian on a Rpi.


Any idea what could be wrong?
Thanks in advance.

After adding the gpg key and before installing the speedtest package you need to run

sudo apt-get update

then run the command to install the package.