Page 1 of 3
Python Plugin: Speedtest
Posted: Monday 15 January 2018 20:30
by Xorfor
In the past I used a Lua script. I have rewritten this script to a Python plugin. Code (and images) are available at:
https://github.com/Xorfor/Domoticz-Speedtest-Plugin

- speedtest.PNG (15.55 KiB) Viewed 8689 times
Re: Python Plugin: Speedtest
Posted: Tuesday 16 January 2018 22:08
by domoticzag
Nice added feature!
Shouldn't I make dummy switches and put the idx's in as parameters? Or how should it be run?
Re: Python Plugin: Speedtest
Posted: Tuesday 16 January 2018 22:29
by Xorfor
It is a python plugin. Just install the plugin. Look at
http://www.domoticz.com/wiki/Using_Python_plugins how to install a python plugin on your system, with nice examples.
Be sure you are running on the latest beta version. The development team is still adding new features in Domoticz for better support of the python plugins.
Re: Python Plugin: Speedtest
Posted: Wednesday 17 January 2018 12:00
by domoticzag
Okay thanks, got the plugin added from Hardware.
But i get an error from the script:

- Debug.png (31.09 KiB) Viewed 8632 times
It looks like he cant find the custum icon in the zip file?
I also get an error when trying to unpack the zip file in windows:

- Capture.PNG (22.06 KiB) Viewed 8623 times
Saids the archive is unrepairable
Maybe something is wrong with the zip, could you rezip and upload?
Thanks
Re: Python Plugin: Speedtest
Posted: Wednesday 17 January 2018 13:11
by Domoticx
Same here, the ZIP file is corrupted!
Re: Python Plugin: Speedtest
Posted: Wednesday 17 January 2018 19:19
by Xorfor
My local version was correct. After a new upload, the image zip file was corrupt again

. I did an upload again, now with 'Drag files here...' instead of 'Choose your files'. Now it seems to be correct!

Weird.
Re: Python Plugin: Speedtest
Posted: Wednesday 17 January 2018 20:12
by Boredcat
The Zip file now is correct.
Still have this error
Code: Select all
2018-01-17 20:08:38.842 Error: (Speedtest) 'onStart' failed 'KeyError'.
2018-01-17 20:08:38.842 Error: (Speedtest) ----> Line 138 in /home/pi/domoticz/plugins/SpeedTest/plugin.py, function onStart
2018-01-17 20:08:38.842 Error: (Speedtest) ----> Line 72 in /home/pi/domoticz/plugins/SpeedTest/plugin.py, function onStart
Running v3.8747
Btw Thank for this plugin.
Re: Python Plugin: Speedtest
Posted: Wednesday 17 January 2018 21:36
by Xorfor
Grumpfff . During checking my other plugins, I uploaded the wrong one

, as you probably have seen. Now the correct image zip is available.
Re: Python Plugin: Speedtest
Posted: Wednesday 17 January 2018 22:54
by Brutus
I'm getting this error on a Windows Machine (is it compatible?):
Code: Select all
2018-01-17 22:52:29.170 (Speedtest) Started.
2018-01-17 22:52:29.278 (Speedtest) Initialized version 1.2.0, author 'Xorfor'
2018-01-17 22:52:29.278 (Speedtest) Entering work loop.
2018-01-17 22:52:29.292 Error: (Speedtest) speedtest-cli not found
Re: Python Plugin: Speedtest
Posted: Wednesday 17 January 2018 23:06
by Xorfor
@Brutus,
As described in the README.md, you need
speedtest-cli. Unfortunately this is not available on Windows

. I was looking for an alternative, but still not found.
Re: Python Plugin: Speedtest
Posted: Wednesday 17 January 2018 23:36
by Xorfor
I found an unofficial alternative:
https://github.com/zpeters/speedtest
If more people like to have this plugin also working in Windows, I will try to implement this

Re: Python Plugin: Speedtest
Posted: Thursday 18 January 2018 9:32
by Boredcat
Xorfor wrote: ↑Wednesday 17 January 2018 21:36
Grumpfff . During checking my other plugins, I uploaded the wrong one

, as you probably have seen. Now the correct image zip is available.
Reinstalled to correct ZIP now. Everythings works perfect. Thnx
Re: Python Plugin: Speedtest
Posted: Thursday 18 January 2018 10:28
by domoticzag
Also reinstalled on the Raspberry, working perfect! Thanks!
Re: Python Plugin: Speedtest
Posted: Thursday 18 January 2018 18:41
by Brutus
That would be nice

Re: Python Plugin: Speedtest
Posted: Saturday 20 January 2018 16:26
by EdwinK
Thanks. Finally a good Speed test running
Re: Python Plugin: Speedtest
Posted: Wednesday 07 March 2018 20:56
by capman
I have installed the plugin and I installed the speedtest-cli command.
This is how I installed it to my synology where domoticz is running.
Through ssh
Code: Select all
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli
This gives, for me, after running it:
Code: Select all
Retrieving speedtest.net configuration...
Testing from EDPNET (79.132.236.180)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Proximus (Brussels) [76.23 km]: 28.101 ms
Testing download speed................................................................................
Download: 30.60 Mbit/s
Testing upload speed................................................................................................
Upload: 21.77 Mbit/s
So it's working. But in domoticz log I still have the error: speedtest-cli not found.
I have python 2.7 and 3.5 installed on my synology. Other python scripts (lgtv, traveltimes , life360 , ...) are working fine.
I have searching for a solution but still no luck. If someone know what to do ,thanks

Re: Python Plugin: Speedtest
Posted: Thursday 08 March 2018 14:17
by Innovator
I also have a Synology, have found this somewhere on the internet. Executed, It works correctly for me now
wget
https://bootstrap.pypa.io/get-pip.py
python get-pip.py
sudo pip install speedtest-cli

Re: Python Plugin: Speedtest
Posted: Thursday 08 March 2018 15:16
by capman
Thanks for the info. Speedtest-cli is already installed. When a type in ssh , python --version, it said python 2.7.
I removed my python 2.7 package in synology (together with all the other packages who needed python 2.7

)
So now just python 3.5 is installed. My NAS is restarting at the moment , so let see if this was the solution
Keep you informed

Re: Python Plugin: Speedtest
Posted: Thursday 08 March 2018 15:25
by capman
I removed python 2.7 , restarted NAS , still version 2.7.12
Version of domoticz is beta 3.8975 with python from
http://www.jadahl.com/domoticz_beta_6.1_python/
Code: Select all
root@DiskStation:~# python --version
Python 2.7.12
root@DiskStation:~# wget https://bootstrap.pypa.io/get-pip.py
--2018-03-08 15:19:00-- https://bootstrap.pypa.io/get-pip.py
Resolving bootstrap.pypa.io... 151.101.36.175
Connecting to bootstrap.pypa.io|151.101.36.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1595408 (1.5M) [text/x-python]
Saving to: 'get-pip.py.1'
100%[======================================>] 1,595,408 733KB/s in 2.1s
2018-03-08 15:19:02 (733 KB/s) - 'get-pip.py.1' saved [1595408/1595408]
root@DiskStation:~# python get-pip.py
Requirement already up-to-date: pip in /usr/lib/python2.7/site-packages
Collecting setuptools
Using cached setuptools-38.5.2-py2.py3-none-any.whl
Installing collected packages: setuptools
Successfully installed setuptools-38.5.2
root@DiskStation:~# sudo pip install speedtest-cli
Requirement already satisfied: speedtest-cli in /usr/lib/python2.7/site-packages/speedtest_cli-2.0.0-py2.7.egg
root@DiskStation:~#
Re: Python Plugin: Speedtest
Posted: Thursday 08 March 2018 15:43
by Xorfor
In the plugin, I build in a check whether speedtest_cli is installed or not:
Code: Select all
# Check for the existence of the command
ret = os.popen("dpkg -l | grep " + self.__COMMAND).read()
pos = ret.find(self.__COMMAND)
if pos >= 0:
self.__config_ok = True
else:
self.__config_ok = False
Domoticz.Error(self.__COMMAND + " not found")
return
This check will work if you use apt-get.
I will try out if I also can check for installations with pip. Else I will remove the check.
As a workaround, you can remove the above check and replace it for: