Stop Getting Blinded by Your Smart Lights at Night

Set a gentler brightness for any dimmable light that turns on at night, without maintaining a light list. A complete Home Assistant package and a short YAML walkthrough.

Watch on YouTube ↗Get the code ↗Explore the gear →

A smart light coming on at full brightness in the middle of the night is one of those little things that makes the house feel a lot less smart. I want enough light to see where I’m going. I don’t need the hallway trying to wake everybody up.

A table lamp with YOU NEED THIS text for the Home Assistant nighttime brightness automation

This is a small Home Assistant automation based on a whole-house approach we used to run. When an individual dimmable light turns on, the automation checks the time and sends a brightness level back to that same light. There isn’t a list of lights to maintain.

Give the lights a nighttime brightness

The example uses 25% from 8 PM until 11 PM, then 10% until 6 AM. During the day, it leaves brightness alone. Those numbers are just a starting point. Use whatever lets you move around your house comfortably.

The schedule runs when a light turns on. It doesn’t go through the house dimming lights that are already on when the clock hits 8 PM, and it doesn’t keep fighting you if you move the brightness slider afterward.

Listen for the light that turned on

Home Assistant sends a state_changed event when an entity changes. The first condition narrows those events down to the light. domain and an actual off to on transition. The light also needs a brightness attribute so we can dim it.

The event carries the entity ID. That becomes the target of light.turn_on, so turning on the hallway adjusts the hallway. It doesn’t turn on the kitchen along with it. Add another dimmable light later, and the same rule can handle it without editing an entity list.

Known aggregate light entities are skipped using their group attributes. Their individual members are handled separately. The rule also applies when a scene, motion sensor, or another automation turns a qualifying light on, so use this whole-house version where you want the nighttime brightness to take precedence.

The complete package YAML

If you already use Home Assistant packages, this is the self-contained file to add. It doesn’t need any helpers or extra integrations.

automation:
  - alias: Night Brightness
    id: night_brightness_video_example
    mode: parallel
    max: 20
    triggers:
      - trigger: event
        event_type: state_changed
    conditions:
      - condition: template
        value_template: >-
          {% set old = trigger.event.data.get('old_state') %}
          {% set new = trigger.event.data.get('new_state') %}
          {{ trigger.event.data.get('entity_id', '').startswith('light.')
             and old is not none and new is not none
             and old.state == 'off' and new.state == 'on'
             and new.attributes.get('brightness') is not none
             and not new.attributes.get('entity_id')
             and not new.attributes.get('group_entities')
             and not new.attributes.get('is_hue_group', false) }}
      - condition: time
        after: "20:00:00"
        before: "06:00:00"
    actions:
      - choose:
          - conditions:
              - condition: time
                after: "23:00:00"
                before: "06:00:00"
            sequence:
              - action: light.turn_on
                target:
                  entity_id: "{{ trigger.event.data.entity_id }}"
                data:
                  brightness_pct: 10
        default:
          - action: light.turn_on
            target:
              entity_id: "{{ trigger.event.data.entity_id }}"
            data:
              brightness_pct: 25

Using the automation editor instead? Create a new automation, choose Edit in YAML, and paste the automation without the outer automation: wrapper. Start with alias: Night Brightness, remove the list dash before it, and shift the remaining automation two indentation levels to the left. Install one version so you don’t have two copies responding to the same event.

Change the hours and percentages

The first time condition is the overall night window: 20:00:00 through 06:00:00. Inside the action, choose checks the later 23:00:00 through 06:00:00 window. That branch uses brightness_pct: 10; the default evening branch uses 25. Change the times and percentages to make the schedule yours.

The brightness service causes another state update, but the light is already on by then. Our condition only accepts off-to-on, so the brightness update doesn’t start another adjustment. Unavailable-to-on recovery and newly discovered on entities are skipped as well.

Test it by turning an individual dimmable light off and on during the configured window, then checking its brightness and the automation trace. The editor’s Run actions button doesn’t supply the event that this target template needs. During daytime testing, temporarily change the time window and put it back afterward.

The example was checked against Home Assistant 2026.10.2 using real event listeners in an isolated instance, including time boundaries and brightness feedback. The event trigger documentation and time condition documentation cover the pieces used here.

Keep the lighting YAML easy to live with

I’ve written before about simplifying a Hue configuration. This is the same sort of maintenance win: decide what should happen, then avoid another list to keep updated. If you want more everyday controls to go with it, my big-button dashboard walkthrough is a useful next project.

My current household brightness rule is in the public repository. That file has household-specific scope and exceptions; the package above recreates the earlier whole-house idea as a portable example. You can browse more Home Assistant packages here.

Watch the short walkthrough

The video shows the lamp example and follows the actual YAML from the event to the brightness action. It’s a small change you can adapt to a house that already knows how to turn the lights on.

Happy Automating!

Advertisement

Keep building

The next useful idea, in your inbox.

Get new vCloudInfo posts by email.

Get new posts