Speedtest with wget - how to get the values to openhab?

Hi, i want to do a speedtest with wget and get the result into openhab. I Know the speedtest-cli, but i want to measure a local wireless connection and so i have to do this on my own.

This is what i get on my linux shell:

debian@debian:~$ wget --user=user --password='password' -O/dev/null ftp://192.168.2.1/100MB.bin
--2020-01-07 13:05:40--  ftp://192.168.2.1/100MB.bin
           => »/dev/null«
Verbindungsaufbau zu 192.168.2.1:21 … verbunden.
Anmelden als user … Angemeldet!
==> SYST ... fertig.    ==> PWD ... fertig.
==> TYPE I ... fertig.  ==> CWD nicht notwendig.
==> SIZE 100MB.bin ... 104857600
==> PASV ... fertig.    ==> RETR 100MB.bin ... fertig.
Länge: 104857600 (100M) (unmaßgeblich)

100MB.bin              100%[==========>] 100,00M  4,54MB/s    in 21s

2020-01-07 13:06:01 (4,85 MB/s) - »/dev/null« gespeichert [104857600]

debian@debian:~$

How can i get the result into openhab?

If your running with the latest version of OH then there is a built in Speed Test now as part of the Network binding. Take a look here.

There are a few configuration options that will hopefully work with your desired solution.

I know this, but as i said in my first post, i can,t use the built in speedtest, because i want tzo measure a local connection. Not against a server from the internet.
(I know the speedtest cli and the network-binding speedtest-variant)

I have a local ftp server and now i can download a file with wget - there i get a value - this works already.

But now i have another problem… I´m from germany and the value is given me in this format #,## and not in the english variant #.##

In germany numbers are split with komma , and not with a point .

So when i want to update my number item to save the value in my rrd4j-database, i get the following error:

Cannot convert '5,54' to a state type which item 'SpeedtestWGETResultDown' accepts: [DecimalType, QuantityType, UnDefType].

Any idea how to solve this? I want to save this inside openhab as a number item in this format 5.54 and not in the given 5,54.

Got it:

val SpeedWGET1 = SpeedWGET.replace(',','.')
1 Like

You can do the same with the Network Binding version of the Speed Test. just change the URL to your FTP server and the name of the file you want to download as a test.

And how can i enter my ftp credentials to the network-thing? There are no fields for user/password.

No there isn’t. But in your OP you said the FTP server was local, so I made the assumption that you would be using anonymous access. You could setup anonymous access just to a specific folder and file for your speed test.

It is a fritzbox. I made a new user with username anonymous and no password. So now i can connect without any credentials.

Happy days, glad to hear you got it working.

Alternatively invoke wget with LANG=C set in the environment so that changes to localization do not break your code in the future. It will also solve your comma issue the “right” way.