Speedtest-cli Internet Up-/Downlink Measurement Integration


(Muplex) #123

Hello,
I didn’t understand the line
…/speedtest-cli@@–simple
I found the file /usr/bin/speedtest-cli on these path but what is the meaning of @@???

If I type speedtest-cli@@–simple inside the /usr/bin/ folder the bash result is "Command not found "

speedtest-cli --simple works fine in SSH connection…


(Kuba Wolanin) #124

@Muplex, executeCommandLine requires to replace each space character with @@.


(Muplex) #125

Thank @kubawolanin 4 the reply…

I found a difference to make it work these add on on my setup.
The modification is

if (speedtestCliOutput.startsWith("Ping") && speedtestCliOutput.endsWith("Mbits/s"))

instead of

if (speedtestCliOutput.startsWith("Ping") && speedtestCliOutput.endsWith("Mbit/s"))

a little S make the difference


(Michael Heckmann) #126

thanks @ThomDietrich for this great tutorial.
Installing it was really easy, but when executing it gives me an error:

2018-01-04 16:08:11.108 [INFO ] [arthome.model.script.speedtest.rules] - --> speedtest executed...
2018-01-04 16:10:11.272 [ERROR] [arthome.model.script.speedtest.rules] - --> speedtest failed. Output:



That means there is no output.
On the other hand executing the speedtest-cli --simple on the command line shows:
I’m using speedtest 1.0.7

pine64@pine64:/usr/local/bin$ speedtest-cli --simple
Ping: 38.945 ms
Download: 9.81 Mbit/s
Upload: 3.94 Mbit/s

That confuses me.
Any ideas?
Thanks, Michael


( ) #127

@Muplex I just did the test. Both the version 1.0.6 and the latest 1.0.7 produce “MBit/s” on my system. Really strange.

@Mitch77 Seems like the variable speedtestCliOutput is empty, that shouldn’t be. You need to debug your rule. First check if the absolute path /usr/local/bin/speedtest-cli is correct. Next check if you can execute the command as user openhab. If so did you install the Exec binding?
You’ll find that it’s often easy to debug on your own.


(moberlin8) #128

FWIW: I can confirm I get “Mbits/s”

$ /usr/bin/speedtest-cli --version
0.3.1

Openhab is running on a raspberry Pi 3

$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 8.0 (jessie)
Release:        8.0
Codename:       jessie

(Michael Heckmann) #129

Ha, at least it was an “easy” one.
After I checked that

sudo -u openhab /usr/local/bin/speedtest-cli --simple

was working, I found that it took quite a long time til the results came. So I tried to extend the timeout. With 5 minutes timeout it’s working now. FTR: I changed the following line in your rule to:

 var String speedtestCliOutput = executeCommandLine("/usr/local/bin/speedtest-cli@@--simple",5*60*1000)

( ) #130

Hui that’s strange! Maybe it’s related to the server used for testing in your area?


(griMA) #131

Unrelated!

I read the entire thread, but I am still not aware how my speedtest data is stored in influxdb.
In the provided python script (first post from ThomDietrich), db and ip etc is specified in the script.

Probably it is easy, but I can not see the wood for the trees.


(Jerome) #132

The script just updates the corresponding openHAB Items you have created.
The items then get stored in influxdb with the persistence service, you have configured in openHAB.


(Michael Joos) #133

Did someone else see something like this in the past?

2018-02-13 01:00:12.114 [ERROR] [.eclipse.smarthome.model.script.RULE] - --> speedtest failed. Output:
Cannot retrieve speedtest configuration
ERROR: timed out

This started to happen for me let’s say 1-2 month ago. The funny thing is that manually it just works…100%. I see this error message only with time based rule-start. This is the part of my rule:

rule "Speedtest"
when
Time cron “0 00 01 * * ?” or // Every day 01:00
Item SpeedtestRerun received command ON
then {

Very strange…Any ideas what causes this error? I’m always on latest snapshot.

Thanks
Michael


(davorf) #134

Hello!

I’m not sure if this is causing an error you’re having, but you shouldn’t use curly brackets after THEN.
If I’m not mistaken, syntax should be:

Rule "Rule name"
when 
   Trigger
then
   Action
end

Best regards,
Davor


(Michael Joos) #135

Unbelievable that I didn’t see that :flushed:
The rule worked now the last 3 nights…sometimes it’s good that someone else keeps an eye on it!