Skip to content

Python Speedtest that saves results into sqlite database and handles Alexa Requests

Notifications You must be signed in to change notification settings

natterstefan/speedtest

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Speedtest Alexa-Skill and Cronjob

GitHub stars GitHub forks GitHub issues Twitter

An easy to use script test the speed (down-, upload and ping) of your ISP regularly (cronjob) and return the results with an Alexa Skill.

Installation Speedtest (Cronjob)

  • Install pip packages
pip install -r requirements.txt
  • Install python-tk
sudo apt install python-tk

Measure the speed

Run python speedtest.py to measure the speed. It will automatically create a sqlite database if not already existing.

Plot a diagram

Run plot.py to plot the last 60 days.

Example Plot

Import CSV

Run import.py filename.csv to import your existing data into your database. The CSV format to import is as follows:

date,time,timezone,ping,download (MBit/s),upload (MBit/s)
2017-02-19,18:45,CET,47.126,4.07,1.90
2017-02-19,19:00,CET,66.101,3.94,0.86

You might adapt the script to import your own files.

Cronjob

To measure your speed all 15 minutes, add the following line to your crontab.

*/15 * * * * python /path/to/speedtest.py

Installation Speedtest Alexa Skill

Installation of Flask-Ask and Ngrok

First you need to install Flask-Ask with:

pip install flask-ask

In the next step you need to go to https://ngrok.com/download and download the latest Linux ARM build with:

wget https://.../ngrok-stable-linux-arm.zip

Now you can run your ngrok Server with:

./ngrok http 5000

Your Localhost-Server with a ngrok-Subdomain is now running. The output of this command looks similar to this. To use this Alexa-Skill you need to copy the HTTPS-Address into the Amazon Developer Console later.

ngrok Example

Setup Alexa Skill

Follow the instructions here (starting from Configure the Skill) and copy the necessary code snippets from speech_assets folder into the necessary places.

Start the Alexa Skill

All you need to do now is to make sure you have at least one record in the speedtest.db and then run python alexa.py.

Authors