There are four fields that should be useful to you as triggers:
- deviceLeft - normally false. Set to true if a device left a geo in the last update
deviceLeftGeo - displays the name of the last geo left
deviceEntered - normally false. Set to true if a device entered a geo in the last update
deviceEnteredGeo - displays the name of the last geo entered
These are the states that I use in the plugin to display tracking information in the indigo log.
Create a trigger with the following properties:
Name of Trigger: Mike Enters GeoFence
Device: Mikes iPhone 6 Plus
Entered? is equal to true
It should look something like this:
Now we need to create an action for the trigger:
Action: Execute Script (Script & File Actions), Embedded Python
Code: Adjust device Id number to the phone you're monitoring and the email to your address
- Code: Select all
dev = indigo.devices[454125269] # Device Id number of target phone you're monitoring
geoEntered = dev.states['deviceEnteredGeo']
targetEmail = 'mike.hesketh@hotmail.com' # Where you want the notification sent
subjectEmail = dev.name+' '+'has just entered '+ geoEntered
bodyEmail = 'This email was sent from your Indigo Server'
indigo.server.sendEmailTo(targetEmail, subject=subjectEmail, body=bodyEmail)
indigo.server.log('email sent')
You'll end up with this:
This will send an email with the subject like "Mike's iPhone 6 has just entered Home"
You can also add additional conditions for the trigger if you want to check a single GeoFence or only activate the trigger at night.
Here's an example:
This will only send an email when enter the Home GeoFence and not any other. Of course I could add an Any clause and list a number of GeoFences that I'm tracking e.g. Home, Work, Gym, etc...
Hope that helps a bit
It's a bit harder to do that with iMessages - it's a feature I'll add to the list as a menu or action command that you can set up. Watch this space
Mike