Loading...
Author Cloudapp
E.G.

Motion Light With Time-of-Day Brightness in Home Assistant: the choose Pattern (30% Night, 70% Morning, 100% Day)

July 14, 2026
Table of Contents

A simple motion light in the stairwell is quick to build: motion detected, light on, off again after a few minutes. You only notice the problem at night. In my own stairwell, the sudden 100 % light at three in the morning blinded me so badly that I was wide awake afterwards. During the day, on the other hand, dimmed light is too weak to see the steps safely.

The fix isn't a second setup or an expensive adaptive-lighting layer — it's a single choose: block in the motion automation that grades brightness by time of day: 30 % at night, 70 % in the early morning, full 100 % otherwise. Plus the one real-world lesson that cost me two evenings of debugging — against flicker, a longer delay helps, not a shorter one.

Why on/off alone isn't enough

A fixed brightness level is always set for the wrong time of day. Set it to full and it blinds you at night. Set it dimmed and it's too dark during the day. That's exactly where the pattern comes in: motion stays the trigger, but how bright the light comes on is decided by a short time branch inside the actions. No second sensor, no second automation — just one choose block.

Step 1 — the choose block for time-of-day brightness

The core is the choose: block in the actions. It checks conditions top to bottom and takes the first branch that matches; if none does, the default runs. I use three tiers: 22:00–06:00 dimmed to 30 %, 06:00–08:00 medium at 70 %, and the rest of the day at full 100 %.

actions:
  - choose:
      # Spaete Nacht (22:00-06:00): gedimmt, blendet nicht
      - conditions:
          - condition: time
            after: "22:00:00"
            before: "06:00:00"
        sequence:
          - action: light.turn_on
            target: { entity_id: light.stiegenhaus_eg }
            data: { brightness_pct: 30 }
      # Frueher Morgen (06:00-08:00): mittlere Helligkeit
      - conditions:
          - condition: time
            after: "06:00:00"
            before: "08:00:00"
        sequence:
          - action: light.turn_on
            target: { entity_id: light.stiegenhaus_eg }
            data: { brightness_pct: 70 }
    # Default: volle Helligkeit
    default:
      - action: light.turn_on
        target: { entity_id: light.stiegenhaus_eg }
        data: { brightness_pct: 100 }

Two things matter. First, order is decisive: the night branch comes first because its window doesn't overlap the morning branch — with overlapping windows the first match wins. Second, the time condition is correct across midnight: after "22:00:00" / before "06:00:00" covers the night properly, because Home Assistant treats that as one continuous window spanning the day boundary. Replace light.stiegenhaus_eg with your own light entity.

Step 2 — turning it back off cleanly

The second part is switching off. Most motion sensors report "no more motion" fairly quickly once you stand still. If you turn off directly on that, the light keeps flicking on and off whenever someone pauses on the stairs or stands in the hall on a call. The for: filter on the off trigger waits until the sensor has seen nothing for a continuous stretch of time.

triggers:
  - trigger: state
    entity_id: binary_sensor.bewegungsmelder_stiegenhaus_eg
    from: "on"
    to: "off"
    # Flacker-Fix: lieber 5 Min als 1 Min - kurze Delays lassen das Licht
    # bei stillem Sitzen an/aus springen
    for:
      minutes: 5
actions:
  - action: light.turn_off
    target: { entity_id: light.stiegenhaus_eg }

This block is the separate off automation (or the off trigger of the same automation). The trigger only fires when the sensor has stayed "off" for 5 uninterrupted minutes — if someone moves again in that window the timer resets and the light stays on.

The flicker fix: raise the delay, don't lower it

This is the lesson that feels counter-intuitive. When the light flickers — rhythmically on and off while someone sits still or walks the stairs slowly — the first instinct is to shorten the off delay so it reacts faster. That makes it worse. PIR motion sensors detect heat movement; sit still and the sensor drops to "off", you breathe or reach for a glass and it goes "on" again. A short delay lets the light chase that jitter.

The solution is a longer for: delay. At 5 minutes the timer bridges the dead phases where the PIR sees no motion even though someone is still there. Better the light stays on a few minutes too long than a blinking stairwell.

Sensible delays per room type

The right for: duration depends on how long you typically stay in a room with little movement. In a stairwell or pass-through hall, 2–3 minutes is enough, because you rarely stand still long. In a room where you sit — a study, a reading chair — go higher, to 8–10 minutes, or the light cuts out during focused work. My stairwell runs on 5 minutes as a good middle ground: generous enough against flicker, short enough that no light burns for hours in an empty stairwell.

Extending: only after dark, or with more tiers

If you don't want the light to come on at all in bright daylight, add a sun condition (sun.sun = below_horizon) or an illuminance sensor as an extra condition on the on trigger. The choose pattern itself scales freely: add more time windows (say a midday tier) or run different brightnesses per weekday. If you're curious how the same motion sensors feed presence heuristics, see the "last motion" sensor — it builds on the same triggers.

Frequently asked questions

Why a choose block instead of several automations?

You could build a separate automation per time of day with its own time condition, but that scatters the logic across three places and makes changes error-prone. The choose block keeps the whole time-of-day branch in one automation — one glance, one place to tune. That's exactly what choose: is for: several mutually exclusive branches under one trigger.

My light still flickers — what now?

First raise the for: delay further (say to 8–10 minutes) and see if it disappears — usually it does. If it persists, it's often the sensor hardware: some PIR units have their own cool-down/blocking time set too short, or the detection field is so narrow that a small turn drops you out of it. Then it comes down to sensor placement, or an mmWave presence sensor that also detects still occupancy.

Can I leave it fully off at night instead of 30 %?

Yes — just replace the light.turn_on in the night branch with no action, or drop the branch entirely (the default won't take over since the trigger still fires). Cleaner is to keep the night branch and dim very low there (say 5–10 %): enough to see the steps without waking up. Going fully dark on a staircase at night is a safety risk.

Does this work with any light or only dimmable ones?

brightness_pct assumes the light entity supports dimming. With a plain on/off switch, Home Assistant ignores the brightness value and just turns it on. Then the time-of-day grading does little — in that case a dimmable bulb or a dimming actuator is worth it, especially in the stairwell where the night-time glare is the actual problem.

Related articles