Home Assistant

Adaptive night path

At night, motion turns a path of lights on at a low brightness. The lights stay on while the sensor still sees you, and a new detection restarts the off timer.

Difficulty · BeginnerSetup · 20–45 minutesHA · current stable (blueprint)
Get the pack · from $19Have us set it up

Some hardware links on this page are affiliate links. As an Amazon Associate I earn from qualifying purchases. We may earn a commission if you buy through them, at no extra cost to you. See the affiliate disclosure.

A hallway light at full brightness is a flare at 2 a.m. A motion light that turns off on a fixed timer leaves you in the dark when you stop to open a door. This pack turns the path on at a low level (pack default 10%) only at night, holds that level while the sensor still says someone is there, and starts the off delay only after the sensor clears. If the sensor trips again during the delay, the off is cancelled and the timer starts over the next time the path is clear.

A scheduled ramp before a phone alarm is phone-alarm wake light. That one ignores motion. This one ignores the alarm.

Entity ids are blueprint inputs (binary_sensor.hall_motion, light.path). Do not publish which hallway the sensor watches.

What problem it solves

You want a dim path from the bedroom to the kitchen at night, on only while someone is actually in it, without a second automation fighting the brightness back to 100%.

How it works

  1. Night gate — either sun.sun is below_horizon, or the clock is inside a window you set (pack default 22:00 to 07:00). Home Assistant’s time condition treats an after that is later than before as a window that crosses midnight. Pick one gate. Sunset-to-sunrise is the right gate for an outdoor path. A clock is the right gate for a hallway you still use, fully lit, after sunset.
  2. Motion on — binary_sensor.hall_motion (or a presence or occupancy binary) going on calls light.turn_on with brightness_pct at the night level. The target can be one light, a light group, or an area’s lights. It does not recall a daytime scene.
  3. Hold while present — the automation waits until the sensor returns to off. A presence sensor that stays on while you stand in the hall never starts the off timer. A PIR that only blips on for a second will, so the off delay has to cover the gap between blips.
  4. Off delay, restarted — after the sensor clears, wait the courtesy delay (pack default 30 seconds, up to an hour). mode: restart means a new on edge during that wait kills this run and starts over at the turn-on step. The pending light.turn_off never happens. When the delay does finish with no new detection, the lights turn off.
  5. Bypass — an optional boolean skips the whole run. Use it when you have set the same lights bright on purpose and do not want the next passing trip to yank them to 10%.

The pack does not fade the brightness down before off. Off is off. Raise the delay if that feels abrupt.

Hardware notes

  • Sensor. Any motion, presence, or occupancy binary_sensor. A PIR you already have is enough. The HC-SR501 is the “nothing is installed” option: set its onboard delay pot short and let this automation own the timer. A long pot plus this delay stacks, and the light lingers after you left.
  • Lights. They have to accept brightness. A switch-only lamp will turn on at full level and ignore brightness_pct. Group the path (bedroom door, hall, kitchen threshold) so one sensor can light the walk. A sensor at only one end of a long hall will drop the far light while you are still in frame of nothing.
  • Several sensors. Put them in a group that is on if any member is on, and trigger on the group. Restart logic on one sensor does not see the other sensor’s “still here.”

Snippet

The pack ships a blueprint. mode: restart is the reset.

mode: restart
max_exceeded: silent

trigger:
  - platform: state
    entity_id: !input motion_sensor
    to: "on"

condition:
  - condition: state
    entity_id: !input bypass
    state: "off"
  - condition: state
    entity_id: sun.sun
    state: "below_horizon"

action:
  - action: light.turn_on
    target:
      entity_id: !input path_lights
    data:
      brightness_pct: !input night_pct
  - wait_for_trigger:
      - platform: state
        entity_id: !input motion_sensor
        to: "off"
  - delay:
      seconds: "{{ off_delay_s | int }}"
  - action: light.turn_off
    target:
      entity_id: !input path_lights

night_pct defaults to 10. off_delay_s is the courtesy delay in seconds. The clock-window alternative replaces the sun condition with a time condition (after / before) so the path can stay dark through a bright evening. A new on during the delay restarts the automation at light.turn_on, which cancels the off.

Setup outline

  1. Confirm the sensor is on only while someone is in the path, and that the lights accept a brightness in Developer Tools.
  2. Import the blueprint. Select the sensor, the lights, 10% brightness, a 30 second off delay, and either the sun gate or a 22:00–07:00 window. Add a bypass boolean if those lights are also used at full brightness.
  3. After dark, walk into the path. The lights should come on dim, not at their last daytime level.
  4. Stand still in view of a presence sensor, or keep tripping a PIR. The lights should stay on. Step out, wait out the delay without re-entering, and confirm they turn off.
  5. Step back in during the delay. They should stay on, and the off should move later by a full delay after you leave for good.
  6. In the daytime (or outside the clock window) walk the same path. The lights should not change.

Troubleshooting

  • Comes on at 100%. The turn-on call is not sending brightness_pct, or the bulb restores the previous level and ignores brightness on an already-on light. Turn the path off first in the test, then trip the sensor. Some bulbs need brightness (0–255) instead of brightness_pct.
  • Turns off while you are still there. The sensor has already gone off and the delay is shorter than the gap before the next blip. Lengthen the delay, or use a presence sensor that holds on. Restart only helps after a new on edge. It cannot extend a wait that has not been retriggered.
  • Never turns off. The sensor is stuck on (a PIR aimed at a vent or a swaying curtain), so the wait never completes. Fix the aim. The delay runs only after a real off.
  • Daytime trips still light the path. The sun condition is missing, or the clock window is wide enough to include the evening you still want at full brightness. Narrow the window.
  • Next trip dims a light you turned up. That is the blueprint doing its job. Turn the bypass on while you want the manual level, or exclude that lamp from light.path.
  • Two sensors, one end goes dark. The automation is bound to a single binary. Group every sensor that should count as “someone is still on the path.”
  • PIR delay and this delay both run. The module holds on for its own pot setting, then this pack adds the courtesy delay. Shorten the pot. Home Assistant should see the edges.

Credits

Based on the community blueprint Adaptive Night Path by teodesign, and the blueprint file in Adaptive-Night-Path-Blueprint-for-Home-Assistant. This write-up is an original overview of a night-only, low-brightness path whose off timer restarts when presence returns.

Changelog

v1.0 · Oct 24, 2026: First publish.