Page 11 of 13
Re: How to monitor your internet connection with virtual custom sensors
Posted: Thursday 06 June 2019 18:09
by Snowtiger
alacran wrote:Hello
for an other script, I needed to update Python from 2.7 (if I remember well) to 3.4.4.
Since that, my speed_test.sh did not work.
When I trie to execute it, I've got this error message:
pi@Domoticz:~/domoticz/scripts/Perso $ ./test_internet.sh
Traceback (most recent call last):
File "/usr/bin/speedtest-cli", line 6, in <module>
from pkg_resources import load_entry_point
ImportError: No module named 'pkg_resources'
Is there a difference between Python version?
How can I solved it?
Thank you
pkg_resources is part of setuptools - If you installed a new Python you may have to install setuptools again -
If it not works try adding sudo in front.
Re: How to monitor your internet connection with virtual custom sensors
Posted: Thursday 06 June 2019 20:01
by alacran
When I try (cause I am not an Python Expert):
sudo python -m pip install setuptools
I obtain:
/usr/bin/python: No module named pip
Otherwise
pi@Domoticz:~ $ python
Python 3.4.4 (default, Apr 17 2016, 16:02:33)
[GCC 5.3.1 20160409] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> pip install setuptools
File "<stdin>", line 1
pip install setuptools
^
SyntaxError: invalid syntax
How to monitor your internet connection with virtual custom sensors
Posted: Thursday 06 June 2019 21:47
by Snowtiger
No Python in front - type the comand as stated in previous message

Pip installs Python packages and is a tool itself.
Re: How to monitor your internet connection with virtual custom sensors
Posted: Thursday 06 June 2019 22:19
by alacran
My bad, I did not insert the output for your command
pi@Domoticz:~ $ pip install setuptools
-bash: pip: command not found
Thé same with sudo

