Python Plugin: Speedtest

Python and python framework

Moderator: leecollings

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 , i will try this :) . Strange it worked for http://www.domoticz.com/forum/viewtopic ... 42#p173904
Xorfor

Re: Python Plugin: Speedtest

Post by Xorfor »

I did some rework and removed the check for existence of speedtest-cli. If speedtest-cli is not installed or executable, only an error is available in the log. Latest version available @ https://github.com/Xorfor/Domoticz-Speedtest-Plugin
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 »

It's working now !!! :D Thanks 4 your effort Xorfor !
sanderjohan
Posts: 4
Joined: Thursday 31 December 2015 10:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Contact:

Re: Python Plugin: Speedtest

Post by sanderjohan »

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 :)
Any progress on making this plugin working voor windows? I would really like that!
Xorfor

Re: Python Plugin: Speedtest

Post by Xorfor »

@sanderjohan:

Yes, I did some research and testing with the windows based speedtest. But I was not happy with the results. The output was different from speedtest-cli and the results seems too low.

After that I did some more investigation and got speedtest-cli working on my Windows 10 pc. So it should also work on your Domoticz system. However I was not able to test in, because my Domoticz is running on a RPi.
Please try the following steps:

1. If correct, Python is already installed, else you are not able to use the Domoticz Python plugins
2. Op the Command window and type: python -V
This should give you the current Python version
3. Since Python 3.4, also 'pip' is shipped as standard. This tool can be found in <your Python directory>\Scripts
4. Goto C:\...\Programs\Python\Python36-32\Scripts and type: pip install speedtest-cli
5. Probably you get a warning that a new pip is available, but you can ignore this
6. If correct, a speedtest-cli.exe can be found. Type: speedtest-cli --simple
After approx. 20 sec you should get a report

This is as far as it worked for me. I am not able to do further testing. Perhaps you can place the speedtest-cli.exe in the plugin directory? Perhaps other Windows Plugin developers have a suggestion?

Please try above steps, perhaps I can help you.
alexsh1
Posts: 169
Joined: Wednesday 30 September 2015 11:50
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8975
Location: United Kingdom
Contact:

Re: Python Plugin: Speedtest

Post by alexsh1 »

Hi,

Any idea why I have a log of these in the log?

Code: Select all

2018-03-22 23:01:30.296 Error: Speedtest hardware (16) thread seems to have ended unexpectedly
Basically, the plugin is only working for a few hours and then I have to reboot RPi in order to make it work again.

Thanks
Alex
Xorfor

Re: Python Plugin: Speedtest

Post by Xorfor »

In the past, I had this same error.

Please update your Domoticz to the latest beta version.

When you are using python plugins, try to use the latest beta version. There is still development done, and the developer are still adding new functionality.
alexsh1
Posts: 169
Joined: Wednesday 30 September 2015 11:50
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8975
Location: United Kingdom
Contact:

Re: Python Plugin: Speedtest

Post by alexsh1 »

Xorfor wrote: Friday 23 March 2018 19:55
Please update your Domoticz to the latest beta version.
I have the latest version V3.9052, but the error still comes up. I have to restart Domoticz another plug-in would not work :(
Xorfor

Re: Python Plugin: Speedtest

Post by Xorfor »

You can also try to disable/enable the hardware. This will in fact restart the plugin.
alexsh1
Posts: 169
Joined: Wednesday 30 September 2015 11:50
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8975
Location: United Kingdom
Contact:

Re: Python Plugin: Speedtest

Post by alexsh1 »

Xorfor wrote: Saturday 24 March 2018 19:54 You can also try to disable/enable the hardware. This will in fact restart the plugin.
I tried it, but this does not help - plugin is still logging the same error message. Only reboot helps
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Python Plugin: Speedtest

Post by Derik »

dear developer.

Thanks for this great work..
I use the lua script to..
Only 1 question..
Is the plugin stable?
Or do i need some specific python version or something else.

Or just install and run:-)
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Xorfor

Re: Python Plugin: Speedtest

Post by Xorfor »

@Derik:

