Giter Club home page Giter Club logo

speedtest's Introduction

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

speedtest's People

Contributors

natterstefan avatar philipheimboeck avatar

Stargazers

Spencer K Phillips avatar Ahmed Jahmi avatar  avatar Vaibhav Singh avatar Geoffrey McCaleb avatar Binoy Xavier Joy avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

speedtest's Issues

Tell Alexa to measure the speed

While it isn't possible to measure the speed right away, it could be a nice feature to actually tell Alechxa to measure the speed, so that a minute later you'll get the current value.

The technical solution could be to start another process/thread that measures the speed and let Alexa directly respond to the user that he should check again in a minute for the result. Sadly there are no push notifications for Alexa, so if we want something like this, we would need another channel for that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.