🚪 Closet, Pantry, and Cupboard Lighting

Hi Blacky:

Thank you so much for making the updates. I’m traveling right now but will try it out once I get back to my casa. Looking through the blueprint I can see why it took so long and how my probablity of modifying it myself was zero.

1 Like

Hi @Blacky ,

First, thank you so much for your amazing blueprints! I’ve been using several of your creations, including the Closet, Pantry, and Cupboard Lighting, and they’re fantastic.

I have an issue: at the end of the automation, the lights always turn off, even if they were initially on before it started.
For example, this happens at night when all lights are on and I open the closet. The assigned lights change the brightness (as part of the automation). After the automation ends, the light turns off, even though they were on before. After that, the brightness that was set before remains. Am I missing something to keep them on if they were originally on?

Am I missing something to keep them on if they were originally on?

Thanks again for all your hard work!
Thomas

@drawtrip

Typically, when you open a closet, pantry, or cupboard, you’d want the light inside to turn ON. If you’ve set a time delay, the light will turn OFF after that period, even if it was ON before… that’s how the automation works. Without the time delay, the light will simply stay ON until manually turned OFF or you close the door.

When using a time delay and linking a motion sensor, the light will stay ON as long as motion is detected. If you leave the door open and exit the room, the light will turn OFF once the motion sensor becomes inactive. If you re-enter and motion is detected while the door is still open, the light will turn ON again. However, if you close the door, the light will remain OFF.

Hope this make scene.

Blacky :smiley:

Hi @Blacky !

I have used some of your previous blueprints and have loved how well they work in every day life. This particular one seemed an elegant solution to a simple conditional automation I had made in the past.

Logger: homeassistant.components.automation.office_closet_light_sensing
Source: components/automation/init.py:688
integration: Automation (documentation, issues)
First occurred: 20:54:05 (23 occurrences)
Last logged: 21:05:18

Error rendering variables: UndefinedError: ā€˜dict object’ has no attribute ā€˜entity_id’

I have a simple setup of just a contact sensor on the door to a closet, with one ceiling fixture of a smart bulb. For whatever reason the automation was not triggering even though the contact sensor events were operating properly.

I’m not sure what this error means that I found in my logs.

Any help would be appreciated!

@softpillowcase

Welcome to the community.

Have a look at your light and it must only be an entity not a device. This is a link to my sensor light blueprint FAQ but it is all the same. Click Here

If that doesn’t work then could you please provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can help. To do this go into your automation, top right 3 dots, Edit in YAML, copy all the code, come back to the forum and in your reply at the top tool bar click on ā€œ</>ā€ and paste code in there.

Blacky :smiley:

@Blacky

Thanks for your response!

alias: Office Closet Light Sensing
description: ""
use_blueprint:
  path: Blackshome/closet-pantry-cupboard-lighting.yaml
  input:
    trigger_entity:
      - binary_sensor.office_closet_door_sensor_contact
    light_switch:
      entity_id: light.office_closet_light

What I don’t really understand is that when I check the logs for the door open sensor, it provides the correct states of closed / open, so I that it would be appropriate to trigger the automation, but when I look at the automations section in HA it states the automation has never been triggered. And I believe my entity for the light bulb is correct; I can independently turn the light on and off through HA so I believe it is functioning correctly.

@softpillowcase

Thanks for your YAML. My bad I had a bug when you didn’t select a light entity in night lights. All fixed now, just update and you should be good.

Blacky :smiley:

New Update - Version 1.3

'Open Sesame’:magic_wand: Lighting Magic! :bulb::door:

Bugs Fixes :bug:

  • Fixed bug that would not trigger the automation if you didn’t enter a light entity in for night lights.

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:

Enjoy

Blacky :grinning:

1 Like

I love how as soon as I re-imported the blueprint it all just worked.

Thanks again for your quick response, fix, and overall making these great automations!

1 Like

Blacky, thanks for making this Blueprint. I have an Aoetec door sensor and Sengled bulb. I’m trying to configure the sensor to trigger the light for 2 min when the door opens between 5pm-6:30am. The light comes on but when the door closes the light goes off. I’d like it to stay on for the full 2 minutes. Is that possible?

@User456

Welcome to the community.

This blueprint will turn OFF the light when the door closes and it doesn’t have a time condition to run only between 5pm and 6:30am.

You could look at my :bulb: Sensor Light blueprint as that has a time condition and it will keep the light ON for X amount of time when the door closes. The only thing is if you leave the door open the light will remain ON. To resolve this you may consider using a motion sensor rather than a door sensor, that way the light will turn OFF. If you would like to keep your door sensor and there is a possibility the door is left open hence the light staying ON then you may consider creating a template sensor that when the door opens it turns ON but then has a auto OFF just encase you leave the door open.

Blacky :smiley:

Hi @Blacky

Small feature suggestion here.
Would it be possible to have a delay OFF feature for lights when the sensor turns to ā€œclosedā€ state? Like, the lights will only turn off if the sensor’s state is set to ā€œclosedā€ for a specified amount of time.

I would like to use this blueprint for the lights of my attic coupled with a reed sensor on the trap door.

I just want to make sure the lights could stay on for a short while if the trap door closes by mistake while someone is up there.

Thanks!

@psyko_chewbacca

Why not use my :bulb: Sensor Light blueprint. Use your reed sensor on the trap door as the trigger (if you cant select it copy paste the entity ID into the input), add your lights and set the delay to your liking.

Blacky :smiley:

Thanks, will do!

1 Like

Works awesome but I am having trouble or misunderstanding the transition. I would like the light to come one at a lower brightness and then transition to the maximum.
Is that not what the transition option is supposed to do? Do I need to also tick the brightness and set to my lower brightness level???

@tcflint

When a light is turned ON in Home Assistant, it will transition from 0% (OFF) to your set brightness (e.g., 100%). The transition option controls how long this change takes.

Yes, you need to select both brightness and transition. Set your desired brightness level and specify:

  • ON transition time – how long it takes to reach the set brightness.
  • OFF transition time – how long it takes to fade back to OFF.

Typically, the ON transition is faster than the OFF transition for a more natural lighting effect. However, some lights handle transitions differently, as they may have their own built-in transition effects.

Blacky :grinning:

1 Like

Great thanks for the detailed explanation

Hey man, I love these blueprints. This one and Sensor Light pretty much run my whole house.

I’m having a new issue I’m hoping you can help me with.

My closet has a door sensor to activate the light, and a motion sensor inside to keep it on if I’m in there longer than the original timer, in accordance with the blueprint. When I close the door, the light turns off. This is ideal and exactly what I want to happen.

However, if I then open the door again, I’m assuming before the two minute timer lapses, the light stays off. The door sensor won’t trigger the light to come back on.

If I wait a couple minutes, it works again. If I disable the motion sensor entirely, I can open and close the door in quick succession and it turns the light on/off accordingly. But in combination with the motion sensor, the timer prevails over turning the light back on.

Any idea what I’m doing wrong?

@Will-com4

Welcome to the community.

I have tested it here and can’t fault it.

Could you share the YAML code for your automation settings? This will allow me to better understand your settings and help troubleshoot the issue.

To do this:

  1. Open your automation.
  2. Click the three dots (ā‹®) in the top right corner.
  3. Select Edit in YAML.
  4. Copy the entire YAML code.
  5. Return to the forum and, in your reply, click the </> button in the toolbar.
  6. Paste your YAML inside the code block.

This ensures the formatting stays correct and makes it easier to analyze.

Blacky :grinning:

Here you go.

alias: Charlie's Closet Auto Light
description: ""
use_blueprint:
  path: Blackshome/closet-pantry-cupboard-lighting.yaml
  input:
    trigger_entity:
      - binary_sensor.charlies_closet_door_opening
    timer:
      hours: 0
      minutes: 2
      seconds: 0
    include_motion_trigger: enable_motion_trigger
    light_switch:
      entity_id: switch.charlie_s_closet_switch
    include_timer: enable_timer
    motion_trigger: binary_sensor.charlie_s_closet