I am running the Speedtest plugin on 2 RPi's, a production and a development system on the latest Domoticz beta version for weeks and don't have any problem. I am using default Domoticz installations, so no specific Python version.

It only seems that using the Python plugins, it is recommended to use the latest beta version of Domoticz.
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Python Plugin: Speedtest

Post by Derik »

Xorfor wrote: Sunday 25 March 2018 21:45 @Derik:

I am running the Speedtest plugin on 2 RPi's, a production and a development system on the latest Domoticz beta version for weeks and don't have any problem. I am using default Domoticz installations, so no specific Python version.

It only seems that using the Python plugins, it is recommended to use the latest beta version of Domoticz.
mmm did install it on my rpi..
Set the time around 2 hours.
Only the plugin is not working. I see the new device on my domoticz..
Do i need to set the right to 777 or 666 or what is the best chmod?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Xorfor

Re: Python Plugin: Speedtest

Post by Xorfor »

Derik wrote: Sunday 25 March 2018 22:01 mmm did install it on my rpi..
Set the time around 2 hours.
Only the plugin is not working. I see the new device on my domoticz..
Do i need to set the right to 777 or 666 or what is the best chmod?
Did you install speedtest-cli as described on https://github.com/Xorfor/Domoticz-Speedtest-Plugin? Any information in the log?
Ventron
Posts: 2
Joined: Tuesday 27 March 2018 14:31
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Speedtest

Post by Ventron »

Code: Select all

2018-03-27 14:26:44.255 Error: (CDevice_update) PING: Failed to parse parameters: 'nValue', 'sValue', 'SignalLevel', 'BatteryLevel' or 'Options' expected.
2018-03-27 14:26:44.255 Error: (Speedtest) 'CDevice_update' failed 'TypeError':''TimedOut' is an invalid keyword argument for this function'.
2018-03-27 14:26:44.255 Error: (CDevice_update) DOWNLOAD: Failed to parse parameters: 'nValue', 'sValue', 'SignalLevel', 'BatteryLevel' or 'Options' expected.
2018-03-27 14:26:44.255 Error: (Speedtest) 'CDevice_update' failed 'TypeError':''TimedOut' is an invalid keyword argument for this function'.
2018-03-27 14:26:44.255 Error: (CDevice_update) UPLOAD: Failed to parse parameters: 'nValue', 'sValue', 'SignalLevel', 'BatteryLevel' or 'Options' expected.
2018-03-27 14:26:44.255 Error: (Speedtest) 'CDevice_update' failed 'TypeError':''TimedOut' is an invalid keyword argument for this function'.
Any ideas?
Xorfor

Re: Python Plugin: Speedtest

Post by Xorfor »

@Ventron,

This Python plugin is using a option, which is not available in your Domoticz.
You have 2 options:

1. Update to the latest beta version of Domoticz. If you are planning to use more plugins, this is the recommended option.

or

2. Change the Speedtest plugin:
a. Open the plugin.py in an editor
b. Goto to line 177, the UpdateDevice procedure:

Code: Select all

def UpdateDevice(Unit, nValue, sValue, TimedOut=0, AlwaysUpdate=False):
    # Make sure that the Domoticz device still exists (they can be deleted) before updating it
    if Unit in Devices:
        if Devices[Unit].nValue != nValue or Devices[Unit].sValue != sValue or Devices[Unit].TimedOut != TimedOut or AlwaysUpdate:
            Devices[Unit].Update(nValue=nValue, sValue=str(sValue), TimedOut=TimedOut)
            Domoticz.Debug("Update " + Devices[Unit].Name + ": " + str(nValue) + " - '" + str(sValue) + "' - " + str(TimedOut))
change to:

Code: Select all

def UpdateDevice(Unit, nValue, sValue, TimedOut=0, AlwaysUpdate=False):
    # Make sure that the Domoticz device still exists (they can be deleted) before updating it
    if Unit in Devices:
        if Devices[Unit].nValue != nValue or Devices[Unit].sValue != sValue or AlwaysUpdate:
            Devices[Unit].Update(nValue=nValue, sValue=str(sValue))
            Domoticz.Debug("Update " + Devices[Unit].Name + ": " + str(nValue) + " - '" + str(sValue) + "' - " + str(TimedOut))
The changes are done by removing ' or Devices[Unit].TimedOut != TimedOut' is one line and ', TimedOut=TimedOut' in the next line.
Ventron
Posts: 2
Joined: Tuesday 27 March 2018 14:31
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Speedtest

Post by Ventron »

Updated to beta. Now its working like a harm! Thanks
emeyedeejay
Posts: 21
Joined: Sunday 25 March 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Speedtest

Post by emeyedeejay »

Hi Xorfor, any ideas on this?

https://github.com/Xorfor/Domoticz-PiMo ... n/issues/1

At a particular point last night all plugins stopped functioning. I had installed only the Pi Monitor and Speedtest plugins on the latest Beta (also just upgraded last night).

Looking at the hardware settings, the "type" is now blank and the Pi Monitor and Speedtest hardware types are not listed in the "type" drop down where you add new hardware.

Any ideas?

Thanks for the great tools!

Thanks!
Xorfor

Re: Python Plugin: Speedtest

Post by Xorfor »

@emeyedeejay:

I have no idea what happened with your Domoticz installation! I just updated my development RPi to 3.9117, to see if it also happens to me.

Did you found something in the log?

Try to reboot and see if the hardware is available again.
emeyedeejay
Posts: 21
Joined: Sunday 25 March 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Speedtest

Post by emeyedeejay »

Ok thanks.

I've rebooted multiple times, recopied the pluguins over, added them, removed them etc. It's so weird - at 11:02pm they all "just stopped" working.

I'm a total noob with raspbaian/debian/linux/unix and Pis though so I'm sure it's something I did.

I removed the hardware and now can;t add them back as they don't appear in the "type" list of hardware. So odd.

Error Log is totally empty.

Status Log:
2018-03-28 17:30:46.050 Domoticz V3.9117 (c)2012-2018 GizMoCuz
2018-03-28 17:30:46.050 Build Hash: fea48d46, Date: 2018-03-28 09:17:41
2018-03-28 17:30:46.051 Startup Path: /home/pi/domoticz/
2018-03-28 17:30:46.082 EventSystem: reset all events...
2018-03-28 17:30:46.084 Using 1-Wire support (kernel W1 module)...
2018-03-28 17:30:46.094 WebServer(HTTP) started on address: :: with port 8080
2018-03-28 17:30:46.099 WebServer(SSL) started on address: :: with port 443
2018-03-28 17:30:46.101 Proxymanager started.
2018-03-28 17:30:46.102 Camera: settings (re)loaded
2018-03-28 17:30:46.103 TCPServer: shared server started...
2018-03-28 17:30:46.103 RxQueue: queue worker started...
2018-03-28 17:30:48.104 DarkSky: Started...
2018-03-28 17:30:48.104 Pinger: Started
2018-03-28 17:30:48.104 1Wire: Added Device: 28-0004332324ff
2018-03-28 17:30:48.254 PROXY: Authenticate result: success.
2018-03-28 17:30:49.104 MQTT: Connecting to 192.168.0.250:1883
2018-03-28 17:30:49.240 MQTT: connected to: 192.168.0.250:1883
2018-03-28 17:30:49.341 MQTT: Subscribed
2018-03-28 17:33:18.629 Login successful from 196.211.120.110 for user "--------"
2018-03-28 17:33:18.630 Incoming connection from: 196.211.120.110
2018-03-28 18:00:00.713 Starting automatic database backup procedure...
2018-03-28 18:00:01.632 Ending automatic database backup procedure...
2018-03-28 18:40:17.083 Login successful from 196.210.85.90 for user 'mike'
2018-03-28 18:40:17.083 Incoming connection from: 196.210.85.90
2018-03-28 18:47:01.086 Schedule item started! Name: Irrigation, Type: Before Sunset, DevID: 1, Time: 2018-03-28 18:47:01
2018-03-28 18:47:01.089 Notification: Irrigation >> OFF
2018-03-28 19:00:00.388 Starting automatic database backup procedure...
2018-03-28 19:00:01.103 Ending automatic database backup procedure...
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest