Hack Your Heating Using an iPhone Geo-fence

Here’s an interesting take on energy saving using the iPhones Geofencing feature to turn off the central heating automatically when no one is at home.

Introduction – With the advent of Apple’s iOS 6 comes the ability to use geo-fencing, a way of sending notifications based on your location.  I have often thought about how much money I could save by switching my heating off when no-one is at home, but constantly adjusting the boiler control is impractical given life’s changing schedule. However, I set myself the challenge of automating the process as soon as iOS 6 was released.

Warning: This project involves wiring mains voltage and altering your boiler controls. This is hazardous to health and may also break your boiler and void its warranty. Please do not attempt anything I describe below unless you understand these risks.

Required Ingredients

  • Single channel USB relay (plenty are available on eBay)
  • A smartphone capable of Geo fencing (in this case an Apple iPhone 4)
  • A server (in this case a Windows 7 PC, but in principle you could use something as basic as a Raspberry Pi)
  • A dedicated email account with POP or IMAP access
  • A script to read emails and control the USB relay (I wrote mine using Python)

Wiring Up The Boiler – Here are some wiring pictures for the boiler control and thermostat.


IMG_1171     IMG_1192
Addition of the black wire (sent to USB relay)        USB relay box. Note 3 spare relays

Find FriendsYou will see that I have inserted the relay as a switch between the thermostat and boiler control, so all three devices retain control of the boiler.  Note that I have wired the relay up as normally closed. This makes sure that the boiler reverts back to normal if the PC suddenly dies.

Setting Up The Smartphone – Here is how I setup my Apple iPhone. I created two notification conditions within the ‘Find Friends’ app to send an email to my dedicated address for when I leave and arrive at my home address. Luckily (for Apple), everyone in my house has an iPhone and so this process was repeated on each phone in turn.

Notify    Notification
Notification options within the app       Bespoke email address for the boiler!


Creating a Script – Here is the script process.  You will receive emails from Find Friends with the subject field reading “Benjiosaur has arrived/left Home”.
Software Process

Therefore you set a list of rules to decide whether anyone is in your house, and if not, switch the heating off. I can send you example code if you wish – just send me a message.

Testing – I have tested this app over the last month and it does work well. Notifications are sent from the iPhones within 2-3 minutes of leaving or arriving home, and so far it hasn’t let me down. I have thought about a few modifications which may improve the kit:

  • Trigger the boiler to also switch on once you leave a destination (e.g. work) so your house is pre-heated upon arrival.
  • Replace the boiler controller and thermostat with custom software using temperature probes in and outside the house for optimum efficiency.
I have yet to calculate actual savings for this winter – I will clearly save money if I arrive home late, but I am not so sure if I were to leave for just half an hour or so. When I get some spare time I’ll see if I can run a few calculations.

Overall Costs – Since I already have an always-on server and iPhone, the cost was literally just for the USB relay (~£30) and a few hours for wiring it in and writing the code.

This article was reproduced with kind permission of  benjiosaur.blogspot.co.uk

More Smart Home Heating Articles  :  Our Heating Controls Forum

Want More? – Follow us on Twitter, Like us on Facebook, or subscribe to our RSS feed. You can even get these news stories delivered via email, straight to your inbox every day

6 Comments on "Hack Your Heating Using an iPhone Geo-fence"

  1. Eamon O'Gorman | January 24, 2013 at 6:43 pm |

    Cool idea,, all sorts of ideas coming to mind for this kind of thing. For example activating outside lights when you arrive home St night so you can see your way into the house.

    Any way if reducing the delay though?

  2. Wasn’t even aware of that iOS feature thanks for posting. This would be an ideal raspberry pi project the GPIO could drive a relay example eBay item 200712189000. Something like feedparser to check mail and LCDproc driving a small LCD display. Could also arm your security system when you leave. How do you clear the email account to stop it filling up with mails ?

  3. Marcus Warrington | January 25, 2013 at 8:05 am |

    Great idea.

    For us Android users it’s worth noting that there is a really powerful App available called “Tasker” that we can use to do the equivalent of geo-fencing.

  4. Great to see that everyone is thinking along the same lines. I came across geofencing for the first time 2 weeks ago in a CES article and implemented it straight away on my Miniserver, because I could not stop thinking about it. I decided not to control the heating though, since it takes too long to heat the house up (UFH), but am using geofencing to make sure lights are off and the burglar alarm is set 🙂

  5. Hi phillip, would be great if you could show the process on Loxone.com

  6. try http://www.tado.com/gb 🙂 launching first week of November!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.