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.

Moderator: leecollings

bertbigb
Posts: 147
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 »

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:$password@$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 DS1517+ - DSM 6.2
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: 147
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 »

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

Synology DS1517+ - DSM 6.2
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: 31
Joined: Friday 24 February 2017 12:01
Target OS: Windows
Domoticz version:
Contact:

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

Post by ilpier »

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: 31
Joined: Friday 24 February 2017 12:01
Target OS: Windows
Domoticz version:
Contact:

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

Post by ilpier »

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

Thx too much!
bertbigb
Posts: 147
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 »

ilpier wrote:Now Work,reboot and work with first:
curl -s -i -H "Accept: application/json" "http://$username:$password@$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 DS1517+ - DSM 6.2
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: 5
Joined: Sunday 13 November 2016 10:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Brisbane, Australia
Contact:

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

Post by visser »

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 6195 times
screenshot-speedtestdom2.jpg
screenshot-speedtestdom2.jpg (186.16 KiB) Viewed 6195 times
(Big drop off in speed moving from Hamburg, Germany to Brisbane, Australia)

Ping:
screenshot-speedtestdom3.jpg
screenshot-speedtestdom3.jpg (169.98 KiB) Viewed 6195 times
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

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

Post by safi78 »

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:
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
User avatar
gielie
Posts: 290
Joined: Tuesday 12 January 2016 11:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest β
Location: The Netherlands (Alkmaar)
Contact:

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

Post by gielie »

@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.
- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
User avatar
gielie
Posts: 290
Joined: Tuesday 12 January 2016 11:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest β
Location: The Netherlands (Alkmaar)
Contact:

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

Post by gielie »

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?
- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

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

Post by safi78 »

gielie wrote:ps. Is it possible to create a report from the log?
What do you mean?
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
Trigun
Posts: 390
Joined: Wednesday 30 November 2016 11:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

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

Post by Trigun »

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: 147
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 »

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 DS1517+ - DSM 6.2
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: 147
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 »

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 DS1517+ - DSM 6.2
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: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

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

Post by guantolento »

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
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

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

Post by safi78 »

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!
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
Trigun
Posts: 390
Joined: Wednesday 30 November 2016 11:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

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

Post by Trigun »

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 5614 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: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

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

Post by freijn »

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 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by dbfan »

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: 390
Joined: Wednesday 30 November 2016 11:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

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

Post by Trigun »

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: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

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

Post by freijn »

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: Google [Bot] and 1 guest