Re: How to monitor your internet connection with virtual custom sensors
Posted: Friday 07 June 2019 0:44
by Snowtiger
I am sorry, assumed pip was already installed, use following command
Code: Select all
sudo apt install python3-venv python3-pip
Re: How to monitor your internet connection with virtual custom sensors
Posted: Friday 07 June 2019 10:02
by alacran
No, I AM SORRY !
Seriously..
I executed yoru command one first time:
pi@Domoticz:~ $sudo apt install python3-venv python3-pip
(...) All is ok (...)Then (...)
Errors were encountered while processing:
speedtest-cli
E: Sub-process /usr/bin/dpkg returned an error code (1)
pi@Domoticz:~ $
If I exxecute it a second time
pi@Domoticz:~ $ sudo apt install python3-venv python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-venv is already the newest version (3.5.3-1).
python3-pip is already the newest version (9.0.1-2+rpt2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up python-pkg-resources (33.1.1-1) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error processing package python-pkg-resources (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of speedtest-cli:
speedtest-cli depends on python-pkg-resources; however:
Package python-pkg-resources is not configured yet.
dpkg: error processing package speedtest-cli (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-pkg-resources
speedtest-cli
E: Sub-process /usr/bin/dpkg returned an error code (1)
What's wrong with me ?
always unknonwn...
Can I remove all Python package ans perform a fresh install?
I followed these step to update python the first time to install python 3.4 instead of 2.7 (if I remember well)
Code: Select all
sudo apt–get install python3.4 libpython3.4 python3.4–dev
sudo update-alternatives –install /usr/bin/python python3 /usr/bin/python3.4 2
Re: How to monitor your internet connection with virtual custom sensors
Posted: Friday 07 June 2019 12:34
by Snowtiger
Hmmmm, sadly I have to conclude this goes above my Python, pip and Debian package knowledge - maybe someone else with more knowledge about this can help you further.
If you get no help in this topic, it might be an option to put your problem into a seperate topic in this forum with Python pip install, or something like that, in the topic title so you draw attention to it of an other audience then now present in this topic.
Re: How to monitor your internet connection with virtual custom sensors
Posted: Wednesday 12 June 2019 22:35
by alacran
Thank you for your time.
I opened a new topic here if someone have the same issue...
https://www.domoticz.com/forum/viewtopi ... 65&t=28339
Re: How to monitor your internet connection with virtual custom sensors
Posted: Friday 17 January 2020 9:46
by manjh
Not sure if this has not been asked before in this long thread.....
Would it be possible to package all of this, so it can be easely installed by adding a Domoticz HW?
Re: How to monitor your internet connection with virtual custom sensors
Posted: Sunday 19 January 2020 16:01
by freijn
Your 'pkg_resources' is not available in the Python3 path.
Re-install under python3 and it will work again.
something like this:
sudo apt-get install python-pkg-resources
Re: How to monitor your internet connection with virtual custom sensors
Posted: Saturday 07 March 2020 12:48
by manjh
I run speedtest on my R-Pi model 3 every six hours, and the download value seems very low, compared to the results of a speedtest on my browser. Upload value is OK.
What could cause this? Seems to me that the Pi is fast enough. Could it be a bad SD card?
Re: How to monitor your internet connection with virtual custom sensors
Posted: Saturday 07 March 2020 14:23
by FireWizard
Hello Hans,
You wrote:
the download value seems very low, compared to the results of a speedtest on my browser. Upload value is OK.
You don't mention, what the download speed is. And what you expect, that is should be according to your browser.
And, do you really mean your download speed and not your upload speed, as there is bug in de speedtest-cli program distributed in the raspbian repos.
See:
https://www.domoticz.com/forum/viewtopi ... 03#p236103.
Another issue is that the raspberry pi models 3 and lower, limit the speed, because of their Ethernet port.
See:
https://magpi.raspberrypi.org/articles/ ... benchmarks (Ethernet throughput)
If you have a high speed download link, let's say 500 Mbps, it it is not correctly represented by speedtest on the Raspberry Pi 3B+ or lower.
In this case you have to do something else.
Regards
Re: How to monitor your internet connection with virtual custom sensors
Posted: Tuesday 05 May 2020 12:21
by Rolandet
FireWizard wrote: ↑Saturday 07 March 2020 14:23
Hello Hans,
You wrote:
the download value seems very low, compared to the results of a speedtest on my browser. Upload value is OK.
You don't mention, what the download speed is. And what you expect, that is should be according to your browser.
And, do you really mean your download speed and not your upload speed, as there is bug in de speedtest-cli program distributed in the raspbian repos.
See:
https://www.domoticz.com/forum/viewtopi ... 03#p236103.
Another issue is that the raspberry pi models 3 and lower, limit the speed, because of their Ethernet port.
See:
https://magpi.raspberrypi.org/articles/ ... benchmarks (Ethernet throughput)
If you have a high speed download link, let's say 500 Mbps, it it is not correctly represented by speedtest on the Raspberry Pi 3B+ or lower.
In this case you have to do something else.
Regards
Thanks for mentioning that upload issue. I have the same issue, ever since I've upgraded Python to 3.7
Before that I got a steady 90/95 mbit up, and now it sticks to 4 (according to the script).
If it's a 3+ or lower issue, then I won't bother, and wait for my pi4 to arrive

Re: How to monitor your internet connection with virtual custom sensors
Posted: Tuesday 05 May 2020 14:02
by FireWizard
Hi,
@Rolandet,
What I wanted to say, is that a bug exists in the speedtest-cli in the Raspbian repo.
You can simply solve it by pulling it from github:
https://github.com/sivel/speedtest-cli.
Another issue we see, is that the internet providers are going to offer faster speeds, which cannot be handled by earlier generations of the Raspberry Pi.
Regards
Re: How to monitor your internet connection with virtual custom sensors
Posted: Tuesday 05 May 2020 14:04
by Rolandet
FireWizard wrote: ↑Tuesday 05 May 2020 14:02
Hi,
@Rolandet,
What I wanted to say, is that a bug exists in the speedtest-cli in the Raspbian repo.
You can simply solve it by pulling it from github:
https://github.com/sivel/speedtest-cli.
Another issue we see, is that the internet providers are going to offer faster speeds, which cannot be handled by earlier generations of the Raspberry Pi.
Regards
Yeah I was just reading your
topic about that.
update: perform the
action, and my problem is solved. Thanks for that !
Re: How to monitor your internet connection with virtual custom sensors
Posted: Wednesday 06 May 2020 23:04
by cr1cr1
Hi,
I've been using Speedtest-cli & st2domo.py for several years now. I was on a DSL line, with a Pi2.
I migrated to a Fiber line (D/L went from 8 to 940Mbit/s and U/L from 0.8 to 430 !) as well as migrated my RPi2 to a bran new RPi4, 2GB on a brand new Raspbian install.
I bumped into the upload issue (showed 4Mbit/s) of the speedtest-cli bug from the Raspbian repository. I downloaded speedtest again from Github and it improved quite a bit.
When doing some research, I also tested Speedtest++ (see :
https://github.com/taganaka/SpeedTest ) that seems to be more reliable & consistent.
Any volonteer to adapt the st2domo.sh script to use the new output format of speedtest++ ?

Re: How to monitor your internet connection with virtual custom sensors
Posted: Wednesday 06 May 2020 23:26
by FireWizard
Hi,
With such fantastic D/L and U/L speed it is probably better to run the original speedtest from Ookla. For the cli version, see:
https://www.speedtest.net/nl/apps/cli.
You can even run it on a different machine, as MQTT is supported.
I run it on my gateway/server and the values are pushed to the MQTT server.
Next step is a little bit Node Red and send it to Domoticz.
For details see: .
https://www.domoticz.com/forum/viewtopi ... la#p241182
Regards
Re: How to monitor your internet connection with virtual custom sensors
Posted: Wednesday 06 May 2020 23:38
by cr1cr1
Well, the RPi 4 is managing the flow quite well by itself, look at the results of the above speedtest++ :
Code: Select all
pi@Raspberry-Pi4-Domoticz:~/SpeedTest $ /usr/local/bin/SpeedTest
SpeedTest++ version 1.14
Speedtest.net command line interface
Info: https://github.com/taganaka/SpeedTest
Author: Francesco Laurita <[email protected]>
IP: 82.98.31.89 ( Ozone SAS ) Location: [48.9548, 1.8223]
Finding fastest server... 1000 Servers online
............
Server: Paris speedtest.naitways.net:8080 by Naitways (39.3762 km from you): 3 ms
Ping: 3 ms.
Jitter: 0 ms.
Determine line type (2) ........................
Fiber / Lan line type detected: profile selected fiber
Testing download speed (32) .................................................................................................................................................................
.......................................................................................................................
Download: 938.60 Mbit/s
Testing upload speed (12) ...................................................................................................................................................................
...........................................................................................................
Upload: 428.32 Mbit/s
Re: How to monitor your internet connection with virtual custom sensors
Posted: Wednesday 06 May 2020 23:41
by FireWizard
Hi,
You can install the Ookla speedtest directly on the Pi4.
Regards
Re: How to monitor your internet connection with virtual custom sensors
Posted: Thursday 07 May 2020 12:56
by cr1cr1
FireWizard wrote: ↑Wednesday 06 May 2020 23:41
Hi,
You can install the Ookla speedtest directly on the Pi4.
Regards
OK thanks. I installed it and got it running well.
The speed reported by the Speedtest++ package is a bit higher though. I understood it uses raw data instead of TCP packets to measure the bandwitdh.
Ookla speedtest seems to measure the useful data bandwidth, without the TCP overhead.
But that's very fine as long as the test is consistent!