How to monitor your internet connection with virtual custom sensors
Moderator: leecollings
-
- Posts: 29
- Joined: Sunday 11 August 2019 17:24
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
Ah, i have to admit i do not know how to do that.
Off to google it.
Off to google it.
- Rolandet
- Posts: 95
- Joined: Thursday 31 January 2019 21:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: The Netherlands
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
Go to the directory where the script is located
run: sudo ./speedtest.sh
run: sudo ./speedtest.sh
Custodes Septentrionum
-
- Posts: 587
- Joined: Wednesday 16 December 2015 19:13
- Target OS: NAS (Synology & others)
- Domoticz version: 2022.2
- Location: Netherlands
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
does this also work from docker
i am getting this error
i am getting this error
Code: Select all
root@domoticz:/opt/domoticz/userdata/scripts# ./speedtest.sh
Traceback (most recent call last):
File "/usr/bin/speedtest-cli", line 11, in <module>
load_entry_point('speedtest-cli==2.0.2', 'console_scripts', 'speedtest-cli')()
File "/usr/lib/python3/dist-packages/speedtest.py", line 1887, in main
shell()
File "/usr/lib/python3/dist-packages/speedtest.py", line 1783, in shell
secure=args.secure
File "/usr/lib/python3/dist-packages/speedtest.py", line 1027, in __init__
self.get_config()
File "/usr/lib/python3/dist-packages/speedtest.py", line 1113, in get_config
map(int, server_config['ignoreids'].split(','))
ValueError: invalid literal for int() with base 10: ''
ping = ms
download = Mbps
upload = Mbps
-
- Posts: 107
- Joined: Monday 04 March 2019 14:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2025.1
- Location: France
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
Hello,
To tackle the issue I change the line 1112
ignore_servers = list(
map(int, server_config['ignoreids'].split(','))
)
and replaced it by:
ignore_servers = []
if server_config['ignoreids']!="":
ignore_servers = list(
map(int, server_config['ignoreids'].split(','))
)
This prevents the exception
Hoping it works for you too.
Best regards
To tackle the issue I change the line 1112
ignore_servers = list(
map(int, server_config['ignoreids'].split(','))
)
and replaced it by:
ignore_servers = []
if server_config['ignoreids']!="":
ignore_servers = list(
map(int, server_config['ignoreids'].split(','))
)
This prevents the exception
Hoping it works for you too.
Best regards
meal
-
- Posts: 587
- Joined: Wednesday 16 December 2015 19:13
- Target OS: NAS (Synology & others)
- Domoticz version: 2022.2
- Location: Netherlands
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
tried it but it generates more errors
root@domoticz:/usr/lib/python3/dist-packages# speedtest-cli
Traceback (most recent call last):
File "/usr/bin/speedtest-cli", line 11, in <module>
load_entry_point('speedtest-cli==2.0.2', 'console_scripts', 'speedtest-cli')()
File "/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py", line 474, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py", line 2846, in load_entry_point
return ep.load()
File "/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py", line 2450, in load
return self.resolve()
File "/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py", line 2456, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3/dist-packages/speedtest.py", line 1114
ignore_servers = list(
^
IndentationError: expected an indented block
root@domoticz:/usr/lib/python3/dist-packages# ^C
root@domoticz:/usr/lib/python3/dist-packages# speedtest-cli
Traceback (most recent call last):
File "/usr/bin/speedtest-cli", line 11, in <module>
load_entry_point('speedtest-cli==2.0.2', 'console_scripts', 'speedtest-cli')()
File "/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py", line 474, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py", line 2846, in load_entry_point
return ep.load()
File "/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py", line 2450, in load
return self.resolve()
File "/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py", line 2456, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3/dist-packages/speedtest.py", line 1114
ignore_servers = list(
^
IndentationError: expected an indented block
root@domoticz:/usr/lib/python3/dist-packages# ^C
-
- Posts: 107
- Joined: Monday 04 March 2019 14:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2025.1
- Location: France
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
Hello,
You have to replace the spaces by tabs to avoid the indentation problem.
I am using the text editor Notepad++ (in the Edit menu you will find the way to transform spaces by tabs).
Best regards
You have to replace the spaces by tabs to avoid the indentation problem.
I am using the text editor Notepad++ (in the Edit menu you will find the way to transform spaces by tabs).
Best regards
meal
-
- Posts: 107
- Joined: Monday 04 March 2019 14:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2025.1
- Location: France
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
Hello,
Here is the piece of code
Best regards
Here is the piece of code
Best regards
meal
-
- Posts: 587
- Joined: Wednesday 16 December 2015 19:13
- Target OS: NAS (Synology & others)
- Domoticz version: 2022.2
- Location: Netherlands
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
tried it again without luck. maybee drop your speedtest.py
another question, this thread is 13 pages long. why on earth is this problem not solved in the source
another question, this thread is 13 pages long. why on earth is this problem not solved in the source
-
- Posts: 107
- Joined: Monday 04 March 2019 14:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2025.1
- Location: France
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
Hello
You will find attached the file.
Unzip it and copy it to the relevant location on your computer.
Best regards
You will find attached the file.
Unzip it and copy it to the relevant location on your computer.
Best regards
- Attachments
-
- speedtest.zip
- (14.19 KiB) Downloaded 134 times
meal
-
- Posts: 587
- Joined: Wednesday 16 December 2015 19:13
- Target OS: NAS (Synology & others)
- Domoticz version: 2022.2
- Location: Netherlands
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
@meal
working perfectly now. thanks for helping me and others out.
working perfectly now. thanks for helping me and others out.
- Rolandet
- Posts: 95
- Joined: Thursday 31 January 2019 21:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: The Netherlands
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
Anyone getting errors in this script?
Mine reports back error.
ValueError: invalid literal for int() with base 10: ''
The solution:
Run this command
Be sure to change the location of your dist-packages/speedtest.py to the python version you're using
Source of this solution
Mine reports back error.
ValueError: invalid literal for int() with base 10: ''
The solution:
Run this command
Code: Select all
sudo wget https://raw.githubusercontent.com/sivel/speedtest-cli/v2.1.3/speedtest.py \
-O /usr/lib/python3/dist-packages/speedtest.py/
Source of this solution
Custodes Septentrionum
- Rolandet
- Posts: 95
- Joined: Thursday 31 January 2019 21:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: The Netherlands
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
Unfortunately I'm getting the same error constantly since Feb 14th
Does anyone have a solution or alternative?
Code: Select all
<html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>HTTP/1.1 401 Unauthorized
Content-Length: 91
Content-Type: text/html;charset=UTF-8
Access-Control-Allow-Origin: *
Set-Cookie: DMZSID=none; HttpOnly; Expires=Thu, 01 Jan 1970 00:00:00 GMT
Custodes Septentrionum
-
- Posts: 748
- Joined: Saturday 27 February 2016 12:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: NL
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
I did not pay attention to this for a while, it was measuring the speed on a daily basis but has suddenly stopped.
When I run on the console, I get this:
What happened? How can I fix this?
Additional info: the logfile in which the values are stored, shows a last entry on February 9th... I have no idea what happened on that day.
When I run on the console, I get this:
Code: Select all
Traceback (most recent call last):
File "/usr/bin/speedtest-cli", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3260, in <module>
def _initialize_master_working_set():
File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3234, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3272, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 581, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 909, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 795, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'speedtest-cli==2.0.2' distribution was not found and is required by the application
Additional info: the logfile in which the values are stored, shows a last entry on February 9th... I have no idea what happened on that day.
Hans
- Rolandet
- Posts: 95
- Joined: Thursday 31 January 2019 21:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: The Netherlands
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
See the previous responses above mine (4 up)manjh wrote: ↑Sunday 05 March 2023 16:00 I did not pay attention to this for a while, it was measuring the speed on a daily basis but has suddenly stopped.
When I run on the console, I get this:What happened? How can I fix this?Code: Select all
Traceback (most recent call last): File "/usr/bin/speedtest-cli", line 6, in <module> from pkg_resources import load_entry_point File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3260, in <module> def _initialize_master_working_set(): File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3234, in _call_aside f(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3272, in _initialize_master_working_set working_set = WorkingSet._build_master() File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 581, in _build_master ws.require(__requires__) File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 909, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 795, in resolve raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'speedtest-cli==2.0.2' distribution was not found and is required by the application
Additional info: the logfile in which the values are stored, shows a last entry on February 9th... I have no idea what happened on that day.
Custodes Septentrionum
-
- Posts: 748
- Joined: Saturday 27 February 2016 12:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: NL
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
I ran this command:
I then removed the last slash, and it runs.
But still speedtest-c;i throws an error;
Code: Select all
sudo wget https://raw.githubusercontent.com/sivel/speedtest-cli/v2.1.3/speedtest.py \
> -O /usr/lib/python3/dist-packages/speedtest.py/
/usr/lib/python3/dist-packages/speedtest.py/: Is a directory
But still speedtest-c;i throws an error;
Code: Select all
DistributionNotFound: The 'speedtest-cli==2.0.2' distribution was not found and is required by the application
Hans
-
- Posts: 748
- Joined: Saturday 27 February 2016 12:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: NL
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
Any ideas, anyone?manjh wrote: ↑Monday 06 March 2023 13:16 I ran this command:I then removed the last slash, and it runs.Code: Select all
sudo wget https://raw.githubusercontent.com/sivel/speedtest-cli/v2.1.3/speedtest.py \ > -O /usr/lib/python3/dist-packages/speedtest.py/ /usr/lib/python3/dist-packages/speedtest.py/: Is a directory
But still speedtest-c;i throws an error;Code: Select all
DistributionNotFound: The 'speedtest-cli==2.0.2' distribution was not found and is required by the application
Hans
-
- Posts: 16
- Joined: Thursday 16 December 2021 16:05
- Target OS: Linux
- Domoticz version:
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
This repeated speedtesting is just abhorently wasteful. Not just for your own usage limit and bandwidth during testing, but also for the internet as a whole. Especially since what you want to achieve with it, is precisely why it's getting slow(er) than it could be.
As someone who's employed at a mobile operator (now mostly double 4G and prime 5G connectivity maintenance in towers and such..) I get to hear a lot of complaints from the sysadmins at the dc and core network and backbone operations, the constant speedtests and checks for speed are becoming a serious contender for the first spot on the total traffic generated globally charts. It's absurd, especially in this day and age. It's literally abusing energy, both locally as well as along the routers in between as well as on the server's side. It's like keeping a fossil fueled engine running in front of your house every day for a few hours, just to know that it works when you need to use it for something, completely disregarding its environmental effects. Please, if you can, stop using speedtesting to check if your internet is up or not. It's absurd.
As someone who's employed at a mobile operator (now mostly double 4G and prime 5G connectivity maintenance in towers and such..) I get to hear a lot of complaints from the sysadmins at the dc and core network and backbone operations, the constant speedtests and checks for speed are becoming a serious contender for the first spot on the total traffic generated globally charts. It's absurd, especially in this day and age. It's literally abusing energy, both locally as well as along the routers in between as well as on the server's side. It's like keeping a fossil fueled engine running in front of your house every day for a few hours, just to know that it works when you need to use it for something, completely disregarding its environmental effects. Please, if you can, stop using speedtesting to check if your internet is up or not. It's absurd.
- Rolandet
- Posts: 95
- Joined: Thursday 31 January 2019 21:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: The Netherlands
- Contact:
Re: How to monitor your internet connection with virtual custom sensors
A speedtest is nothing more then a little upload and download chunk. If that messes with your connection, you have way bigger problems.
Custodes Septentrionum
Who is online
Users browsing this forum: No registered users and 0 guests