Closet Light from Door Sensor

I’ve seen several others of these out there, but I never found one that handled the corner where the light was turned on without being managed by the automation, or the light manually turned on after timeout. It’s probably out there, but I wrote this so I figured I’d share it.

This variety of the pattern adds a second trigger to turn the light off outside of the standard wait-for-condition action.

The automation is simple:

  • If door is opened (or if door is closed):
  • (If door is opened was trigger): Turn on light, wait for door to close - or timeout interval.
  • Turn off light.

I’m sure there’s plenty more I could to make this better and I’m all ears.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Source: Home Assistant - Automate closet light with door · GitHub

1 Like


I was just setting up some door sensors and wanted to setup exactly as per your blueprint.
Installed and works great. This is a great automation. I’m sure there will be more scope to add but for me it works perfectly. Thanks for sharing.

If I had one recommendation I think a time setting of hh:mm:ss would be easier to work with rather than seconds for long times.


I like that idea! My plan for longer times was to enter them in the input box (I use 1800 seconds for most of mine), but that’s not the most ideal ux for most.

I’m not quite sure how to implement it yet, but I’ll give it some thought later today. Thank you!

This is great! I have a question/potential request:

I currently have 3 automations for “door” (it’s fence gate) deals with a light.

#1 When gate opens, turn light on and red. This warns “do not let the dogs out back!”.
#2 when gate closes turn off the light (ok to let dogs poop).
#3 If the light is turned off BUT the gate is still open - turn back on light and make it red.

3 is what I would like to incorporate into your blueprint or otherwise. Use case is someone sets a scene that turns off the “warning light” while the gate is still open.

This way I can reduce 3 automations down to 1. Any suggestions?

Think I figured it out with regular automation using named triggers!

1 Like

Named triggers is exactly what I would do here! I’m glad you got it figured out, though.

Massive thanks - this is exactly what i was after. Saved me having to create my own automation lol

Presence check is nesessery