GMail Sensor Plugin and iOS location based events HowTo

I’ve made a plugin that toggles the state of a sensor based on whether emails are matched in your Gmail account according to a defined pair of labels.

Here is an example use case for location based events from an iPhone. I initially tried the Latitude plugin but found it used too much memory on my Vera Lite. I didn’t want to use the FindMyPhone plugin as I did not want to enter my iCloud password into Vera.

  1. Create a dedicated Gmail account for home automation alerts
  2. Setup notifications in the FindFriends app on your iOS device for when you leave and arrive at a location (e.g. Home). Set the Gmail email address as the recipient. Remember to create repeating alerts.
  3. Leave the location and return to trigger the notifications, or manually trigger from the app (hard to do for the Away notification if you are at home!)
  4. Log in to the Gmail account and create Filters that match the home and away notifications. You need to configure the filters to attach a Label, e.g. “home”, “away” automatically. Choose to apply the Filter to the current message inbox and check that the Labels are populated.
  5. Download the package from github and upload all files except the README to Vera, using Apps/Develop Apps/Luup files
  6. Create an instance of the plugin using the Apps/Develop Apps/Create Device option. The device type is “urn:chrisbirkinshaw-me-uk:device:GMailSensor:1” and the device file name is “D_GMailSensor1.xml”
  7. Reload vera, wait until it has completed, then refresh the page in your browser
  8. Edit the parameters in the Advanced tab of the new device: Username, Password, OnLabel, OffLabel. The Labels need to match the ones you created before in Gmail.
  9. Save and reload Vera

That’s it!


I’m always on the hunt for location based plugins… I see what your doing vs The iPhone location Plugin

Does this method use less battery by chance ?

I’m muting the iPhone location plugin and that has helped a lot.

Well it uses the Apple Find Friends app to generate the email notifications that serve as the trigger. I have been running this app since I got my phone, as I send my girlfriend alerts when I get home or pass close to her place of work. I’m not really sure how this impacts the battery.

The main reason I went this route was security. At one point I used IFTTT, but I didn’t like having my Vera password stored there.

A couple of points about this plugin.

The Gmail label cannot have a space in it
The plugin does not show up as a sensor in Vera - in fact you can’t use it to trigger anything

Hi Chris

Interesting plugin.

If you ever want to spin off another, or just share the code to do this, but I’ve been looking for AGRs for something that could monitor a gmail account for new mail; and the then using the Say command on a Sonos tell “you have new mail, from with the subject line xxxxxxxxx”


the sensor does not seem to appear as a trigger when i setup a scene even though it is setup as a device. what am i doing wrong? thanks!

@mda. It works fine using PLEG and Input - Device Properties. Note that it checks Gmail every minute for new mail.


Thanks. can anyone point me in the right direction to mod it so i can use it with standard vera scenes? i don’t use PLEG (at least not yet). Any help would be much appreciated.

Thanks, Chris for creating this plug-in! Exactly what I was looking for!

I’m just hacking away at it, but using UI7 to be able to use this in a Scene as a trigger, I just simply replaced the full contents of the D_GMailSensor1.json with the contents of the D_MotionSensor1.json file. (Apps->Develop Apps->download the D_MotionSensor1.json file)

That did it. Now I could use it flawlessly in a scene without the need for PLEG.

Next up… if anyone want to try it… want to get the Google API with Oauth working so that the GMail account security settings don’t need to be off to make this work.
If you are having trouble using the plug-in, it’s because you need to Turn ON access to “less secure scripts” here

I’d rather avoid that, so if anyone knows how to modify this app to use Oauth, please shout out!