On my Car Integration page you can see how I have setup a tracking system that integrates with Homeseer. What I really wanted is Geofences.

Example: When my car enters a geofence I get a push notification.
Example: When my car leaves a geofence the thermostat is set to 17 degrees

Option 1: use defined coordinates to see in which ‘location’ the car is

Great because I already have the coordinates. The problem however is to identify a circular geofence based on 1 set of coordinates and a distance. That’s not easy!

Option 2: use the GPS tracking website’s geo-fence & notification functionality

This turned out to be the easiest. Also because I wanted to have email integration into Homeseer anyway.
Let’s go with option 2


Tracking system
– Account with http://orange.gps-trace.com linked to your tracker
– Homeseer 2.5.x (might work on earlier releases, I just happen to test this with HS
Jon00 POP3 Email package v3
sTunnel (for SSL integration of for example Gmail or Bluehost), see instructions in Stunnel/Jon00 email post.
– My Geo-fence Script (see step 2)


How does it work?

  1. Create geo-fences that ‘define’ your home, work and other important locations
  2. Create notifications that send emails to HS, triggered by entering/exiting the geo-fences from step 1
  3. Emails are send to an email address which is monitored by Homeseer.
    Based on the email content a script is started.
  4. Homeseer runs this script that sets device status

1. Setup Geofence

Login to orange.gps-trace.com and click the “Geofence” section on the left.
IMPORTANT: These geo-fence names should exactly match the virtual devices in HS. (on this page you will find differences though). In the case below your HS devices would be named “Fence_Home”, “Fence_Home_exit”, etc.


2. Setup Notifications

Here’s an overview of some Notifications that I have setup.


NOTE: Currently it is NOT possible to create ‘exit geo-fence’ notifications where the geo-fence name is in the email. Think about it. You LEFT a geo-fence and now an email is send but there is no fence-name because you just left it ;-)
Workaround: Create an exit notification for each geo-fence where the geo-fence name is FIXED in the email instead of using the %FENCE% token.

Here’s screenshots that show the configuration steps of one notification “xxxx”

0_notification_step1 0_notification_step2 0_notification_step3 0_notification_step4 0_notification_step5 0_notification_step6

As you can see this example is for a geo-fence ENTRY and therefore the %ZONE% token can be used (see ‘note’ above)

The email being send looks like this:

At %POS_TIME% it moved with speed %SPEED% near %LOCATION%

The important part is the first line. Email body text enclosed in 3 square brackets triggers a script, with the text between brackets as parameters. So an email with the above content runs the script below.


Attachment: HS-GPS-GEOFENCE-0.2.zip
Extract zip file, copy .vb to your HS scripts folder, edit .vb file and change the parameter strGeoDevicesStartWith. This is used to find your geo-fence location devices. In case of Step 4 the parameter would look like this:
strGeoDevicesStartWith = “Car_in_”


3. Setup Email integration

Jon00’s POP3 Email package. See this post for information & instructions

This plugin is configured to start a script based on email content, sender, etc. Here’s what I configured to start the DJ_GPS_test_01.vb script.


NOTE: email content ‘wrapped’ in [[[3 square brackets]]] is being send to the script as parameters.

4. Configure Homeseer

Create Homeseer devices for each location


Here’s the script that set’s the device status based on the notification emails received. Your geo-fence names configured in orange.gps-trace.com need to match the device names in Homeseer. That’s how it knows where to link a device to.
So if in the case above (G76 and G77) and email would come in triggering the script
It would scan all HS devices and if the device-name starts with “Car_in_” (step 2) . The script will find 2 devices that match (G76,G77). The device-name that exactly matches “Car_in_HOME” it will set that device ON (if the parameter was ‘ENTERED’) and ‘OFF’ in any other case.

The only thing you have to do in the script is modify strGeoDevicesStartWith. That tells the script with what name the Geo-fence devices start with. In this case it’s set to “Car_in_”


If everything works you could turn off debugging by changing the script parameter “strDebug” from 2 to 1 or 0. I leave it at 2 because this is not generating a giant amount of data anyway.



GPS Geo Fences — 3 Comments

  1. I am thinking of purchasing a TK102-2 tracker – will this work with that type of device?
    If so, how many geo-fences can I run simulataneously?
    Is there a limit?

    Many thanks

  2. Pingback:Geofence integration Homeseer – Domoticaworld.com

Leave a Reply

HTML tags allowed in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>