Skip to content

Releases: supryan/IFTTT-OSX

IFTTT-OSX | Automatic

12 Aug 05:50
Compare
Choose a tag to compare

NOTE: Not to be confused with an official Automatic (Driving Assistant) OSX App. It's just a command line interface (Terminal Notifier by alloy) to display OSX push notifications, wrapped in an app bundle and nice icon; for use with OSX Notification Center.


Assuming you've already read all the excruciating detail on the README, this is what you can do with OSX Notifications and this release! Feel free to expand from here if you have ideas for more notifications.

What's in the Box?

  • Automatic.app
  • automatic.icns (512px x 512px)
  • Hazel.rules
    • Parking Location Reminder
    • Trips Completed
    • Check Engine Light

IFTTT Recipes


Parking Location Reminder


Automatic Dropbox
IF Ignition Off THEN Add file from URL

FILE URL: {{LocationMapImageURL}}

FILE NAME: {{LocationMapURL}}


Recent Trip Information


Automatic Dropbox
IF New Trip Completed THEN Create a text file

FILE NAME:"trip"

CONTENT:

{{VehicleName}} completed a {{TripDistanceMiles}} mile trip.

At {{AverageMPG}} miles per gallon, fuel cost {{FuelCostUSD}}.


Hard brake count: {{HardBrakeCount}}

Hard acceleration count:{{HardAccelCount}}

Duration over 70MPH: {{DurationOver70MPH}}

Duration over 75MPH: {{DurationOver75MPH}}

Duration over 80MPH: {{DurationOver80MPH}}


Trip started {{TripStartedAt}}

On a map: {{StartLocationMapURL}}

({{StartLocationLon}}, {{StartLocationLat}})

Trip ended {{TripEndedAt}}

On a map: {{EndLocationMapURL}}

({{EndLocationLon}}, {{EndLocationLat}})

{{TripPathImageMapURL}}


Check Engine Light


Automatic Dropbox
IF New Trip Completed THEN Create a text file

FILE NAME:"maint"

CONTENT:

{{VehicleName}}'s {{DiagnosticMessages}}

{{CheckLightOnAt}}


Hazel Rules

NOTE:I should mention that I have set up Hazel for these rules to always display the most recent trigger. The only way we can use Hazel to do this is to organize each file into their own separate folder (labeled "Today" for example) and then execute the shell script on that folder only by adding a rule "Date Created is among the 1 most recent". If you set this rule on the main root folder it will trigger the rule on every file in that folders contents, not just the items you specify. Stupid, I know. Hopefully Hazel gets an update on that soon.


Parking Location Reminder


Conditions (All)
Name starts with "http"
Kind is image
Date Last Matched is blank
Date Created is among 1 most recent
Subfolder depth is 2
Actions
Run shell script embedded script (Or use 'parking.sh')
Copy to folder (enclosing folder)
Sort into subfolder with pattern (date created)
Rename with pattern "Parked on (date created)(extension)"

Recent Trip Information


Conditions (All)
Name starts with "trip"
Kind is text
Date Last Matched is blank
Date Created is among 1 most recent
Subfolder depth is 2
Actions
Run shell script embedded script (Or use 'trip.sh')
Copy to folder (enclosing folder)
Sort into subfolder with pattern (date created)
Rename with pattern "Recent trip on (date created)(extension)"

Check Engine Light


Conditions (All)
Name starts with "maint"
Kind is text
Date Last Matched is blank
Date Created is among 1 most recent
Subfolder depth is 2
Actions
Run shell script embedded script (Or use 'engine.sh')
Copy to folder (enclosing folder)
Sort into subfolder with pattern (date created)
Rename with pattern "Recent trip on (date created)(extension)"

NOTE: Hazel rules included in the releases can include a 'utility rule' that I clearly outlined for myself. These rules are always labeled with 3 slashed before and after like so: /// Trash Files ///. These are optional, but work to cleanup your Automatic directory and organize the downloaded files from IFTTT. Utility rules can sometimes be necessary for running the rest of the rules under them. Common examples of these rules are always labeled similarly to: /// These Subfolders ///. Some of these might be required to use my pre-built rules. Check the note icon included with the rule for more information on the conditions and actions. I know, it's sickening; I'm that organized.

Shell Scripts


Parking Location Reminder


!#/bin/sh
# OSX NOTIFICATION
NAME=`basename "$1"` # Gets name of file
LAT=`${NAME#*_}` # Remove everything before the first underscore symbol
LONG=`${LAT%%_z*}` # Remove everything up until the farthest '_z' from the right
GEO=`${LONG/_/,}` # Remove underscore symbol between geocodes
ZOOM=`19`
/Library/ScriptingAdditions/Automatic.app/Contents/MacOS/Automatic -title 'Parking Reminder' -message "Just in case you were wondering, you recently parked in this location:" -contentImage "$1" -activate 'com.apple.Maps' -open "http://maps.apple.com/?q=$GEO&z=$ZOOM" -group 'automatic-park'

Recent Trip Information


!#/bin/sh
# OSX NOTIFICATION
# IFTTT: Automatic - If ignition turned off, then notify me on OSX of my recent trip. | 
TEXT=`head -2 "$1"` # Read first two lines from the top
URL=`tail -1 "$1"` # Read last line for URL and opening the link
/Library/ScriptingAdditions/Automatic.app/Contents/MacOS/Automatic -title 'Trip Completed' -message "$TEXT" -activate 'com.apple.Safari' -open "$URL" -group 'automatic-trips'

Check Engine Light


!#/bin/sh
# OSX NOTIFICATION
# IFTTT: Automatic - If check engine light goes on, notify me on OSX with the problem. | 
TEXT=`head -3 "$1"` # Read first 3 lines from the top
URL=`tail -1 "$1"`
/Library/ScriptingAdditions/Automatic.app/Contents/MacOS/Automatic -title 'Car Maintanance Required' -message "$TEXT" -activate 'com.apple.Safari' -open "$URL" -group 'automatic-maint'