How to monitor your internet connection with virtual custom sensors

Client tools or tools that can connect with Domoticz. Tools for Windows, iOS, Android, Linux etc.
bertbigb
Posts: 134
Joined: Thursday 13 August 2015 13:36
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: Netherlands
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by bertbigb » Friday 19 May 2017 12:32

Hi ilpier, nice that you have at least output in the txt file.

ok, please check if all the parameters are OK:

port=8080
username=Admin
password=***
host=localhost
pingidx=239
downloadidx=241
uploadidx=240

If that is the case then change:

curl -s -i -H "Accept: application/json" "http://$username:[email protected]$host:$port/json.htm type=command&param=udevice&idx=$pingidx&svalue=$ping"

to

curl -s -i -H "Accept: application/json" "http://Admin:***@localhost:8080/json.ht ... svalue=245"

and lets see if the ping on domoticz then get the value 245
Best regards Bert

Synology DS1515+ - DSM 6.1
Raspberry PI2 - B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon

bertbigb
Posts: 134
Joined: Thursday 13 August 2015 13:36
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: Netherlands
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by bertbigb » Friday 19 May 2017 12:32

of course change the *** to your password :-)
Best regards Bert

Synology DS1515+ - DSM 6.1
Raspberry PI2 - B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon

ilpier
Posts: 38
Joined: Friday 24 February 2017 13:01
Target OS: Windows
Domoticz version:
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by ilpier » Friday 19 May 2017 13:52

yes of course i've insert the correct password!
But no,nothing happen in Domoticz with the modify
curl -s -i -H "Accept: application/json" "http://Admin:***@localhost:8080/json.ht ... svalue=245"

ilpier
Posts: 38
Joined: Friday 24 February 2017 13:01
Target OS: Windows
Domoticz version:
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by ilpier » Friday 19 May 2017 15:35

Now Work,reboot and work with first:
curl -s -i -H "Accept: application/json" "http://$username:[email protected]$host:$port/json.htm type=command&param=udevice&idx=$pingidx&svalue=$ping"

Thx too much!

bertbigb
Posts: 134
Joined: Thursday 13 August 2015 13:36
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: Netherlands
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by bertbigb » Friday 19 May 2017 15:38

ilpier wrote:Now Work,reboot and work with first:
curl -s -i -H "Accept: application/json" "http://$username:[email protected]$host:$port/json.htm type=command&param=udevice&idx=$pingidx&svalue=$ping"

Thx too much!
Good to hear, lots of fun with it!
Best regards Bert

Synology DS1515+ - DSM 6.1
Raspberry PI2 - B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon

visser
Posts: 11
Joined: Sunday 13 November 2016 11:11
Target OS: Raspberry Pi
Domoticz version: beta
Location: Brisbane, Australia
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by visser » Tuesday 20 June 2017 7:36

I'm really happy with the speed monitoring, it's been running since last year.

Download speed:
screenshot-speedtestdom1.jpg
screenshot-speedtestdom1.jpg (170.78 KiB) Viewed 886 times
screenshot-speedtestdom2.jpg
screenshot-speedtestdom2.jpg (186.16 KiB) Viewed 886 times
(Big drop off in speed moving from Hamburg, Germany to Brisbane, Australia)

Ping:
screenshot-speedtestdom3.jpg
screenshot-speedtestdom3.jpg (169.98 KiB) Viewed 886 times

User avatar
safi78
Posts: 460
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Location: Alkmaar, NL
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by safi78 » Tuesday 20 June 2017 9:54

visser wrote:I'm really happy with the speed monitoring, it's been running since last year.
Glad you like it :)

I never expected my simple script would attract such a large audience haha :lol:
I don't know if you noticed or not, but I'm an extremely arrogant man who tends to think all of his plans will work ...

https://safiweb.nl

homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz

User avatar
gielie
Posts: 162
Joined: Tuesday 12 January 2016 12:40
Target OS: Raspberry Pi
Domoticz version: latest β
Location: The Netherlands (Alkmaar)
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by gielie » Tuesday 20 June 2017 12:30

@safi
Tanks for the script, i changed it a little bit to use it on my Synology and send the data to my Domoticz Pi. Works great. Now to monitor my Ziggo account so i can complain about the slow speeds.
- Vision ZU1401 USB Stick
- Aeotec MultiSensor 6
- FIBARO FGS222
- FIBARO FGWPE Wall Plug
- Everspring AN157
- Neo CoolCam Power plug
- Neo CoolCam PIR Sensor
- Popp Smoke Detector
- Toon
- Kodi Media Server

User avatar
gielie
Posts: 162
Joined: Tuesday 12 January 2016 12:40
Target OS: Raspberry Pi
Domoticz version: latest β
Location: The Netherlands (Alkmaar)
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by gielie » Thursday 22 June 2017 9:59

gielie wrote:@safi
Tanks for the script, i changed it a little bit to use it on my Synology and send the data to my Domoticz Pi. Works great. Now to monitor my Ziggo account so i can complain about the slow speeds.

ps. Is it possible to create a report from the log?
- Vision ZU1401 USB Stick
- Aeotec MultiSensor 6
- FIBARO FGS222
- FIBARO FGWPE Wall Plug
- Everspring AN157
- Neo CoolCam Power plug
- Neo CoolCam PIR Sensor
- Popp Smoke Detector
- Toon
- Kodi Media Server

User avatar
safi78
Posts: 460
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Location: Alkmaar, NL
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by safi78 » Tuesday 25 July 2017 13:45

gielie wrote:ps. Is it possible to create a report from the log?
What do you mean?
I don't know if you noticed or not, but I'm an extremely arrogant man who tends to think all of his plans will work ...

https://safiweb.nl

homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz

Trigun
Posts: 180
Joined: Wednesday 30 November 2016 12:58
Target OS: Raspberry Pi
Domoticz version: 3.5877
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by Trigun » Wednesday 26 July 2017 22:00

hi guys, I had it running well on my synology NAS unitll I decided To reinstall my NAS.
is there a chance anyone can help me out how to install it on my nas?
I already put the two files in a folder but I also need to install it am totaly lost.

Thx in advance!

bertbigb
Posts: 134
Joined: Thursday 13 August 2015 13:36
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: Netherlands
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by bertbigb » Wednesday 30 August 2017 20:48

EdwinK wrote:
Tuesday 18 April 2017 19:54
Running this on a Synology NAS too, and had it working in matter of minutes.

Synology doesn't have apt-get, so you need to find another way to get the files. I used easy_install, but can't quite remember how I did install that.
Search for easy_install and Synology on the Google.
When someone search how to install on Synology --> this might be helpful
https://pypi.python.org/pypi/speedtest-cli/
Best regards Bert

Synology DS1515+ - DSM 6.1
Raspberry PI2 - B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon

bertbigb
Posts: 134
Joined: Thursday 13 August 2015 13:36
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: Netherlands
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by bertbigb » Wednesday 30 August 2017 20:52

Trigun wrote:
Wednesday 26 July 2017 22:00
hi guys, I had it running well on my synology NAS unitll I decided To reinstall my NAS.
is there a chance anyone can help me out how to install it on my nas?
I already put the two files in a folder but I also need to install it am totaly lost.

Thx in advance!
Sorry for the late reply

Try this to download speedtest-cli --> https://pypi.python.org/pypi/speedtest-cli/
and follow this wiki --> https://www.domoticz.com/wiki/Bash_-_Sp ... monitoring

Let me know where you get stucked when you are not successful, but i think you will :D
Best regards Bert

Synology DS1515+ - DSM 6.1
Raspberry PI2 - B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon

guantolento
Posts: 166
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by guantolento » Tuesday 05 September 2017 23:45

Hi, it is possible send the result of the test with telegram in a bot ?
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F

User avatar
safi78
Posts: 460
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Location: Alkmaar, NL
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by safi78 » Wednesday 06 September 2017 9:06

guantolento wrote:
Tuesday 05 September 2017 23:45
Hi, it is possible send the result of the test with telegram in a bot ?
Yes.

Use the search function, there's alot of information about that in countless threads on how to do that.

Good luck!
I don't know if you noticed or not, but I'm an extremely arrogant man who tends to think all of his plans will work ...

https://safiweb.nl

homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz

Trigun
Posts: 180
Joined: Wednesday 30 November 2016 12:58
Target OS: Raspberry Pi
Domoticz version: 3.5877
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by Trigun » Sunday 17 September 2017 20:51

hi all, I finally managed to install speedtest on my synology.
when I run speedtest-cli I get results.
but when I try to run the script, it doesn't work.
when I run I get the following errors:
Knipsel2.PNG
Knipsel2.PNG (13.06 KiB) Viewed 305 times
Line 2 and line 11 are empty lines.

Code: Select all

#!/bin/bash

#setup
host=192.168.1.21
port=8084
pingidx=3
downloadidx=1
uploadidx=2

# no need to edit
speedtest-cli --simple > output.txt
ping=$(cat output.txt | sed -ne 's/^Ping: \([0-9]*\.[0-9]*\).*/\1/p')
download=$(cat output.txt | sed -ne 's/^Download: \([0-9]*\.[0-9]*\).*/\1/p')
upload=$(cat output.txt | sed -ne 's/^Upload: \([0-9]*\.[0-9]*\).*/\1/p')

#output if you run it manually
echo "ping = $ping ms"
echo "download = $download Mbps"
echo "upload =  $upload Mbps"

curl -s -i -H "Accept: application/json" "http://$host:$port/json.htm?type=command&param=udevice&idx=$pingidx&svalue=$ping"
curl -s -i -H "Accept: application/json" "http://$host:$port/json.htm?type=command&param=udevice&idx=$downloadidx&svalue=$download"
curl -s -i -H "Accept: application/json" "http://$host:$port/json.htm?type=command&param=udevice&idx=$uploadidx&svalue=$upload"
strange thing is that I do get an "output.txt" file, but nothing in domoticz.

can anyone help me out here?

freijn
Posts: 150
Joined: Friday 23 December 2016 17:40
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands Purmerend
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by freijn » Tuesday 19 September 2017 11:53

As far as my knowledge goes \r is a dos<=>unix issue.

Please open the file in a good editor and see your CarageReturns and Linefeed at then end of each line.

dbfan
Posts: 10
Joined: Wednesday 25 March 2015 22:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by dbfan » Thursday 21 September 2017 14:03

Hi guys,
I am running this script successfully nowsince 1 year, but yesterday internet connection dropped for 4 hrs (Ziggo storing) and I found out that the last value continues (sensor "last seen" did not change). So, no drop to zero for "download speed" f.i.
What needs to be changed in the script to force a zero value when there is no connection at all ?

thnx, dbfan

Trigun
Posts: 180
Joined: Wednesday 30 November 2016 12:58
Target OS: Raspberry Pi
Domoticz version: 3.5877
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by Trigun » Friday 22 September 2017 15:43

freijn wrote:
Tuesday 19 September 2017 11:53
As far as my knowledge goes \r is a dos<=>unix issue.

Please open the file in a good editor and see your CarageReturns and Linefeed at then end of each line.
Hi freijn,

i am using an exact copy of the script being used(with my own info)
not sure where it goed wrong, Ik keep getting the error.

the result is that I do get an output.txt file but no data is send to domoticz

Grtz

freijn
Posts: 150
Joined: Friday 23 December 2016 17:40
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands Purmerend
Contact:

Re: How to monitor your internet connection with virtual custom sensors

Post by freijn » Monday 25 September 2017 11:55

Hi Trigun,

You wrote "(with my own info)" So you did edit the file and therefore changed it.

please read this :
https://stackoverflow.com/questions/186 ... -not-found

or search in Google on your error message : '\r': command not found [duplicate]

What OS system are you using edditing the file?
You could put the ORIGINAL ! file on the domoticz system and start editing using nano.
Doing so I am 100% you will not see this '\r' error again :-)

Cheers,

Frank

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests