💡 Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights

Thank you again for yet another awesome update, your blueprints are always inspirational! :tada:

1 Like

Loving this blueprint, before I get started with it I’m wondering how the timer works for turning off. if I trigger with a contact and Motion sensor. Will the timer wait for both the motion and contact to turn off/closed? Basically is there a wait for both to be true then the timer starts?

Hey @Blacky,

One note, lines 611 and 643, service name mispelled as switcht.turn_off.

1 Like

@samuelthng Oh, I thought I fixed that. Thanks for letting me know. I will do an update.

Edit: I will also push out the next release early.

1 Like

Hi @geox19, firstly welcome to the community.

Yes but some times you will need use a group helper. When using a contact sensor I would recommend you set up a group helper. It will then work for you. Here is a link to the FAQ on this Click Here

1 Like

New update 3.0

There was a bug in the by-pass of Version 2.9, thanks @samuelthng for letting us know.

:warning: Because this release is to fix this bug in version 2.9 that was release a day ago, if you are upgrading from version 2.8 and below please read the release notes of version 2.9 before upgrading as you will need to clean up a bit of code in the YAML. Click Here to see version 2.9 release notes.

I have also pushed out a new feature early :slightly_smiling_face:.

New Features :new:

  • Trigger can now be an ON/OFF pulse in milliseconds. This can be useful if you trigger is fast reacting.

Bugs Fixes :bug:

  • Fixed a bug that lights could stay ON when crossing over from normal lights to night lights and from night lights to normal lights in a time trigger. Known issue, light could flicker when this happens. We will try and fix this in the next release.

  • Fixed a bug in by-pass.


Blacky :grinning:

Thanks for your kind words. It is nice to hear you like them and just get a nice feedback :smiling_face_with_three_hearts:

Hi! First of all, thanks for the great blueprint!
Got one question, after updating to 2023.4 my automation stopped working correctly. My lights are switching on after motion detected, but switching off instantly. So it’s like a flash only, updating to 3.0 didn’t resolve the issue.
I’m using Hue spots with SkyConnect + ZHA.

alias: Lampen hal en trap aan bij beweging
description: ""
  path: Blackshome/sensor-light.yaml
      - binary_sensor.bewegingssensoren
        - 50c5bc6b0d4211eb8cc7ef4b9dc9b663
        - trap
    light_brightness: 50
    include_night_lights: night_lights_enabled
        - 50c5bc6b0d4211eb8cc7ef4b9dc9b663
        - trap
    night_time_delay: 2.5
    end_scenes: []
      - use_brightness
      - use_transition
      - use_brightness
      - use_transition
    night_light_brightness: 50
    night_lights_after_time: "23:00:00"
    night_lights_before_time: "06:30:00"
    time_delay: 5
    include_bypass: bypass_disabled
    light_transition_on: 1.5
    light_transition_off: 2
    night_light_transition_on: 1.5
    night_light_transition_off: 2

Any ideas? Thanks!

Hi Scott, thanks for your question, providing your YAML and welcome to the community.

We are on Home Assistant 2023.4.2. We have done a lot of testing with this update and it is all working perfectly here.

The blueprint must pass through the time delay before it will turn off your lights, so I would expect that something else could be the problem.

All your settings look ok. I have noticed you are using area’s so maybe your turning on something else that is turning off your lights. Maybe try and expand your area down to entities (from orange to green colour) you would like to control by clicking on the expand “<>” of your area (see below).

Another thing you could do is, trigger the automation and straight after this happens have a look at your traces. You can find it in the top right next to the 3 dots in your automation called “Traces”. Follow the orange line, it shouldn’t be at the end as you have a 5 min or 2.5 min delay.

Once you confirm your traces, and know the automation is not turning off the lights maybe check your other automations or have a look at your logbook.

1 Like

Just setup most of my lighting automations using this blueprint. What a time saver. I’m coming from Hubitat and having to learn some of the ways to do things in Home Assistant can really eat up the time. This blueprint let me point and click my way to success. Thank you Blacky
Where’s the donate link?

1 Like

Thanks for the welcome and your detailed answer. :smiley:

Apparently I put the hallway spots in a group and added it to the same area, so removing the group did the trick.

Thanks again and awesome timesaver for me. :+1:

1 Like

What a great blueprint. I use it for my setup as well. The only issue I have is the unwanted light turn off action when no motion is detected (for example on the toilet and your sitting still). Will there be a presence detection logic in the future that combines a door and motion sensor?

Hi @geox19

No problem at all glad you like it :+1: Nice to get this type of feedback :smiling_face_with_three_hearts:

I haven’t go one… Maybe I should set one up for people to say thanks… will let you know if I set one up.Thanks for your offer and your kind words. :+1:

1 Like

Hi @dkarijopawiro , firstly welcome to the community.


Could you explain how you think it should work? I will help me understand :thinking:.

Currently if you are using contact sensor (a door) and motion sensor I would recommend that you put them into a group for this to work correctly. It is in our FAQ, and here is the link on how to set one up. The only thing is if you close the door then the light will come on and I not sure if this is what your after.

If you have a fan in the toilet then maybe consider using my other blueprint called :toilet: Toilet Exhaust Fan with time delay


Loving this blueprint. But it is always turning on my lights, even if the sensor is higher then the set Ambient Light LUX Value. any idea?

Thanks so much for you blueprint! It saved me alot of time especially as a HA beginner. Not sure if this has been discussed already but im looking for a solution for our staircase. The goal is that for example if the sun goes down OR a specific lux value a light group should go on at 20%. With detected motion the lights should go to 100% and back again to 20% after few minutes without motion detected. As soon as the sun goes up or again specific lux value the lights should turn off.
Any hints?


First of all, I’m amazed just how much effort you have put into this @Blacky - not just providing the comprehensive Blueprint, but with all your helpful detailed responses to all the questions. A massive asset to this community! :+1:

I’ve been toying with the idea of using this Blueprint for a while now, as I only have one issue with my current automation that I put together a while back - and I think it’s the same issue/question as @dkarijopawiro mentioned a couple of posts above.

Currently I have a Hue bulb that is triggered by a Hue motion sensor, providing that the lux measurement from the motion sensor is below a certain threshold. Once there has been no movement detected by the motion sensor for 2 minutes, the light turns back off.
I also have a ‘manual override’ button on the wall in place of the original dumb light switch. This allows you to turn the light on or off as you see fit. If the light hasn’t come on by motion trigger, due to the lux value being too high for example, but you actually want the light to be on, you can click the wall button (Aqara smart button) and this turns the light on. The light will remain on until there has been no motion detected for 2 minutes, and then the original automation turns the light back off again.

Similarly, if the motion triggers the light on, but you don’t want it to be on for some reason, you can click the button and it will turn off - and it will stay off until there has been no motion detected for 2 minutes.

All works well, except if you are static for longer than 2 minutes, in which case if the light was motion triggered on originally, the light then turns off and leaves you in the dark - until you wave your hands around! Likewise if the light was motion triggered on, but you turned it off form the smart button, and again, are static for more than 2 minutes, then as soon as motion is detected, the light turns on.

To cure this, I am thinking of fitting a door sensor as a secondary condition. This would use the ‘Wasp in the box’ principal, so that if the door is opened, and then closed, the motion sensor only has to detect initial motion in order for the light to be turned on, AND STAY ON. If the door is closed and it has detected motion at least once, then you must still be in the room, and so there is no need for the regular 2 minute (in my case) cooldown to then turn the light off.

I did think about just using the ‘Occupancy Blueprint’ provided here:

Occupancy Blueprint

however I don’t know if my ‘Manual Override’ smart button would be a problem in that setup. If your Blueprint can incorporate this occupancy detection via an additional door sensor, that would be great - and I believe what @dkarijopawiro was asking also :slight_smile:

1 Like


Hi Nick,

:smiling_face_with_three_hearts: thanks

We have tested it here again and it working.

The Ambient Light LUX Value works below your setting. If your setting is 20 then when your actual sensor reading is 19 it will allow your light to be turn on when triggered. Without seeing your YAML settings the only think I could think of is maybe you haven’t selected “Enable the ambient options”. See below

Let us know how you go.


Hi André

Your welcome.

No haven’t had this one yet.

Currently you can’t do what your asking in just this one blueprint, but there is a work around.

This is how you would do it. In this blueprint (sensor Light) create a scene with 100% lights and put it into “Lights - Switches - Scenes”, then create another scene with 20% lights an put it in “Scenes To Turn OFF”. Now set your option, sun goes down OR a specific lux value.

Now you will need to get another one of my blueprints called :gear: Turn Light, Switch or Scene On & Off with Trigger Conditions. This will turn it on and off on a trigger condition when the sun goes down OR a specific lux value. Once you got the other blueprint enter your scene of 20% in “Lights - Switches - Entities - Scenes” then create another scene that turns everything off and enter it in “Scenes To Turn OFF”. Now set your option, sun goes down OR a specific lux value.

The 2 blueprints will work together and give you what your asking :tada:

Hope this helps

Edit: Let us know how you go.

Blacky :smiley:



Hi, Scott

Thanks for your kind words :smiling_face_with_three_hearts:

Thanks for the clear detailed example. Very interesting… you got me thinking now :thinking:. I like the idea :+1: . I will put this on the list. If I did this I would like it to be a 2 click item… maybe 3 and very easy to understand.

Thanks again!

Blacky :smiley: