Use geofencing to adjust your thermostat when you leave and come home

Includes Home Assistant automation

This automation uses your phone's location to set the thermostat back when everyone leaves and bring it up to comfort when the first person returns. A fixed schedule keeps heating an empty house on the days your plans change; geofencing follows the people, not the clock.

Get an automation idea like this - plus the week's smart home news and gear - in your inbox every Friday.

everyone_leftnearly_homenoyeseveryone leaves home for10 minutesthe nearest phone isnearly homeSet living room to 16°heading toward homeNothing happensSet living room to 20°
Trigger Condition Action Wait Nothing

What you need

  • A smart thermostat your platform can set from an automation. Nest, Ecobee and Netatmo are typical, and most connected models qualify.
  • A phone with location sharing enabled, added to your platform as a presence device. In Home Assistant that is the Companion app feeding a device_tracker into your home zone.
  • One presence device per person who lives there, if you want the rule to tell an empty house from a half-empty one.
  • For the early warm-up in Home Assistant, a Proximity set up for your home zone (a few clicks under Settings, Devices and services). It reports how far the nearest phone is and whether it is closing in. That is what the arrival half reads instead of a second zone.

How it works

Leaving is a boundary. When the last tracked phone crosses out of your home zone, the thermostat drops to a setback temperature a few minutes later. Coming home is a distance. A Proximity watches how far the nearest phone is. Once it closes inside a radius you pick, and is heading your way, the house lifts back to comfort. Two different signals, because the two directions are not the same problem. The second one is where a naive setup quietly fails.

A schedule heats by the clock. It warms the house at 5pm whether you are pulling into the driveway or still two towns over. And it holds a weekday setback in place on the Tuesday you happen to work from home. Geofencing reacts to where you actually are. The afternoon you stay out late, the heat never kicks on. The trip you forgot to plan for becomes an empty house running cool, instead of a warm one nobody is sitting in. Drop a heating setpoint a few degrees while the house is empty, and you trim a bill without anyone noticing the rooms were ever cooler.

Key the setback to the household, not to one phone. If it watches your handset alone, it fires the moment you leave while your partner is still home on the sofa. So count how many tracked phones remain inside the home zone, and set back only when that count hits zero. That is what makes "when everyone leaves" mean everyone. Give that empty-house trigger a few minutes of patience as well, so a walk to the bins does not kick off a heating swing you then have to undo.

Why you still walk into a cold house

Departure is the easy half. Arrival is where the naive version quietly disappoints, and it is worth seeing why before you blame the thermostat.

Picture two boundaries. A tight one you cross on the way out, and a wider one to catch you on the way back. The tight one is a real zone, so the setback keys off it the moment everyone leaves. The wider one is the trap. You cannot just draw it as a second zone around the first, because Home Assistant files each phone under only one zone at a time. The outer circle reads empty while you sit inside the inner one. So make the wider boundary a distance instead. A Proximity sensor tracks how far the nearest phone is and which way it is moving. The warm-up starts as someone heads home. If your heating recovers slower than the last stretch of the drive, that is the head start it needs.

Direction is what keeps that honest. Distance on its own would warm the house for any car that dips inside the radius, including the one only cutting through your streets. Because the sensor also reports whether the nearest phone is closing in or pulling away, the rule holds its fire until someone is genuinely heading home. A trip that approaches, then turns off before your door, is the one case it cannot catch. While its heading still points inward, the warm-up fires. With no arrival to follow, the comfort setpoint holds until the next real departure resets it. That is the standing price of starting early. Widen the radius for more of a head start, and you invite more of those stray warm-ups. Keep it to roughly the last part of your commute.

None of this is a warm house waiting on the doorstep. It is a head start, and a modest setback is what keeps that promise realistic. Cooling season flips the arithmetic. The away setpoint is higher rather than lower. The house drifts up while it is empty, and pulls back down as you return.

Which platforms can run it

Presence is the one kind of automation the mainstream platforms all handle, which is unusual for anything this useful. Several thermostats do a version of it alone. Nest, Ecobee and Netatmo ship an eco or geolocation mode that follows a single phone once you grant location permission, with no separate automation platform involved. SmartThings, Apple Home, Google Home and Alexa can each trigger a thermostat from arrive-and-leave location, though they track a single household presence and fire on one boundary. The distance-and-direction half is the hard part: warming the house before you reach the door, without warming it every time a car drives past. That leans on the Proximity logic only Home Assistant really exposes cleanly, with Homey close behind through its own per-person geofences. It is the rare automation where the cloud assistants are not shut out, just handed the plain arrive-and-leave version.

This idea is shared for inspiration only, not professional advice. If it involves wiring, breakers, or high-draw appliances, verify ratings and your local electrical code, or hire a licensed electrician. Read our full disclaimer.

Get the Home Assistant Automation YAML

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Example automation (Home Assistant). A starting point; swap in your own entity names.

alias: Warm the house as someone heads home, set back once everyone leaves
description: Set the thermostat back when the home zone empties, and warm up when the nearest phone is close and heading home.
mode: restart
trigger:
  - platform: numeric_state
    entity_id: zone.home
    below: 1
    for:
      minutes: 10
    id: everyone_left
  - platform: numeric_state
    entity_id: sensor.home_nearest_distance
    below: 2000
    id: nearly_home
action:
  - choose:
      - conditions:
          - condition: trigger
            id: everyone_left
        sequence:
          - service: climate.set_temperature
            target:
              entity_id: climate.living_room
            data:
              temperature: 16
      - conditions:
          - condition: trigger
            id: nearly_home
          - condition: state
            entity_id: sensor.home_nearest_direction_of_travel
            state: towards
        sequence:
          - service: climate.set_temperature
            target:
              entity_id: climate.living_room
            data:
              temperature: 20

Related Ideas

Tagged: presence-detection, energy-saving, climate-control

Want more ideas like this?

One or two fresh automation ideas every week, plus the smart home news and gear worth knowing. Delivered every Friday.