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

safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: monitor internet connection with virtual sensors

Post by safi78 »

here you go: http://bfy.tw/8M8R
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
Amster
Posts: 4
Joined: Thursday 07 January 2016 12:45
Target OS: Linux
Domoticz version:
Location: Almere, The Netherlands
Contact:

Re: monitor internet connection with virtual sensors

Post by Amster »

Hello,

Im very interested in this project.

I run into some problems however.

I cannot select a custom sensor setting
I see that in the screen shots on the 1st page of this thread they are defined as "General, Custom Sensor".
In my Domoticz i can select "Dummy (Does nothing, use for virtual switches only)" in settings -> hardware
So i created 3 dummies, but when i try to create a Virtual Sensor i canot find a Custom Sensor.
I did tried some of the given sensors, but they don't look right.

If i create Decibel sensors and if i use those IDX i can see that the correct vallues are passed on to Domoticz by the script.
I only need to find a way to create an custom sensor.

Any advice is welcome.

Kind regards, and keep up this good work.
Amster
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: monitor internet connection with virtual sensors

Post by safi78 »

Do you use the stable version?

I believe the custom sensors are available in the beta version only. Not sure though.

Regards.
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
simonfr
Posts: 16
Joined: Sunday 13 March 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: monitor internet connection with virtual sensors

Post by simonfr »

Just wanted to say thanks for this. Had to go from a stable to Beta release to get the custom sensors, but works a treat. Well, I say that, but it initially worked for about a day before the script couldn't retrieve any information about servers from speedtest.net. No obvious reason why, but installing a Python version seems to have gotten round it. Script is running every half hour and I'm wondering if it was getting blocked somewhere.
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: monitor internet connection with virtual sensors

Post by safi78 »

I think they are both Python scripts, but the one in the repo and the one you install manually uses different url's to fetch the serverlist from. I believe its http://www.blabla and http://c.blabla. The www-one sometimes doesn't return the serverlist. Seen that as well.

Anyway, glad you like it!
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
mikeoo
Posts: 110
Joined: Sunday 22 March 2015 7:35
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Holland
Contact:

Re: monitor internet connection with virtual sensors

Post by mikeoo »

I got this working and always nice to expand Domoticz with this kind of stuff.

Only problem i noticed. When the Raspberry 2 runs the job wit a specific server i get

Running speedtest-cli on Raspberry
Image

When Domoticz update the switches i immediately start the same test on my Pc on speedtest.net with the same server and i get

Running speedtest.net on Pc
Image

I then installed (speedtest-cli) on my Synology NAS DS214+ and run the script from the NAS with 1Gb network connection but ping keeps high.

Running speedtest-cli on Synology
Image

I know the Rasp have only 100 Mbps connection so that part i understand.
But ping is way different every time.

My Raps and PC are connected to the same switch and same type of network cable.

Any ideas why this is so different.
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: monitor internet connection with virtual sensors

Post by guantolento »

good morning. i think to take the same direction indicate to safi78, but if i execute the script from ssh this is the reply:

pi@raspberrypi:~/script$ ./testadsl.sh
ping = ms
download = Mbps
upload = Mbps
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: *
Set-Cookie: SID=bb72a46874fffe45f53e0b5d3b922aa1_ZGJkMTY2NDQtMDA2OS00NDczLThiMzc tZmQwMzMyNzdmN2Y4.1478013487; path=/; Expires=Tue, 01 Nov 2016 15:18:07 GMT

{
"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: *
Set-Cookie: SID=d03af03e442febd75c6d6c33b6df1286_YjdkNjNiMjktNGU2Yy00YzVhLTgwNzY tOTg2NDZkNzE1OThj.1478013487; path=/; Expires=Tue, 01 Nov 2016 15:18:07 GMT

{
"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: *
Set-Cookie: SID=7053b29cb2a445f81894b37c4bb62f79_YzA3YzIzZjItZDJhNy00NmZjLTg4MWE tMzg5ZDUwNjQyNjg3.1478013487; path=/; Expires=Tue, 01 Nov 2016 15:18:07 GMT

{
"status" : "ERR"
}

can you help me ? in domoticz nothing running on the 3 virtual sensor.
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: monitor internet connection with virtual sensors

Post by safi78 »

Hi guantolento,

This happens when the speedtest command does not get a serverlist (see explaination above).

And due to bad programming, I don't do error-checking on that ;)

So either install the Python version with pip, or change the url in the package to the right one.

speedtest_cli.py is located at /usr/lib/python2.7/dist-packages

change:

Code: Select all

uh = urlopen('http://www.speedtest.net/speedtest-servers-static.php')
to:

Code: Select all

uh = urlopen('http://c.speedtest.net/speedtest-servers-static.php')
At least, that fixed it for me, I installed speedtest-cli with apt-get.

Maybe it helps.
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: monitor internet connection with virtual sensors

Post by safi78 »

mikeoo wrote:Any ideas why this is so different.
I would not be surprised if the Raspberry Pi has alot of limitations (CPU, MEM, throughput) that influence your speed. It's not built for speed ;)

And 21.5000ms in Domoticz is 21,5ms in human numbers ... maybe that's why it looks different?
Last edited by safi78 on Tuesday 01 November 2016 17:07, edited 1 time in total.
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: monitor internet connection with virtual sensors

Post by guantolento »

Ok, i try these solution.

Inviato dal mio GT-I9301I utilizzando Tapatalk
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
Marci
Posts: 531
Joined: Friday 22 January 2016 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Wakefield, West Yorkshire UK
Contact:

Re: monitor internet connection with virtual sensors

Post by Marci »

mikeoo wrote: I know the Rasp have only 100 Mbps connection so that part i understand.
But ping is way different every time.

My Raps and PC are connected to the same switch and same type of network cable.

Any ideas why this is so different.
See here
Essentially, system load of the Pi at the exact time the ping is received / responded to will have dramatic affects on the ping time. The same applies to your NAS. These are not devices with dedicated processors - these are embedded low power devices.
"The Raspberry Pi Model B has a Fast Ethernet port with a nominal transfer rate of 100Mbps, which restricts the throughput to about 10MBps. Because the corresponding chip resides on the USB bus, it shares its throughput with other connected devices, such as USB hard drives. Also, the fairly simple module causes a higher CPU load than its contemporaries on typical desktop boards.”
Just the CPU load increase of running the test will be enough to impact on the test’s results.
Last edited by Marci on Friday 04 November 2016 18:37, edited 2 times in total.
Extended Domoticz homebridge-plugin for latest Homebridge - adds temp/humidity/pressure sensors, power consumption sensors, DarkSkies virtual weather station support, YouLess Meter support, general % usage support & switch/lamp status checking!
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: monitor internet connection with virtual sensors

Post by guantolento »

safi78 wrote:Hi guantolento,

This happens when the speedtest command does not get a serverlist (see explaination above).

And due to bad programming, I don't do error-checking on that ;)

So either install the Python version with pip, or change the url in the package to the right one.

speedtest_cli.py is located at /usr/lib/python2.7/dist-packages

change:

Code: Select all

uh = urlopen('http://www.speedtest.net/speedtest-servers-static.php')
to:

Code: Select all

uh = urlopen('http://c.speedtest.net/speedtest-servers-static.php')
At least, that fixed it for me, I installed speedtest-cli with apt-get.

Maybe it helps.
but, when i try to modifi the line in question appared "permission denied"

PS all ok, after these set the system it's ok.
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: monitor internet connection with virtual sensors

Post by safi78 »

guantolento wrote:PS all ok, after these set the system it's ok.
Good to hear :)

Enjoy!
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
mikeoo
Posts: 110
Joined: Sunday 22 March 2015 7:35
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Holland
Contact:

Re: monitor internet connection with virtual sensors

Post by mikeoo »

safi78 wrote:
mikeoo wrote:Any ideas why this is so different.
I would not be surprised if the Raspberry Pi has alot of limitations (CPU, MEM, throughput) that influence your speed. It's not built for speed ;)

And 21.5000ms in Domoticz is 21,5ms in human numbers ... maybe that's why it looks different?
Tru, but the last prinscreen is the same but running Speedtest-cli on my NAS and I would think that this one must a better job but same outcome.

Update:
I now did the test both on my PC.

First with speedtest.net and get 8m/s
Then Speetest-cli in Windows and get 12m/s

So indeed it looks like the hardware defines the ping speed.
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: monitor internet connection with virtual sensors

Post by safi78 »

Doesn't your test result prove that speedtest-cli and the webclient on pc might produce different results then?

Maybe the python script is more efficient then running it in a browser? :)
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
borgkitty
Posts: 34
Joined: Wednesday 26 October 2016 21:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Contact:

Re: monitor internet connection with virtual sensors

Post by borgkitty »

So question on the dummy sensors, I have created a dummer sensor in the hardware but when I go to devices which sensor type do I select? counter? I have tried this and it appears to be kw/h
Would it be text then?
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: monitor internet connection with virtual sensors

Post by safi78 »

You create a 'Virtual Sensor' of the Sensor Type 'Custom Sensor'.
Screen Shot 2016-11-02 at 17.20.52.png
Screen Shot 2016-11-02 at 17.20.52.png (138.14 KiB) Viewed 3512 times
Last edited by safi78 on Thursday 03 November 2016 18:29, edited 1 time in total.
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
borgkitty
Posts: 34
Joined: Wednesday 26 October 2016 21:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Contact:

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

Post by borgkitty »

lol well I am idiot I appreciate that. I was thinking "custom" was referring to with in specific sensor.
annnd just found out it won't give me accurate results because I am running on the original rpi which is 10/100 and it doesn't give me correct results
tested the cmd line and it only gives me 50mbs yet I have 200 and on lan with laptop I get full 200.
might have to find a small 10/1000 module somewhere and run it as a external sensor that my existing pi queries
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 to everyone.
i take some test and i don't know why, but in the same time i have 2 different result from the test from pc and from rpi.
rpi give me download 4.84, pc 10.84, while for the upload is the same rpi 0.82, pc 0.87, and the ping is the same 33 ms on rpi and pc.
why the download test is so different ????
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:hi to everyone.
i take some test and i don't know why, but in the same time i have 2 different result from the test from pc and from rpi.
rpi give me download 4.84, pc 10.84, while for the upload is the same rpi 0.82, pc 0.87, and the ping is the same 33 ms on rpi and pc.
why the download test is so different ????
If you had read 8 posts up in this thread, Marci gives a very good explanation and a link why RPI's have shitty results. Cheap and fun, but not built for speed.
Marci wrote: See http://www.raspberry-pi-geek.com/Archiv ... (offset)/4
Essentially, system load of the Pi at the exact time the ping is received / responded to will have dramatic affects on the ping time. The same applies to your NAS. These are not devices with dedicated processors - these are embedded low power devices.
"The Raspberry Pi Model B has a Fast Ethernet port with a nominal transfer rate of 100Mbps, which restricts the throughput to about 10MBps. Because the corresponding chip resides on the USB bus, it shares its throughput with other connected devices, such as USB hard drives. Also, the fairly simple module causes a higher CPU load than its contemporaries on typical desktop boards.”
Just the CPU load increase of running the test will be enough to impact on the test’s results.
It can probably handle 4.84Mbps throughout the whole system, because it's slow AND has to share resources with other hardware as well.

Therefore, the upload is well within the ~5Mbps it can handle, so it's about the same result (you have 10Mbps down / 1Mbps up?) and the ping is a whole different story alltogether.

I made this to monitor an internet connection, so run it on a machine that can handle at least the bandwidth you want to measure and expect, it's not an RPI benchmarking tool ;)

Good luck!
Last edited by safi78 on Thursday 03 November 2016 18:45, edited 2 times in total.
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest