Speedtest-cli Internet Up-/Downlink Measurement Integration

Anyone managed to have chart working correctly ? Rule set to measure speed every hour which works and shows mbits every hour :slight_smile:

 Time cron "0 0 * * * ?"

my items :

Chart item=SpeedtestResultDown label="Download" refresh=60

my rrdj4.persist:

Items {
        zasobnik_temp, SpeedResultDown, dining_room_ambient_temperature_c : strategy = everyMinute
}

where zasobnik_temp and dinig_room_ambient works ok, but for SpeedResultDown there is no info in log about storing values in rrdj4 database nad therefore there is no graph in chart.

Your chart items name is SpeedtestResultDown and in your persist file the item name is SpeedResultDown. The names do not match.

thank you, it was so stupid that i am ashamed of this mistake :wink: Of course chart is working correctly :slight_smile:

I was running the test every hour but it was using around 4 Gb a day and slowing down my video streams. I so only run it once a night now.

Speedtest Works !Thank you very much
What is with statistics display. How often do you have to test it so that the ad appears?

I am persisting the introduced items to influxdb and am drawing grafana graphs from them. These are then displayed under statistics. I decided to not make that part of this tutorial as it is not really related. For more details check (speedtest can be seen in the middle of the first posting):

The ad?

Sorry Google translate :slight_smile:
Thank you very much Now I have something to read …

It has all worked … and now suddenly no more … what am I supposed to do? Please Help.:frowning:

pi@raspberrypi:~ $ speedtest-cli --simple
Traceback (most recent call last):
File “/usr/local/bin/speedtest-cli”, line 9, in
load_entry_point(‘speedtest-cli==1.0.0’, ‘console_scripts’, ‘speedtest-cli’)()
File “build/bdist.linux-armv7l/egg/speedtest.py”, line 1400, in main
File “build/bdist.linux-armv7l/egg/speedtest.py”, line 1376, in shell
File “build/bdist.linux-armv7l/egg/speedtest.py”, line 1086, in upload
File “build/bdist.linux-armv7l/egg/speedtest.py”, line 497, in _create_data
MemoryError

This is a problem probably related to a bad state of your system.
Check your memory with df -h and free. Upgrade. Restart your system.

Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf
/dev/root 30G 4,6G 24G 17% /
devtmpfs 459M 0 459M 0% /dev
tmpfs 463M 0 463M 0% /dev/shm
tmpfs 463M 47M 417M 11% /run
tmpfs 5,0M 8,0K 5,0M 1% /run/lock
tmpfs 463M 0 463M 0% /sys/fs/cgroup
/dev/mmcblk0p1 60M 20M 41M 34% /boot
tmpfs 93M 0 93M 0% /run/user/1000

pi@raspberrypi:~ $ free
total used free shared buffers cached
Mem: 948016 829852 118164 48040 5368 86472
-/+ buffers/cache: 738012 210004
Swap: 102396 96320 6076

My system is actually up to date .I have 32 GB memory Card.
Must still try again Restart.
Thanks

This worked great on my OH 1.9 installation. Thanks a lot.:relaxed:

I’ve switched to OH2 and now I’m struggeling a bit in using this without “compatibility mode”, i.e. implementing this in native OH2 terms. Mainly the integration of thing (exec binding) and rule. Could you provide an example (or even an updated version of the files :wink: )?

OK, have figured out by myself I think :grin: No “Thing” and “channel” required as the rule itself updates the items directly. At least it gets reasonable results which are close to the ones started from command line.

Sorry for the bother. :flushed:

Would anyone be able to share some SVG icons?

Hey Tommy,
I’ve just updated the first posting for openHAB 2 and added a new archive file containing pngs and svgs.

2 Likes

installed it and worked flawlessly!!!

1 Like

I just set this up at home. Things seem to working as I’m getting what looks like accurate speed tests, but seeing a strange error in my log when I run it of:

2017-04-14 13:54:58.678 [INFO ] [arthome.model.script.speedtest.rules] - --> speedtest executed...
2017-04-14 13:55:01.633 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 12789210 failed: null
2017-04-14 13:55:01.634 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 12789211 failed: 

And can anyone tell me what “Statistics” on the sitemap should be doing or showing?. I just show the three dots, … Should that be going to graph or other?

The warnings you are seeing are yield by io.openhabcloud.internal.CloudClient, which is probably related to your myopenhab setup.

The three dots under statistics are just a placeholder for whatever statistics you want to generate out of your measurements over time (see persistence). My recommendation would be Grafana graphs, see InfluxDB+Grafana persistence and graphing

Great scripts, just a quick comment for future improvements: Lots of people use a switch item called Presence_anyone or similiar that indicates if someone is home or not, Its been discussed here to run it hourly or twice per day, So one idea is that we run it hourly(cron rule) but only if nobody is home(Presence_anybody.state ==FALSE)

rule "Speedtest"
when
    (Time cron "0 0 * * * ?" and Presence_anybody.state ==FALSE) or
    Item SpeedtestRerun received command ON
then

Just an idea…

3 Likes

Can you edit you orginal post to include this as an option with the link provided on how to do so in your tutorial.(Its superb btw, took less then 5 minutes to install, if you take away the fact that i had to install 7z to unzip rar)

1 Like

Hey Kim,
thanks for these comments!

That would be possible, although I’m not sure if it’s actually needed. I never saw any significant influences on speedtest caused by users. Do you?

The rule as you defined it would not work. There is no and operator for events. You need to do it similar to this:

rule "Speedtest"
when
    Time cron "0 0 * * * ?" or
    Item SpeedtestRerun received command ON
then
    if (Presence_anybody.state == FALSE) {
        ...
    }
end

I’m not sure if it’s meaningful to add this to the initial post.

Yes. Good idea… Done!