Skip to content

philipheimboeck/speedtest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

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

##Table of contents

Configuration

Copy config.json.dist to config.json and setup the values.

Installation

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

Start the Speedtest

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 /path/to/config.json

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.

If you want to create more Utterances you'll find a useful tool to expand utterances here. An example of how you would write them is shown below.

MeasureSpeedIntent messe die (upload / internet / download) (/geschwindigkeit)
MeasureSpeedIntent nimm eine messung (/vor)
MeasureSpeedIntent starte eine (/neue/weitere) Messung

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

Setup Twitter

Once you have setup your Twitter App you should udpate the twitter_* values in the config.json. Then it should tweet automatically. Do not forget to set the twitter_enabled value in your config to true.

FAQ

How to setup the path to the *.db on a Raspberry Pi?

Keep in mind that the cronjob has a different working directory and therefore its best to use absolute paths in your config.json file for the database.

Contributors

About

Python Speedtest that saves file into sqlite database, plots the results and provides an alexa skill for asking for the result

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages