Recently Active is a template blueprint that builds a binary sensor that reads on while a source is on, and stays on for a window of seconds after the source clears. It works on any on/off source and on any numeric sensor with an above or below threshold.
Why this Matters
Home Assistant triggers fire once, the instant a state crosses a line. The door opens, the event fires, it's gone. Five seconds later you ask "was the door just used" and nothing in your config can answer, because the crossing happened once and Home Assistant moved on. Every automation that wants a soft linger hits this wall: act when the room has been quiet for five minutes, hold off on the cycle-complete alert until the appliance is really done, don't run the vacuum while people are around.
Recently Active solves it with one entity that anything can read. Accurate to the second under the hood, because it builds a delay_off binary sensor. Add a half-dozen of them in one package and your config gets simpler, not heavier, because the answer to "is X recently active" stops being scattered across the automations that need it.
Versus the Alternatives
- A
for:clause inside a single trigger: good for sub-30-second windows that live entirely inside one automation. The held state never leaves that automation. - A timer helper plus automations: good for long windows you want to pause, cancel, or watch tick down on a dashboard. Survives restarts visibly.
- History Stats: good for sums ("on for X minutes in the last hour"), not "recently on."
- Recently Active: good for the band between thirty seconds and an hour, especially when more than one automation needs to read the same recently-true answer.
Worked Example: Motion-Activated Lights with a Five-Minute Linger
A motion sensor fires for a few seconds then clears. You want the lights on for five minutes after the last motion. Build the sensor:
template:
- use_blueprint:
path: TheThinkingHome/recently_active.yaml
input:
source_entity: binary_sensor.hallway_motion
unique_id: hallway_recently_active
linger_seconds: 300
sensor_name: Hallway Recently Active
device_class: occupancy
Then drive the lights off the linger, not the raw motion:
automation:
- alias: Hallway lights on with motion
trigger:
- trigger: state
entity_id: binary_sensor.hallway_recently_active
to: "on"
action:
- action: light.turn_on
target:
entity_id: light.hallway
- alias: Hallway lights off after linger
trigger:
- trigger: state
entity_id: binary_sensor.hallway_recently_active
to: "off"
action:
- action: light.turn_off
target:
entity_id: light.hallway
Lights on the moment motion arrives, off five minutes after the last motion. If only the lights cared, a for: clause on the trigger would do the job too. The blueprint pays off the moment something else also wants the same answer: the robot vacuum's "don't start in an active room" check, the goodnight script's "are we sure" guard, an away routine's sanity check. One sensor, many readers.
A Numeric Example: Is the Appliance Actually Finished?
For numeric sources, use the above or below mode. A dishwasher draws power in bursts with quiet stretches between them, so a plain "drawing power" check fires "done" mid-cycle. With Recently Active:
template:
- use_blueprint:
path: TheThinkingHome/recently_active.yaml
input:
source_entity: sensor.dishwasher_power
comparison: above
threshold: 5
linger_seconds: 300
sensor_name: Dishwasher Recently Running
unique_id: dishwasher_recently_running
device_class: running
binary_sensor.dishwasher_recently_running stays on through the quiet stretches and only drops when the draw has been under five watts for the full five minutes. Hang the cycle-complete notification on its off transition and it lands when the dishes are actually clean.
Get It
One click imports the blueprint. The README on GitHub has the full setup walkthrough, the parameters reference, device-class advice, and the longer story behind a couple of design choices: Automations/blueprints/template/recently_active.md at 8323333b57aa704eae8bee10bad7c121e51905b6 ยท TheThinkingHome/Automations ยท GitHub
Tested with Home Assistant 2026.5.4 or newer.
GPL-3.0-or-later. First of a small series, each one a single useful thing kept deliberately simple.
Other blueprints in The Thinking Home series:
- Recently Active โ Create a "was active recently" sensor from any source, with a configurable look-back window.
- Sensor Failover โ Fall back to a secondary sensor when the primary goes unavailable.
- Linked Entities Pro โ Two-way sync for any number of entities across switches, lights, input_booleans, fans, and groups.
- Sensor Watchdog โ Detect sensors that have stopped responding and power-cycle them back.