Python Plugin: Speedtest

Python and python framework
User avatar
Xorfor
Posts: 103
Joined: Sunday 03 December 2017 23:37
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Python Plugin: Speedtest

Post by Xorfor » Monday 15 January 2018 21:30

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
speedtest.PNG (15.55 KiB) Viewed 3203 times

domoticzag
Posts: 24
Joined: Tuesday 13 September 2016 19:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Speedtest

Post by domoticzag » Tuesday 16 January 2018 23:08

Nice added feature!
Shouldn't I make dummy switches and put the idx's in as parameters? Or how should it be run?
RPi 3
Domoticz Béta
RFLink Gateway dipool antenna
Many kaku devices
P1 smart meter
Custom made ESP8266 devices
Hue lights / Milight ligts and strips

User avatar
Xorfor
Posts: 103
Joined: Sunday 03 December 2017 23:37
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: Python Plugin: Speedtest

Post by Xorfor » Tuesday 16 January 2018 23:29

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.

domoticzag
Posts: 24
Joined: Tuesday 13 September 2016 19:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Speedtest

Post by domoticzag » Wednesday 17 January 2018 13:00

Okay thanks, got the plugin added from Hardware.

But i get an error from the script:
Debug.png
Debug.png (31.09 KiB) Viewed 3146 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
Capture.PNG (22.06 KiB) Viewed 3137 times
Saids the archive is unrepairable

Maybe something is wrong with the zip, could you rezip and upload?

Thanks
RPi 3
Domoticz Béta
RFLink Gateway dipool antenna
Many kaku devices
P1 smart meter
Custom made ESP8266 devices
Hue lights / Milight ligts and strips

Domoticx
Posts: 73
Joined: Sunday 07 January 2018 22:19
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: Deventer / The Netherlands
Contact:

Re: Python Plugin: Speedtest

Post by Domoticx » Wednesday 17 January 2018 14:11

Same here, the ZIP file is corrupted!
My Domoticz plugins:
- Modbus RS485 RTU/ASCII/TCP

Maatwerk in: Domotica - Automatisering - Elektronica - 3D printing - Software ontwikkeling
Website / Webshop / Knowledge Center / Facebook (like de pagina en blijf op de hoogte!)

User avatar
Xorfor
Posts: 103
Joined: Sunday 03 December 2017 23:37
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: Python Plugin: Speedtest

Post by Xorfor » Wednesday 17 January 2018 20:19

My local version was correct. After a new upload, the image zip file was corrupt again :o . I did an upload again, now with 'Drag files here...' instead of 'Choose your files'. Now it seems to be correct! :)
Weird.

Boredcat
Posts: 46
Joined: Friday 17 March 2017 10:31
Target OS: Raspberry Pi
Domoticz version: 3.9639
Location: Netherlands
Contact:

Re: Python Plugin: Speedtest

Post by Boredcat » Wednesday 17 January 2018 21:12

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.
RFXCom(E) - Yeelight Lights - KaKu / Alexa HA Bridge
Windows 2012 / Windows 2012R2 / Xpenology/ Pi 3 / Milight / Home build ESP8266 / Sonoff

User avatar
Xorfor
Posts: 103
Joined: Sunday 03 December 2017 23:37
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: Python Plugin: Speedtest

Post by Xorfor » Wednesday 17 January 2018 22:36

Grumpfff . During checking my other plugins, I uploaded the wrong one :oops: , as you probably have seen. Now the correct image zip is available.

User avatar
Brutus
Posts: 322
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Heerlen, The Netherlands
Contact:

Re: Python Plugin: Speedtest

Post by Brutus » Wednesday 17 January 2018 23:54

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 
1x Intel NUC D54250WYK (Windows 7 x64)
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
19x Fibaro Modules

User avatar
Xorfor
Posts: 103
Joined: Sunday 03 December 2017 23:37
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: Python Plugin: Speedtest

Post by Xorfor » Thursday 18 January 2018 0:06

@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.

User avatar
Xorfor
Posts: 103
Joined: Sunday 03 December 2017 23:37
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: Python Plugin: Speedtest

Post by Xorfor » Thursday 18 January 2018 0:36

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 :)

Boredcat
Posts: 46
Joined: Friday 17 March 2017 10:31
Target OS: Raspberry Pi
Domoticz version: 3.9639
Location: Netherlands
Contact:

Re: Python Plugin: Speedtest

Post by Boredcat » Thursday 18 January 2018 10:32

Xorfor wrote:
Wednesday 17 January 2018 22:36
Grumpfff . During checking my other plugins, I uploaded the wrong one :oops: , as you probably have seen. Now the correct image zip is available.
Reinstalled to correct ZIP now. Everythings works perfect. Thnx
RFXCom(E) - Yeelight Lights - KaKu / Alexa HA Bridge
Windows 2012 / Windows 2012R2 / Xpenology/ Pi 3 / Milight / Home build ESP8266 / Sonoff

domoticzag
Posts: 24
Joined: Tuesday 13 September 2016 19:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Speedtest

Post by domoticzag » Thursday 18 January 2018 11:28

Also reinstalled on the Raspberry, working perfect! Thanks!
RPi 3
Domoticz Béta
RFLink Gateway dipool antenna
Many kaku devices
P1 smart meter
Custom made ESP8266 devices
Hue lights / Milight ligts and strips

User avatar
Brutus
Posts: 322
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Heerlen, The Netherlands
Contact:

Re: Python Plugin: Speedtest

Post by Brutus » Thursday 18 January 2018 19:41

Xorfor wrote:
Thursday 18 January 2018 0:36
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 :)
That would be nice :)
1x Intel NUC D54250WYK (Windows 7 x64)
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
19x Fibaro Modules

User avatar
EdwinK
Posts: 1382
Joined: Sunday 22 January 2017 22:46
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: Speedtest

Post by EdwinK » Saturday 20 January 2018 17:26

Thanks. Finally a good Speed test running
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | RFxcom | Dashticz V2

User avatar
capman
Posts: 202
Joined: Friday 12 July 2013 20:48
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Belgium
Contact:

Re: Python Plugin: Speedtest

Post by capman » Wednesday 07 March 2018 21:56

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 :)

User avatar
Innovator
Posts: 15
Joined: Tuesday 20 February 2018 13:33
Target OS: NAS (Synology & others)
Domoticz version: 8924
Location: Amsterdam
Contact:

Re: Python Plugin: Speedtest

Post by Innovator » Thursday 08 March 2018 15:17

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

:D
Synology DS918+ /DS412+
ASUS BRT-AC828, RT-AC86U, RT-AC68U

User avatar
capman
Posts: 202
Joined: Friday 12 July 2013 20:48
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Belgium
Contact:

Re: Python Plugin: Speedtest

Post by capman » Thursday 08 March 2018 16:16

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 :?

User avatar
capman
Posts: 202
Joined: Friday 12 July 2013 20:48
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Belgium
Contact:

Re: Python Plugin: Speedtest

Post by capman » Thursday 08 March 2018 16:25

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:~#

User avatar
Xorfor
Posts: 103
Joined: Sunday 03 December 2017 23:37
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: Python Plugin: Speedtest

Post by Xorfor » Thursday 08 March 2018 16:43

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:

Code: Select all

self.__config_ok = True

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests