The porch light was the first thing in the house we automated, and it's still the one people notice most. The goal is simple: on a little before it gets dark, low enough not to light up the street, bright when someone's actually out there, and off once the house goes to bed.

Sun elevation, not sunset

Home Assistant's sun trigger with an offset ("sunset minus 15 minutes") works, but a fixed offset feels different in June than it does in December. Twilight lasts longer in summer, and a cloudy winter evening goes dark early. Triggering on the sun's elevation tracks the actual light far better:

- alias: "Porch: evening on"
  triggers:
    - trigger: numeric_state
      entity_id: sun.sun
      attribute: elevation
      below: 2
  actions:
    - action: light.turn_on
      target:
        entity_id: light.porch
      data:
        brightness_pct: 35

A numeric_state trigger only fires when the value crosses the threshold, so this runs once in the evening as the sun goes down and never in the morning as it comes back up. Two degrees above the horizon turned out to be the sweet spot here. With the ridges to the west, the porch is in shade well before the official sunset.

Off at bedtime

- alias: "Porch: late off"
  triggers:
    - trigger: time
      at: "23:30:00"
  actions:
    - action: light.turn_off
      target:
        entity_id: light.porch

A motion boost that knows when to stop

A motion sensor by the steps brings the light to full brightness when someone comes up the path. The interesting part is what happens afterwards: the light should go back to its evening glow if it's still evening, or turn off completely if it's the middle of the night.

- alias: "Porch: motion boost"
  mode: restart
  triggers:
    - trigger: state
      entity_id: binary_sensor.porch_motion
      to: "on"
  conditions:
    - condition: state
      entity_id: sun.sun
      state: below_horizon
  actions:
    - action: light.turn_on
      target:
        entity_id: light.porch
      data:
        brightness_pct: 100
    - wait_for_trigger:
        - trigger: state
          entity_id: binary_sensor.porch_motion
          to: "off"
          for: "00:02:00"
    - if:
        - condition: time
          after: "12:00:00"
          before: "23:30:00"
      then:
        - action: light.turn_on
          target:
            entity_id: light.porch
          data:
            brightness_pct: 35
      else:
        - action: light.turn_off
          target:
            entity_id: light.porch

What we'd change

If the porch ever gets a proper outdoor light sensor, the evening trigger will switch from sun elevation to illuminance. The elevation trick is a very good approximation, but it can't see a thunderstorm rolling in over the hills.