[OH3] New Binding - Speedtest

So I decided to implement a Speedtest binding that exposes the data that Ookla’s speedtest offers.

Based loosely on the work by @Bredmich, just in binding form to make it a bit easier for new users and those that don’t like touching files.

This does also require you to install Ookla’s Speedtest Cli, it will NOT work with anything else.

Very simple to configure :

And once you have it working you’ll have this data available :

To see all the available channels, click on the “Show Advanced” checkbox :
image

More details are available here :

And the jar file if you’d like to test it out is available here :

I know some are going to say this is dumb as it’s something that is already documented and can be done other ways, but I figured since we’re all trying to wrap around the new MainUI I’d make the process for this a little easier.

Not sure if this will ever warrant a pull request to include in the OH releases as I’m not sure something redundant would ever be approved, but I figured I’d make it available to some people who might struggle with the method(s) that have been out there for years.

Under a linux based system it will default to /usr/bin/speedtest for the executable location, so there shouldn’t be much to configure other than how often you want to get the data.

7 Likes

Have you noticed that a speedtest is already present in the Network binding ?

I did, but I didn’t really think the method of testing for that was very easy for someone with little to no knowledge of a system or networking to setup. No offense at all to the creator/maintainer, I was going for more of a “plug it in” type approach.

2 Likes

Maybe you could enhance existing speedtest of the network binding with yours or add a second tests method in the network binding.

1 Like

I could have, but didn’t. Like I said, probably won’t bother with a PR on this, just did it for fun really as I saw a need. Friend of mine was trying to setup OH and asked about a speedtest, I pointed him to the Network binding and he messaged me about his struggles(what URL to use, how do I make an iso, etc… ). I made this. I clearly pointed out that this is likely redundant for some.

I’m personally planning on using it, as well as the Network binding. I just won’t be using the network binding speedtest.

It would be great if you could add some kind of server selection. My isp delivers 1GBit and most server quit on that, so i typically select the server manually.

1 Like

As far as I could tell Ookla seemed to handle that, which is why I didn’t. They do provide the method to get a server list, so I could have added that but I was testing here and all the servers in the list they provided me were capable. I’m on 1Gbit here at home as well, though I am in an area where 1Gb is the norm, so maybe that’s why.

I can add that, though I’m not sure I can make it a drop down since the config is all set when you create the thing and the process isn’t configured at that point.

Let me think about that a bit and see if I can come up with something that’ll work.

Alright, so how about a simple text entry for the server id? If it’s got something in it I would use it when calling speedtest? I could provide a channel with the contents of “speedtest -L” so all the information is there without leaving the MainUI?

I was really trying to have it be completely in the GUI, none of the “go do this on the command line and enter it here” type of stuff. Unfortunately I’m not sure that I can add configuration parameters programmatically, seems as though you can adjust existing ones from the code, but I don’t see that I can add new ones(though I’m going to see if that’s possible later tonight).

2 Likes

Great work!
I‘m going to test it once i moved in my new flat.
It‘s already on my roadmap to rebuild my oH environment from scratch.

I would also like a method to use a predefined server because most of the servers in my area are not able to provide 1 Gbit/s.

Kind regards
Michael

I’ll have that done tonight and will post an update when it’s complete. I’ve tried various methods of doing this(even was going to try and trick the discovery process to showing available servers) but I think I’m going to settle on text entry for the server ID and a channel that will contain a list of the closest servers from the user.

Thanks for the feedback!

For me a simple option to enter a server ID is sufficient.

Perfect Thanks for that!

1 Like

I installed the speedtest-cli and the binding on openhabian on Raspi.
speedtest works manually from cli.
But the thing never gets any data.
Which user and how needs rights to execute speedtest?

You installed the Ookla version of speedtest, or the one that’s available via openHabian?

I installed the ookla Speedtest cli version.

Ok, going to setup an openhabian tonight to see if I can see why. Sorry about that, will advise shortly.

Seems as though it misses the first test because of the license acceptance that it has to do. Should work after that without issues. I’ll see if I can work around that though it should work fine for you.

Just setup a fresh openHabian and installed both Ookla and the binding and that’s the only issue I see. I did not set anything but the refresh rate on the binding config.

@bhomeyer thanks for doing this. i started to use the network binding one and it definitely was cumbersome to setup vs just the commandline. in addition it’s missing something compared to the CLI (can’t remember now, haven’t looked at it in a week as i’m still working on other things related to the OH3 upgrade).

again, thanks. i appreciate this.

1 Like

No problem @waspie, glad you like it.

I’ve updated the binding to include the ability to select a server ID to test with. I couldn’t come up with a great way to display your options, so here is what I came up with.

Configure it as normal(auto detect) and on the first run it will check the list of closest servers. When that is done, it will fill it in the binding properties :

Just copy/paste one of those ID’s into the new field below it “Server ID”. If you want to put it back to defaults, just remove that setting.

I know they are not ordered correctly, and I have no idea why. It seems to be arbitrarily determine that somehow, but I couldn’t figure that out, I tried. Server List 1 is considered the closest by Ookla standards and it goes on from there.

And I know it’s sort of a hack to do it that way, but it was really the best I could come up with. I was going to put the list in a channel so you could just view it from the Model view, but OH doesn’t allow line feeds or carriage returns in the channel data for a label.

New version : https://github.com/bigbasec/openhab-addons/releases/download/v0.3/org.openhab.binding.speedtest-3.1.0-SNAPSHOT.jar

2 Likes

Cool, i doubt i’ll ever use the server list but someone will surely find it useful.
My items and graphs are once again working (came from the old method).

Thank you for this binding @bhomeyer

Works flawlessly! Would it be possible to add a channel to manually trigger the speedtest in addition to the refresh-interval?

2 Likes