Skip to content
This repository has been archived by the owner on Oct 22, 2018. It is now read-only.

agorf/trafficjam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trafficjam

Sends email if a route travel time exceeds a configured limit according to the Google Maps API.

This used to be written in Ruby.

Quick how-to

First, you need a free Google Maps API key and access to an SMTP server. Mailgun has a free plan.

Then install Go, if you haven't, and issue once:

$ go get github.com/agorf/trafficjam

Configure the program with your $EDITOR:

$ cp config.json.sample config.json
$ $EDITOR config.json

Run the program:

$ trafficjam config.json

You can use Cron to run the script at predetermined intervals (e.g. right before heading out each morning). Here's what I have:

0,5,10,15,20,25,30 9 * * 1-5 agorf trafficjam config.json

This runs the program on working days, from 9:00 until 9:30, every five minutes.

To avoid getting spammed, you need to figure out the right threshold (max_duration config option) that you want to get notified for.

Configuration

The configuration file contains JSON. The following keys can be defined (all required unless otherwise stated):

  • origins – Your home address
  • destinations – Your work address
  • api_key – Your Google Maps API key
  • mode (optional) – See here
  • avoid (optional) – See here
  • traffic_model (optional) – See here
  • max_duration (minutes) – If the estimated duration of your commute exceeds this value in minutes, you will get notified
  • host (under smtp) – SMTP server hostname
  • port (under smtp) – SMTP server port
  • user (under smtp) – SMTP server username
  • pass (under smtp) – SMTP server password
  • recipient – Email address to get notified at

See config.json.sample for a sample configuration file.

License

Licensed under the MIT license (see LICENSE.txt).

Author

Angelos Orfanakos, http://agorf.gr/

About

Get an email for unusual traffic with data from Google Maps

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages