๐Ÿ˜คAngry Dad
โ† All automations
Securitymedium

Last One Out Locks Up

I am not the building's caretaker. The building is.

The problem

Everyone bolts for school and work and the house is left unlocked, lit, and heating an empty kitchen.

What it does

When the last phone leaves the geofence: doors lock, alarm arms, lights off, thermostat to eco. When the first person comes back, it relaxes again.

You'll need

  • Person/device tracking
  • Smart locks
  • Climate entity
  • Alarm panel (optional)

The payoff

Never drive back to check the door again.

The YAML

alias: "Angry Dad โ€” Last One Out Locks Up"
description: Secures and powers down the house when everyone has left.
mode: single
triggers:
  - trigger: state
    entity_id: zone.home
    attribute: persons
  - trigger: state
    entity_id: group.family
    to: "not_home"
    id: all_gone
  - trigger: state
    entity_id: group.family
    to: "home"
    id: someone_back
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: all_gone
        sequence:
          - action: lock.lock
            target:
              entity_id: lock.front_door
          - action: climate.set_preset_mode
            target:
              entity_id: climate.living_room
            data:
              preset_mode: eco
          - action: light.turn_off
            target:
              entity_id: all
          - action: alarm_control_panel.alarm_arm_away
            target:
              entity_id: alarm_control_panel.house
          - action: notify.mobile_app_dads_phone
            data:
              message: "House locked, armed, and powered down. Empty and behaving."
      - conditions:
          - condition: trigger
            id: someone_back
        sequence:
          - action: alarm_control_panel.alarm_disarm
            target:
              entity_id: alarm_control_panel.house
          - action: climate.set_preset_mode
            target:
              entity_id: climate.living_room
            data:
              preset_mode: home

Drop this into an automation (or a package under config/packages/) and swap the entity IDs for your own.

Want the next one automatically?

One automation like this in your inbox every week.