A geofence is a coordinate that is registered with your iOS device and some action is performed when you enter or exit that area. This is a great way to know when you’ve left the house to turn off lights or setback the thermostat or other such things. Because it relies on an external connection from a remote server it’s best not to do a single point of arming or disarming an alarm via this data however.
There are many apps that can do various things when entering or leaving a geofence my current favorite is Geofancy which also supports iBeacons. It’s main action is hitting a web page and passing it’s data. XTension can receive that hit and turn on or off a unit in response to your area changes. From there with a little scripting you can do anything you like with that data.
In order to accept the connection from the app on your phone you need to first setup the JSON interface as described in the wireless tags interface page. This is the interface that will listen for and accept the connection from geofancy.
In order for a phone not on your local network to contact you you’ll also need an account with http://www.dyndns.org/ or http://no-ip.com which will provide a DNS name for your potentially changeable IP address.
finally you’ll need to setup an NAT passthrough on your router so that connections to whatever port you setup the JSON interface on is passed through from the outside world to the XTension machine. The internal port has to be the same as you configured on the JSON interface. The external port can be anything over 1024 but should probably be the same just to avoid confusion. It just means that any request on that port will be forwarded to XTension which is listening for it.
Inside Geofancy create a new geofence and use either your current location or look up by address. (It would be great if you could drop a pin exactly where you wanted it by moving the map around, but that doesn’t seem to work, lookup is only by address. Feel free to make a feature request to do this to them)
The next step is to fill in the url to hit when you enter and exit an area. The url will look something like:
http://yourname.dyndns.org/[TAG created in the JSON interface]/[unit address]/on http://yourname.dyndns.org/[TAG created in the JSON interface]/[unit address]/off
The biggest problem is getting the TAG into the app, it’s a long alphanumeric string you created in the JSON interface and you’ll just have to type it in.
Create a unit in XTension and set it’s interface to the JSON interface you created and it’s address field to the same thing that you put in the [unit address] field in the URL’s above. It’s the address thats important there and needs to be unique among all your units on this interface. So something like JPHONEHOME is descriptive enough, then you can put anything in the actual name of the unit for display that you like. The name should contain only URL friendly characters and no spaces.
Then change the type of request from POST which is the default to GET.
click save. Make sure that background updates are enabled for geofancy.
Geofancy is supported in XTension builds 880 and later.