Toggle lights on/off when door opens

Automatically turning on lights when doors open is a versatile automation that solves lighting problems in many areas of your home. From closets that never have enough light to garage entries that leave you fumbling in the dark, this automation makes life easier.

Use cases

Indoor Applications

  • Closets - Illuminate contents automatically
  • Pantry - See all shelves clearly
  • Linen closet - Find items easily
  • Room entry - Automatic lighting

Outdoor Applications

  • Garage entry - Light up when arriving
  • Exterior doors - Porch/patio lights
  • Shed/storage - Building illumination
  • Gate entry - Pathway lighting

Products needed

Essential Equipment

Contact Sensor
Popular brands: Aqara, SmartThings, Ring, Wyze
Battery-powered for easy installation • Zigbee/Z-Wave for reliability
Smart Light Switch or Bulb
In-wall switch for permanent fixtures • Smart bulbs for flexibility • Dimming capability recommended
💡 Outdoor Installation Tips
  • Use weather-rated sensors (IP65+)
  • Protect with weatherproof enclosures
  • Consider temperature range (-20°F to 120°F)
  • Use UV-resistant materials

Basic automation setup

IF closet door opens THEN turn on closet light to 100%

Triggers

  • Contact sensor changes to "open"
  • Door opens (specific door)

Conditions (optional)

Time-based: Only during certain hours
Lux sensor: Only if room is dark
Day vs. Night: Different brightness levels

Actions

  • Turn on light switch/bulb
  • Set to preferred brightness level
  • Optional: Set color temperature

Platform-specific examples

Home Assistant logo

Home Assistant

Trigger Closet door opens
Condition Light level below 50 lux
Action Turn on light at 100%
SmartThings logo

SmartThings

IF "Closet Door Sensor" opens
THEN Turn on "Closet Light" to 100%
Hubitat logo

Hubitat

Trigger Contact sensor opens
Action Turn on closet light to 100%
Setup: Use Simple Automation Rules or Rule Machine
Apple HomeKit logo

Apple HomeKit

When Door sensor detects open
Time Anytime (or add condition)
Do Turn on Closet Light
Alexa logo

Alexa

When "Door Sensor" opens
Condition Time between sunrise/sunset
Action Turn on light to 100%
Google Home logo

Google Home

When "Door Sensor" opens
Condition Time of day (optional)
Action Turn on "Closet Light"

Advanced features

Day vs. night brightness

Adjust brightness based on time of day:

  • Nighttime (10 PM - 6 AM): 30% brightness, warm white (2200K)
  • Daytime: 100% brightness

Auto turn-off when door closes

Turn off light 2 minutes after door closes:

  • Prevents lights turning off while door swings closed
  • Avoids rapid on/off cycles during multiple trips
  • Still energy efficient

Related automations: