Awesome
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 addressdestinations
– Your work addressapi_key
– Your Google Maps API keymode
(optional) – See hereavoid
(optional) – See heretraffic_model
(optional) – See heremax_duration
(minutes) – If the estimated duration of your commute exceeds this value in minutes, you will get notifiedhost
(undersmtp
) – SMTP server hostnameport
(undersmtp
) – SMTP server portuser
(undersmtp
) – SMTP server usernamepass
(undersmtp
) – SMTP server passwordrecipient
– 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/