Page 3 of 13
Re: monitor internet connection with virtual sensors
Posted: Monday 24 October 2016 21:46
by safi78
Re: monitor internet connection with virtual sensors
Posted: Wednesday 26 October 2016 2:00
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
Re: monitor internet connection with virtual sensors
Posted: Wednesday 26 October 2016 4:00
by safi78
Do you use the stable version?
I believe the custom sensors are available in the beta version only. Not sure though.
Regards.
Re: monitor internet connection with virtual sensors
Posted: Sunday 30 October 2016 15:27
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.
Re: monitor internet connection with virtual sensors
Posted: Monday 31 October 2016 19:50
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!
Re: monitor internet connection with virtual sensors
Posted: Tuesday 01 November 2016 9:22
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
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
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
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.
Re: monitor internet connection with virtual sensors
Posted: Tuesday 01 November 2016 16:11
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.
Re: monitor internet connection with virtual sensors
Posted: Tuesday 01 November 2016 17:02
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.
Re: monitor internet connection with virtual sensors
Posted: Tuesday 01 November 2016 17:05
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?
Re: monitor internet connection with virtual sensors
Posted: Tuesday 01 November 2016 17:07
by guantolento
Ok, i try these solution.
Inviato dal mio GT-I9301I utilizzando Tapatalk
Re: monitor internet connection with virtual sensors
Posted: Tuesday 01 November 2016 17:12
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.
Re: monitor internet connection with virtual sensors
Posted: Tuesday 01 November 2016 18:04
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.
Re: monitor internet connection with virtual sensors
Posted: Tuesday 01 November 2016 18:48
by safi78
guantolento wrote:PS all ok, after these set the system it's ok.
Good to hear
Enjoy!
Re: monitor internet connection with virtual sensors
Posted: Wednesday 02 November 2016 8:26
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.
Re: monitor internet connection with virtual sensors
Posted: Wednesday 02 November 2016 9:04
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?

Re: monitor internet connection with virtual sensors
Posted: Wednesday 02 November 2016 17:17
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?
Re: monitor internet connection with virtual sensors
Posted: Wednesday 02 November 2016 17:22
by safi78
You create a 'Virtual Sensor' of the Sensor Type 'Custom Sensor'.

- Screen Shot 2016-11-02 at 17.20.52.png (138.14 KiB) Viewed 3690 times
Re: How to monitor your internet connection with virtual custom sensors
Posted: Wednesday 02 November 2016 18:20
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
Re: How to monitor your internet connection with virtual custom sensors
Posted: Thursday 03 November 2016 18:31
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 ????
Re: How to monitor your internet connection with virtual custom sensors
Posted: Thursday 03 November 2016 18:35
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!