Best Practices for complex lighting rules

The quantity of automations (and associated entities) needed to create a solution is entirely at your discretion. Basically, do whatever is easier for you to create and maintain.

For example, I have a single automation that handles the control of two lights (interior/exterior) whenever the garage door is open/closed after dark. It monitors several entities to do its job:

  • binary_sensor for the garage door (contact sensor)
  • timer for determining when to turn off interior/exterior lights
  • binary_sensor for garage occupancy (motion sensor)

Here’s what that single automation does:

If it’s after sunset and the garage door opens:

  1. Turn on the garage light and the exterior light (but only if they are currently off).
  2. Start the timer with 10 minutes.

If it’s after sunset and the garage door closes:

  1. Start the timer with 2 minutes.

When the timer expires:

  1. Turn off the exterior light.
  2. If the garage is unoccupied, turn off the garage light.
  3. If the garage is occupied, wait for it to become unoccupied before turning off the garage light.