Python Plugin: Speedtest Topic is solved

Python and python framework

Moderator: leecollings

Xorfor

Python Plugin: Speedtest

Post 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
speedtest.PNG (15.55 KiB) Viewed 8192 times
domoticzag
Posts: 24
Joined: Tuesday 13 September 2016 19:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Speedtest

Post 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?
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
Xorfor

Re: Python Plugin: Speedtest

Post 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.
domoticzag
Posts: 24
Joined: Tuesday 13 September 2016 19:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Speedtest

Post by domoticzag »

Okay thanks, got the plugin added from Hardware.

But i get an error from the script:
Debug.png
Debug.png (31.09 KiB) Viewed 8135 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 8126 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
User avatar
Domoticx
Posts: 90
Joined: Sunday 07 January 2018 21:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Marienheem / The Netherlands
Contact:

Re: Python Plugin: Speedtest

Post by Domoticx »

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!)
Xorfor

Re: Python Plugin: Speedtest

Post by Xorfor »

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: 38
Joined: Friday 17 March 2017 9:31
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Netherlands
Contact:

Re: Python Plugin: Speedtest

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

Re: Python Plugin: Speedtest

Post by Xorfor »

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: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Python Plugin: Speedtest

Post 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 
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
Xorfor

Re: Python Plugin: Speedtest

Post 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.
Xorfor

Re: Python Plugin: Speedtest

Post 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 :)
Boredcat
Posts: 38
Joined: Friday 17 March 2017 9:31
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Netherlands
Contact:

Re: Python Plugin: Speedtest

Post by Boredcat »

Xorfor wrote: Wednesday 17 January 2018 21: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 / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Speedtest

Post by domoticzag »

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: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Python Plugin: Speedtest

Post by Brutus »

Xorfor wrote: Wednesday 17 January 2018 23: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 NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: Speedtest

Post by EdwinK »

Thanks. Finally a good Speed test running
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
capman
Posts: 153
Joined: Friday 12 July 2013 20:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Belgium
Contact:

Re: Python Plugin: Speedtest

Post 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 :)
User avatar
Innovator
Posts: 16
Joined: Tuesday 20 February 2018 12:33
Target OS: NAS (Synology & others)
Domoticz version: 8924
Location: Amsterdam
Contact:

Re: Python Plugin: Speedtest

Post 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

:D
Synology DS918+ /DS412+
ASUS BRT-AC828, RT-AC86U, RT-AC68U
User avatar
capman
Posts: 153
Joined: Friday 12 July 2013 20:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Belgium
Contact:

Re: Python Plugin: Speedtest

Post 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 :?
User avatar
capman
Posts: 153
Joined: Friday 12 July 2013 20:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Belgium
Contact:

Re: Python Plugin: Speedtest

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

Re: Python Plugin: Speedtest

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

Code: Select all

self.__config_ok = True
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest