[internet sensor] speedtest.net measures

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: [internet sensor] speedtest.net measures

Post by simonrg »

I have set up this script and it works really well.

The only problem is after having run it every 5 minutes for a week, I have discovered that each speed measurement appears to download 30MBytes, so my limited allowance disappeared very rapidly.

Is 30MB per test about right?

Is there a way of using less than 30MB per test?

Obviously testing every 5 minutes is probably too often and I could test less often, so use up less of my allowance, but 30MB still seemed too big, so I was wondering if anybody knew how much data speedtest is supposed to transmit?
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: [internet sensor] speedtest.net measures

Post by emme »

I don't really think that speedtest is intend to be run every 5 minutes

I run it 4 times a day: at 3.00am / 9.00am / 3.00pm / 9.00pm

Speedtest uses all available bandwidth by design... running so often results in poor network performances...

Inviato dal mio EVA-L09 utilizzando Tapatalk
The most dangerous phrase in any language is:
"We always done this way"
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: [internet sensor] speedtest.net measures

Post by simonrg »

emme wrote:I don't really think that speedtest is intend to be run every 5 minutes
I run it 4 times a day: at 3.00am / 9.00am / 3.00pm / 9.00pm
Speedtest uses all available bandwidth by design... running so often results in poor network performances...
Absolutely right, but equally surprising to me in that I didn't reallise how little of my actual bandwith I noramlly use and how little I have to use to exceed my quotas - at 10Mbps 30MB is about 20seconds, so my quota is fully gone in 7 days rather than 31 at less than 8% usage.

I had assumed that speedtest wasn't really downloading or uploading very much, hence 30MB was a bit of a shock, as you say it has to measure full speed so in hindsight not so surprising :oops: .

I was trying spot why my internet while general fast enough, sometimes shows stuttering which kills streaming and doesn't help with VOIP. So monitoring changes in speed to see if I could spot any trends.

I was combining speedtesting wtih pulling off recieved and transmit statistics from my router to see if I can see correlations apart from the obvious.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: [internet sensor] speedtest.net measures

Post by emme »

Mmh... have you already checked this project if it could help you?
http://www.domoticz.com/forum/viewtopic.php?t=13421

Inviato dal mio EVA-L09 utilizzando Tapatalk
The most dangerous phrase in any language is:
"We always done this way"
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: [internet sensor] speedtest.net measures

Post by simonrg »

emme wrote:Mmh... have you already checked this project if it could help you?
http://www.domoticz.com/forum/viewtopic.php?t=13421
Thanks, I have seen that, it pulls it all together.

I am starting to use SNMP to interogate my router and understand how much data is actually being transferred and pick up other statistics.

Combining both speed and actual transfers allows me to have a sensible conversation with my ISP convincing them that what I am seeing is real, on Sunday and Monday my speed dropped to almost zero in the daytime. Magically, the ISP managed to do something, so today's speed is now more stable (this is on the service with no limit on usage :) ).

Sunday
161023BoundlessSpeed.jpeg
161023BoundlessSpeed.jpeg (39.31 KiB) Viewed 1827 times
Tuesday
161025BoundlessDownloadSpeed.png
161025BoundlessDownloadSpeed.png (78.51 KiB) Viewed 1827 times
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
korniza
Posts: 157
Joined: Thursday 27 August 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6028
Location: Greece
Contact:

Re: [internet sensor] speedtest.net measures

Post by korniza »

coming back to this idea and I think from the point of usage has no real usage as it measures the free bandwidth. I know, I started this but it was a proof of concept.
I think the best is to get the bandwidth (upsrtream/downstream) that is using polling snmp (need some help if someone has build and lua script to get snmp stats of interface usage) of the dsl router interface and also get respond time from a specific site. An additional value can be the to run bandwidth test on speedtest.net when dsl line is free (if downstream snmp value is < than 1 Mbit for example) and measure the real throughput of internet line.

Next can be some maths and get the % of free/used bandwidth. combined with the ping latency can give a warning scenario: if (ping respond time > 200 ms) and (downstream < 2 Mbit) then set an alarm.
hope for a help on this smarter script.
>>>> Google Home <<<<<
SBC: Odroid XU4 * Raspberry Pi2 * banana Pi v1
Peripherals: rfxtrx433E, aeon z-stick gen5, bluetooth dongles
Extended Software packages: Xeoma (video NVR), FHEM (extra home automation software)
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: [internet sensor] speedtest.net measures

Post by simonrg »

I have not had time to follow up on SNMP properly, there are SNMP CLI routines, which could be easily used, and cludged into Domoticz via os.execute.

The logic of SNMP is quite complicated it is structured data and you need to have the information for your router to understand which data to ask for.

I would be very interested if somebody else has got further.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
multinet
Posts: 97
Joined: Friday 05 December 2014 22:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [internet sensor] speedtest.net measures

Post by multinet »

Hello

I've just installed : jq & speedtest (node was already installed
I get speedtest.zip on github and unzip it in a personnal directory

I've changed the speedtest variable in script to use my directory

When I run manually the script I get this error :
root@domoticz:/home/pi/domoticz/scripts/personnels# ./speedtest.sh
module.js:327
throw err;
^

Error: Cannot find module 'meow'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/pi/domoticz/scripts/personnels/speedtest/cli.js:4:12)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)

HTTP/1.1 200 OK
Content-Length: 53
Content-Type: application/json;charset=UTF-8
Cache-Control: no-cache
Pragma: no-cache
Access-Control-Allow-Origin: *

{
"status" : "OK",
"title" : "Update Device"
}
HTTP/1.1 200 OK
Content-Length: 24
Content-Type: application/json;charset=UTF-8
Cache-Control: no-cache
Pragma: no-cache
Access-Control-Allow-Origin: *

{
"status" : "ERR"
}
HTTP/1.1 200 OK
Content-Length: 24
Content-Type: application/json;charset=UTF-8
Cache-Control: no-cache
Pragma: no-cache
Access-Control-Allow-Origin: *

{
"status" : "ERR"
}
Any help ?

here is my speedtest.sh

Code: Select all

root@domoticz:/home/pi/domoticz/scripts/personnels# cat speedtest.sh 
#!/bin/bash
# File: broadband.sh
# Check your internet connection using speedtest.net
# Version 0.2 || Last Update: 15 May 2016 

#speedtest=`node /opt/node-v5.10.1-linux-armv7l/lib/node_modules/speed-test/cli.js --json | jq '.'`
speedtest=`node /home/pi/domoticz/scripts/personnels/speedtest/cli.js --json | jq '.'`

echo $speedtest
ping=`echo $speedtest|cut -f1 -d","|cut -f2 -d":"|cut -f1 -d"}"| tr -d ' '`
downstream=`echo $speedtest|cut -f2 -d","|cut -f2 -d":"|cut -f1 -d"}"| tr -d ' '`
upstream=`echo $speedtest|cut -f3 -d","|cut -f2 -d":"|cut -f1 -d"}"| tr -d ' '`

#Vars
domoip=192.168.1.142
domoport=8080
ping_idx=392 
downstream=393
upstream=394

# debug
#       echo $speedtest
#       echo $ping
#       echo $downstream
#       echo $upstream

## ======= No Edit required below line ===========
curl -s -i -H "Accept: application/json" "http://$domoip:$domoport/json.htm?type=command&param=udevice&idx=$ping_idx&nvalue=0&svalue=$ping"
curl -s -i -H "Accept: application/json" "http://$domoip:$domoport/json.htm?type=command&param=udevice&idx=$downstream_idx&nvalue=0&svalue=$downstream"
curl -s -i -H "Accept: application/json" "http://$domoip:$domoport/json.htm?type=command&param=udevice&idx=$upstream_idx&nvalue=0&svalue=$upstream"
Thanks a lot
Multinet
korniza wrote:I created a virtual sensor as Custom sensor but it is just for one of the values (for example downstream). I like to combine all 3 values to 1 custom sensor.

I build the following broadbash.sh script and placed inside domoticz/script folder
Script requirements:
node
speedtest
Jq installed as described on link

You need to change the directory where cli.js is installed.
Also require to get the correct idx for the custom sensors you created as gizmocuz described.

Code: Select all

#!/bin/bash
# File: broadband.sh
# Check your internet connection using speedtest.net
# Version 0.2 || Last Update: 15 May 2016 

speedtest=`node /opt/node-v5.10.1-linux-armv7l/lib/node_modules/speed-test/cli.js --json | jq '.'`

echo $speedtest
ping=`echo $speedtest|cut -f1 -d","|cut -f2 -d":"|cut -f1 -d"}"| tr -d ' '`
downstream=`echo $speedtest|cut -f2 -d","|cut -f2 -d":"|cut -f1 -d"}"| tr -d ' '`
upstream=`echo $speedtest|cut -f3 -d","|cut -f2 -d":"|cut -f1 -d"}"| tr -d ' '`

#Vars
domoip=xxx.xxx.xxx.xxx
domoport=8080
ping_idx= xx
downstream= xx
upstream= xx

# debug
#       echo $speedtest
#       echo $ping
#       echo $downstream
#       echo $upstream

## ======= No Edit required below line ===========
curl -s -i -H "Accept: application/json" "http://$domoip:$domoport/json.htm?type=command&param=udevice&idx=$ping_idx&nvalue=0&svalue=$ping"
curl -s -i -H "Accept: application/json" "http://$domoip:$domoport/json.htm?type=command&param=udevice&idx=$downstream_idx&nvalue=0&svalue=$downstream"
curl -s -i -H "Accept: application/json" "http://$domoip:$domoport/json.htm?type=command&param=udevice&idx=$upstream_idx&nvalue=0&svalue=$upstream"
Also it required to get a cron job to your system. Remember that is use your internet banwidth, so I suggest a 15 minutes update or longer.

Code: Select all

*/15 *  * * *   root    /home/pi/domoticz/scripts/broadband.sh
PI 2 - Domoticz 2021.1
RFXCOM - RFXtrx433 USB 433.92MHz Transceiver (5 DIO 54755 + 2 DIO 54756 + 3 DIO 54798)
Z-Wave.Me ZME_UZB1 USB Stick (6 FGSD002 + 2 FGRM222 + 1 FGS223 + 1 FGMS001-ZW5 + 1 FGRGBWM441 + 1 FGBS001 + 2 FGFS101)
6 sondes DS18B20
manjh
Posts: 748
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: [internet sensor] speedtest.net measures

Post by manjh »

gizmocuz wrote: Sunday 15 May 2016 12:06 Yes, add the 'Dummy' hardware, then press the button 'Create virtual sensor', and choose 'Custom Sensor' as type
Problem with the custom virtual sensor is: it is not transmitted as a shared device.
I want to run the speedtest in a remote location, and keep track of it in my central Domoticz...
Is there any other device that I could use?
Hans
User avatar
FireWizard
Posts: 1889
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: [internet sensor] speedtest.net measures

Post by FireWizard »

Hi

manjh wrote
Problem with the custom virtual sensor is: it is not transmitted as a shared device.
I want to run the speedtest in a remote location, and keep track of it in my central Domoticz...
Is there any other device that I could use?
You should use the same devices for Ping, Download and Upload.

If you do not need Domoticz at that remote location for other purposes as only for a speed test, you do not have to install Domoticz as a remote server.
You can use MQTT and maybe you have already installed Mosquitto and Node Red.
If not install it. Various guidelines are available. If you need more info, please ask.

Install: https://github.com/hobbyquaker/speedtest2mqtt
Send the data to your Mosquitto broker and convert it with Node Red and send the data to Domoticz.

An alternative is this one: https://github.com/SvenFestersen/speedtest-mqtt

Regards
NLToontje
Posts: 1
Joined: Monday 30 March 2020 20:42
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.10717
Location: NL
Contact:

Re: [internet sensor] speedtest.net measures

Post by NLToontje »

I'm happy this topic is still alive after so many years :D

Now, I was looking for something like this, but not exactly the same.
I was looking for a possibility to read the actual up- and download bandwidth from my Cisco router by SNMP using Domoticz. So, not the max. up and download speed as tested by this script, but the real network utilisation.

I know tools like Cacti can create the graphs I'm looking for, but I have Domoticz running (and not Cacti).

So, does anybody know if it is possible to monitor a Cisco device by SNMP with Domoticz and add it to the Domoticz dash showing graphs with the actual used bandwidth over time?
Google doesn't give much info here.......
benedict
Posts: 16
Joined: Thursday 16 December 2021 16:05
Target OS: Linux
Domoticz version:
Contact:

Re: [internet sensor] speedtest.net measures

Post by benedict »

NLToontje wrote: Monday 30 March 2020 20:53 I was looking for a possibility to read the actual up- and download bandwidth from my Cisco router by SNMP using Domoticz. So, not the max. up and download speed as tested by this script, but the real network utilisation.

I know tools like Cacti can create the graphs I'm looking for, but I have Domoticz running (and not Cacti).

So, does anybody know if it is possible to monitor a Cisco device by SNMP with Domoticz and add it to the Domoticz dash showing graphs with the actual used bandwidth over time?
Google doesn't give much info here.......
I'm looking for the same thing. Did you find something to show the actual data/traffic usage per day, week, month? I.e. find out what the total data transferred to/from the internet would be. It's remarkable how few tools calculate this, while it's the most important marker these days. We all pay for it, not for the speeds we get, but for the data we transfer within x time.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest