Below you'll find a complete solution on integrating the internet connection bandwidth speed test from Speedtest.net in your OpenHAB setup. This is accomplished by using the speedtest-cli script, which you have to provide on your system.

Version Info: The guide was updated for openHAB 2.0 but should work on other versions as well.

Functionality: * execute speed test once or twice a day, every hour or upon command * show summarized results on the sitemap * show all results on an extra page after click * a button is defined to start the speedtest, either through the sitemap or your own rules

Side Note on Statistics: The three dots under statistics are just a placeholder for whatever statistics you want to generate and present out of your measurements over time (see persistence).

One option is to persist the introduced items to InfluxDB and am drawing Grafana graphs from them. These are then displayed under statistics. For more details check the InfluxDB+Grafana tutorial (a speedtest graph example can be seen in the middle of the first posting).

Hey @tracstarr, great input!I was mainly interested in my downlink connection but especially for graphs all three values are nice. I updated the first posting with your additions, combined things in a String representation for the sitemap and added a bit of logging. The extra variables are mainly for clarity.I'm not sure if I like the idea to run this script hourly. I'm running it twice per day when nobody is active in my network. If wife/son/dog is watching netflix, the results will go down, that's a self-fulfilling prophecy and will create trouble for you Maybe you could graph the speedtest in conjunction with the current traffic from your router (SNMP?) to get the overall bandwidth...

Thanks! I added another condition. Now error checking ins done by checking if the output of speedtest-cli is something like "Ping...MBit/s". If that's the case than I guess everything went fine. Otherwise we'll get the error logging we can work with. Just to be sure that the summary element doesn't stay in it's old state on an exception, I did another small modification and moved the reset to the top.

Btw. can somebody help with the String::format? The line throws an exception and I can't figure out why...

A last update. Now with more info and control on the sitemap, including a button to manually start a speedtest.@tracstarr I was surprised how stable the results are, even with clients active in the network. So I included hourly as a default option

Hey Dominic,what's the benefit of this approach?Besides having the IP as an additional information (which seems unrelated to the rest), why would you bother and go "von hinten durch die Brust ins Auge"?

Since "speedtest-cli --simple --share" will also give you image url of the result, can that image shown in the sitemap?

I don't believe that there is a way to feed a dynamic URL into a sitemap (short of rewriting the sitemap file on the fly). I would love to be proven wrong, though. Giving meaning to the widget Image item=MyDynamicURL would be great.

The problem is getting the image updated because once the first one is loaded, OH has it locked and you can't rewrite it without first existing out of OH and freeing the file up. If someone has a solution to that then it would be easy to set up a job to copy the generated image to your image file location.

once the first one is loaded, OH has it locked and you can't rewrite it without first existing out of OH

That would be a bug if openHAB was responsible for leaving an image file locked. Is there any chance that the code you use to copy the dynamic image to a well-known name is leaving the target file open, or that the copy is happening when the Jetty embedded web server is read the file? Is this on Windows by any chance?