đź’ˇ Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights

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

GitHub Link Click Here

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

Like this blueprint? Consider hitting the :heart: button below :+1:

Version: 4.7 :fire:

The most common automation used for a sensor light :partying_face:

Need help? :eyes: See our FAQ: Click Here

:newspaper: The Automation Process:

  • In this example we will use a motion sensor as the trigger, but you can use one or multiple Binary Sensors and or a schedule as the trigger/s.
  • Triggers on a motion sensor and turns the lights ON.
  • When no motion is detected, a time delay is activated and turns the lights OFF Automatically.
  • The lights will stay ON if the motion sensor detects motion before the time delay turns the lights OFF. It will then reset the time delay after last motion is detected.
  • You have the option to select scenes. This allows you to turn ON a scene when motion is detected and turn OFF a scene when the time delay has ended.
  • You have the option to use the “Light Control”. This allows you to set a brightness level, colour temperature in kelvin and a transition time for your lights.
  • You have the option to use the “Trigger Sensor By-pass”. This allows you to add a switch to manually By-pass the trigger sensor so you can use the lights as normal by turning them ON and OFF manually.
  • You have the option to use the “Sun Elevation”. This is used for adding a condition to only work when it is dark by setting the suns position to the horizon.
  • You have the option to set an Ambient Light Sensor and set the LUX value. This is used for adding a condition to only work when it is dark or below the Ambient Light LUX Value.
  • You have the option to set a start time, an end time and select weekdays. This will only allow the automation to run between the time periods.
  • You have the option to use the “Device Tracker”. This can be useful if you have pets triggering the trigger sensor turning your lights ON and OFF when no one is home.
  • You have the option to use “Night Lights”. It can be used for having lower softer lights come ON when going to the bathroom at night or having different lights come ON with an entity state, time or sun elevation.
  • Safe guard built in for HA restart.

:rocket: CHANGELOG

  • Version: 4.7 - 6 Sep-23 - Now multiple By-passes with multiple actions. Update deprecated code. Fixed bug in HA restart.
  • Version: 4.6 - 20 Aug-23 - Fixed bugs in HA restart, Fixed a bug in transition & fixed error log.
  • Version: 4.5 - 20 Aug-23 - Now can add multiple By-passes.
  • Version: 4.4 - 6 Aug-23 - Fixed a bug in transition crossover lights.
  • Version: 4.3 - 6 Aug-23 - Added condition “Entity State” for night light. Fixed a bug in transition.
  • Version: 4.2 - 9 July-23 - Fixed a bug in HA restart.
  • Version: 4.1 - 8 July-23 - Added sun elevation to night lights. Fixed bugs.
  • Version: 4.0 - 2 July-23 - Fixed 2 bugs in HA restart.
  • Version: 3.9 - 2 July-23 - Added a By-pass auto OFF option.
  • Version: 3.8 - 21 June-23 - Added people to device tracker.
  • Version: 3.7 - 16 June-23 - Added a new option to the by-pass - Turn Lights ON.
  • Version: 3.6 - 8 June-23 - Added the ability to use a schedule helper. Sun, ambient & time will now turn the lights OFF + Bug fixes.
  • Version: 3.5 - 5 May-23 - Manual control of lights once they are ON.
  • Version: 3.4 - 4 May-23 - Colour Temperature has been added to Light Control.
  • Version: 3.3 - 21 April-23 - Fixed bug in night light transition time.
  • Version: 3.2 - 20 April-23 - Remove selection of areas & devices. Fixed bugs.
  • Version: 3.1 - 15 April-23 - Transitions will now work with scenes. Fixed a bug.
  • Version: 3.0 - 11 April-23 - Trigger can now be an ON/OFF pulse in milliseconds. Fixed bugs.
  • Version: 2.9 - 10 April-23 - Added Transition, Safe Guard & more. Fixed bugs.
  • Version: 2.8 - 19 Feb-23 - Fixed bug in the by-pass. Added By-pass Time Delay.
  • Version: 2.7 - 18 Feb-23 - When the by-pass is turned OFF, trigger is re-evaluated.
  • Version: 2.6 - 5 Feb-23 - Added a new option to the by-pass.
  • Version: 2.5 - 25 Jan-23 - Cleaned up by-pass selection.
  • Version: 2.4 - 16 Jan-23 - Added weekday selection.
  • Version: 2.3 - 15 Jan-23 - Removed wording description for clearing 2 entities selections.
  • Version: 2.2 - 6 Jan-23 - Fixed bug in night lights flickering on trigger.
  • Version: 2.1 - 5 Jan-23 - Added brightness control, Zone - Device Tracker & Night Lights options.
  • Version: 2.0 - 15 Dec-22 - Upgrade option for the LUX sensor.
  • Version: 1.9 - 29 Nov-22 - Bug fix when using multiple entities in “Trigger Sensor - Binary Sensors”
  • Version: 1.8 - 20 Nov-22 - More user friendly selection for enabling and disabling options and Bug Fix
  • Version: 1.7 - 15 Nov-22 - You can add any Binary Sensors you like as the trigger.
  • Version: 1.6 - 14 Nov-22 - You can add scenes.
  • Version: 1.5 - 9 Nov-22 - You can add a start time and an end time (Optional).
  • Version: 1.4 - 5 Nov-22 - You can add as many motion sensors as you like.
  • Version: 1.3 - 3 Nov-22 - Ambient Light Sensor and set the LUX value (Optional).
  • Version: 1.2 - 2 Nov-22 - Motion Sensor By-pass (Optional).
  • Version: 1.1 - 28 Oct-22 - Initial release


:infinity: Sensor Light Add On - Media & Movie Lights - House Alarm Lights - Smoke Alarm Lights & Exhaust Fans + More
:shower: Bathroom Humidity Exhaust Fan
:calendar: Calendar Notifications & Actions
:round_pushpin: State Notifications & Actions
:toilet: Toilet Exhaust Fan with time delay
:hourglass_flowing_sand: Entity - Run ON Timer
:gear: Turn Light, Switch or Scene On & Off with Trigger Conditions
:thermometer: Temperature Control Exhaust Fan
:snowflake: Temperature Control Exhaust Fan - Inverted
:nazar_amulet: Push Button Relay - Contactor
:stopwatch: Timer Relay - Run ON Timer
:on: Smart Relay - Contactor

Like this blueprint? Consider hitting the :heart: button below :+1:


New update 1.2

We added a Motion Sensor By-pass option. This allows you to add a switch entity so you can disable the motion sensor and operate the lights as normal. This can be a physical switch on the wall or just one in HA. Must be ON and OFF and can’t be a light you are switching with the motion sensor.

Use case
You can use this option for the following and more.

  • Sometimes you need to disable the motion sensor to keep the lights on when you are having friends over.
  • Sometimes it is a windy night and your lights keep going ON and OFF and you need to disable them.
  • Sometimes your just working out side and you need them to stay ON.


Blacky :grinning:

1 Like

You know what would be amazing? Somehow adding schedules and scenes to this, and this would be an absolute monster of a Blueprint.

Used it so far and enjoying it a lot. Good job man.


Hi @MARTWIN thanks for the kind words. I have on my list to add schedules to control the time but I am patiently waiting on HA to add a weekday selector that makes it easy for the users to use. I have asked for it so let see but be assured it is on the list. I will also put your idea for scenes on the list :+1:

New update 1.3

You have the option to set a Ambient Light Sensor and set the LUX value. This is used for adding a condition to only work when it is dark or below the Ambient Light LUX Value.


Blacky :grinning:

1 Like


Below are the FAQ question. A good starting point is to read “The Settings & Best Practice Guidelines” Click Here. A lot of the links form our FAQ are there and can help you easily find what you are looking for.

Q: My Trigger Is Not Triggering The Automation?

A: Please follow these steps Click Here.

Q: How do you update the blueprint and not delete / recreate existing automations?

A: Please follow these steps Click Here.

Q: How do I create a template sensor so I can use it in the blueprint? or, How can I make the automation work better?

A: For template sensor examples Click Here

Q: Can you provide more information on “Night Lights - Entity State”?

A: Please Click Here

Q: How do the time options work including night lights time?

A: Please see our explanation of the time settings Click Here.

Q: How to use the “Trigger Sensor By-pass” without having a physical switch?

A: If you don’t have a physical switch you can create one in Home Assistant that will allow you to use the by-pass. If you would like to create a by-pass switch then follow the steps below.

How to create a By-pass switch

  • First go to Settings / Devices & Services / click on the “Helpers” tab / click “+ CREATE HELPER” and select “Toggle”.

  • In the name area, enter a name that best suits you. For this example we will put “Sensor Light By-pass”. Then click save.

  • Go back into the automation and in the “Trigger Sensor By-pass Options (Optional)” select an option you would like to use and then in “Trigger Sensor By-pass - Switch” search for the name you created, in our case “Sensor Light By-pass”. Then click save.

    Note: You can also set the “Trigger Sensor By-pass - Time Delay” to your liking.

How to add by-pass switch to a dashboard

  • In a “Dashboard” click “Edit dashboard” then click “+ ADD CARD” click on “Button” or “Entities” and in the entity field again search for the name (entity) you created in our case “Sensor Light By-pass”. Then click save.
  • Then click “DONE”.

You now have a “Sensor Light By-pass” switch to disable the trigger sensor of your sensor light automation.

Q: Why did you choose sun elevation as the sun option and not sunrise and sunset, I don’t really understand the degrees and elevation, I assume zero is the sun just on the horizon with a + being day time and a - night time.

A: Please read our explanation and how to set it up, it’s easy :slightly_smiling_face: Click Here

Q: Can I add a schedule helper or times of day sensor helper

A: Yes, for more information + Pro Tips Click Here

Q: When I add a scene to “Lights - Switches - Scenes” or in “Night Lights” it doesn’t turn OFF?

A: If you have selected a scene to be turned ON and you would like it to be turned OFF after the time delay, you must create another identical scene with everything OFF and enter it into the “Scenes To Turn OFF”. See below examples.

Q: I have more than one trigger sensor / binary sensor and my light will come ON then it will turn OFF and stay OFF? - or - The automation is not working correctly with 2 or more trigger sensor / binary sensor and is driving you crazy?

A: Please follow these steps Click Here

Q: I have set the “Ambient Light Sensor - Site Conditions” to “YES” and the lights keep turning OFF and or staying ON. I have only selected scenes, or an area or a device in the “Lights - Switches - Scenes” or in “Night Lights”. Am I doing something wrong?

A: Please follow these steps Click Here

Q: I would like to use 2 or more ambient light sensors in the automation. Is this possible?

A: YES, please follow these steps Click Here

Q: I would like to set a different value but the slider is not letting me?

A: Just simply type the number value you would like in the field and click save. A red line will appear under the number you have entered but once you click save, exit the automation and go back into it the red line will not be there.

UPDATES OF BLUEPRINT - When something was needed to be done when updating are below.

Q: How do you update the blueprint from version 4.5 - 4.6 to version 4.7 and above?

A: Please follow these steps Click Here

Q: How do you update the blueprint from version 3.8 - 4.4 to version 4.5?

A: Please follow these steps Click Here

Q: How do you update the blueprint from version 3.2 - 3.7 to version 3.8?

A: Please follow these steps Click Here

Q: How do you update the blueprint from version 2.9 - 3.1 to version 3.2 ?

A: Please follow these steps Click Here

Q: How do you update the blueprint from version 1.8 - 2.8 to version 2.9 ?

A: Please follow these steps Click Here

Q: How do you update the blueprint from version 1.4 - 1.7 to version 1.8 ?

A: Please follow these steps Click Here

Q: How do you update the blueprint from version 1.1 - 1.3 to version 1.4 ?

A: Please follow these steps Click Here

1 Like

Highly appreciate your attention and you time. You rock!
I’m following this thread all the time to see what’s new :smiley:

Hey loving this blueprint! Great work

Solved this… with below.
I’m having one issue with the bypass as I do have a switch but I have it toggle a smart light on and off. So the switch doesn’t have a on or off state. Only the light does.

How can I use this option?

I have made a helper switch which works but then requires me to use the app to change it on or off. Which I’d like to use the switch as intended.

Added toggle of the helper Boolean with the switch. So it turns light and Boolean on. And then both off when clicked again. Fixing my original issue.

I would now light to some how add light brightness as this is my garden light. Security light. So when motion triggered I want it as 100% but if I turn the light on dim and then off. Next time motion just resumes that state.
I’m guessing this would be an easy add for me but also a great option for this blueprint.
Brightness or scene

Thanks for your help. And I’m looking forward to the progress with this

Thanks for your feedback. Yep a scene will do this. I have this on the list to add. :+1:

1 Like

FAQ - How do you update the blueprint from version 1.1 - 1.3 to version 1.4 and above?

New update 1.4

You have the option to add multiple motion sensors. :+1:

Use case
You could have two or more motion sensors that turn the lights on.

  • Your driveway and your front door are apart from one another. So you have two motion sensors, one that picks up your car and the other your front door. Someone visits, light come on and when you get home from work in your car lights come on.
  • Two doors into a factory (or a large room). Two motion sensors at each door.

I think this will be useful to fix this now moving forward, but this update will hide your selection of your motion sensor from any existing sensor light automations you have. If you are starting from new then your all good and this will not affect you. But if you are upgrading from Versions 1.1, 1.2 & 1.3 you can fix it easily. You have 2 options.

  • Delete your existing sensor light automation (not the blueprint), update the blueprint and then add your automation back again. Should be easy enough.
  • Update the blueprint, go into your “sensor light automation” and edit the YAML code. I will walk you through the steps, its not hard but you must follow the steps or it will disappear from your automations. So if your not sure or confident maybe do the first option.

1 - This is how your sensor light automation normally looks like. Versions 1.1, 1.2 & 1.3 only. See below.

2 - This is what it looks like after you update from versions 1.1, 1.2 & 1.3 to 1.4. No selection available.

3 - Click on the 3 dots and select “Edit in YAML”

4 - This is how your “motion_trigger” will look like. We need to edit this line only.

5 - This is how you will need to edit the YAML. Make sure you put the “-” with a space then the name of your sensor. Code example also below. Then Click Save.
code below

      - binary_sensor.your_sensor_here

6 - Click on the 3 dots and “Edit in visual editor”

7 - You should now see your motion sensor with a option to add another one. If you don’t see it go back to step 3 and check your code is correct. If you do then your done.


Blacky :grinning:

Back to FAQ: Click Here

1 Like

Hello Blacky and Community,

First of all thank you for your grait job!

I would like to ask one question which seems to be at first sight an offtopic, but actually is related to this one :slight_smile: May be my ideas could be also implemented here in the future. Or even I can help (but this is not the near future :slight_smile: )

I am new to home assistant and currently evaluating which product to take for my home. So far I do really like HA, but still curious if there is no showstopper. One automation I want to implement is a light control based on motion, light intensity and/or sun position and door contact. The algorithm should be like this:

If I open the door, lights immediately goes on even before motion sensor trigger an event. In this case, light has relative short timeout and if no motion detected in that period of time, the light goes off. This is useful if one just opened the door to check something and left it not fully closed.

Next every motion event will re-schedule long delay or mid-long one. This depends on if the door stays opened or closed. If opened we can run mid-long, but if closed long.

Finally, if door closes (also case open/ close), then light period re-scheduled to the short one again. Means if a person left the room we will turn off the light fast, but if a motion trigger event after the door is closed, then we again re-schedule long period.

Plus some nice to have feature (for bath for example) - flash slightly light with color temperature, color, or intensity every N minutes, so you have time sense.

Now, my question - is it possible to implement this in HA without real hacks? I already saw some “hardcore” with lambdas and plain script, but would like to know if it is possible to make it pretty simple and standard.

With best regards,

Hi @minko

Look no further with HA you really can do anything you like.

You have got a lot of options with door open, door closed.

Most people just put a motion sensor in the room. They trigger really fast and if the door opens in then it will pick up the doors motion. You then get rid of all your other door open / door closed options. Then just set a time delay long enough to keep the lights on when you are in the room. You can use the by-pass option and then have another automation for your bath. Probably a scene would work here.

You can use the sun elevation if you don’t have a LUX sensor. If you have a LUX sensor put it in a place outside where a light will not affect it then you can use that for all your automations.

That should look after most of it.

So this blueprint will work perfectly!! :+1: :grinning: :facepunch:

Option for your bath. What look nice is to have some strip LED addressable lighting under your vanity and in a niche if possible. Then use WLED to control them. I have a few of these they work. You will have so many options for your bath. He has heaps of information on his site and a YouTube channel. WLED will be auto discovered into HA and is fully integrated.

1 Like

New update 1.5

You have the option to set a start time and an end time. This will only allow it to run between the time periods.


Blacky :grinning:


Thank you for the clarification! In meantime I have already got some insides of HA Power :slight_smile: Will continue to learn in a free time.

Trying to use this with 2 motion sensors in the same room, one a Philips hue the other a Aqara FP01 they don’t seem to want to play nicely together. It would seem the Aqara although showing in the automation isn’t actually registering. Any idea’s

Using the Philips as motion and illuminance and the Aqara as motion, the light comes on when I go into the room which the philips motion pick up but the Aqara isnt keeping the light on even though it still detects me in the room. What I was hoping would happen was they would both detect motion and when the Philips showed no movement with me sitting down the Aqara would keep the light on as it still senses me in the room. Hope that makes sense.

Hi @Fontie, thanks for your question and it does make sense.

I have just tested the blueprint with 2 motion sensors simulating what you are doing and it works perfectly here. So the Blueprint should work as your intent use case.

Lets try and work this out :grinning:. Could you check your Aqara sensor for us as we know your Philips is working fine by doing the following.

Remove your Philips motion sensor from the blueprint and just use your Aqara motion sensor, It should turn the light on and say on if motion keeps being detected.

If it works then see if the light says on with your time delay setting. If it keeps turning OFF then increasing the time delay slowly until the light stays ON. Once you have that working add back your Philips motion sensor.

If it doesn’t work there could be something going on with your Aqara sensor. Check in “Developer Tools” / States and select your Aqara motion sensor. See what state it is reporting. You will need to trigger it and refresh it to see the state change. It should be a ON / OFF state. Then check your Philips motion sensor, again it should be a ON/OFF state.

Let us know how you go :grinning: :+1:

This was resolved through PM. Solution Click Here

Great blueprint,bthanks!
As it seems you are actively developing it further, here are some feature requests:

  • option to dim the lights for an interval before Turing them off
  • option to select a different light based on a night entitz
  • accept others sensors than luminance ones for lux (might need to explain this more: aqara motion sensors report lux very infrequently. They mostly sync when they detect motion. This makes measurements wrong, as it registers high lux levels while the lights are still on. If I go out of the room, the lights will turn off. But as the motion sensor didn’t update the lux measurement is still high. If I come back after a short time the lights won’t turn on. I made a template sensor only updating if the lights are currently out. It reflects the real luminance way better than the original one. But the blueprint doesn’t accept this sensor.

Just let me know, what you think!

@capstan1 thanks for your kind words :blush: Glad your liking the blueprint. It is nice to hear feature requests so thank you.

  • Option to dim the lights… I will look into this… if I was to do this it would have the option for turning OFF and turning ON… user can choose. Not promising but has me thinking as I can see a use case for this.

  • Option to select different light base on a night entitz… not fully understanding this. :pensive:

  • Accept other sensors than luminance. Assuming you are using the LUX option and motion. It looks like as you describe that the blueprint is working as it was intended. If the LUX is higher than the set point then it will not run. It seams that the Aqara sensor is not being used as the developers intent.

I would recommend when using a LUX sensor that you have a separate LUX sensor outside that only reads the natural light and is not effected by any artificial light source. You then can use it for any automation, like this blueprint. Maybe don’t use LUX option and use the Sun Elevation option.

The Aqara sensor you have that has motion and LUX will not function correctly with this blueprint if the light that turns ON can influence the LUX sensor. Sensors that have motion and LUX in one do have a use case though. Example: If motion is detected the light comes on and the light brightness is automaticity adjusted depending on the LUX readings. So natural light and artificial light are combined to deliver a required LUX value. This is good for office spaces where artificial light is required to add to natural light to meet a required LUX setting thus being comfortable for workers and also saves on electricity cost. Having it report the LUX values slowly is good as it keeps the lights stable and is not adjusting the brightness up and down fast causing a nuance.

Thanks for your feedback :+1:

Option to select different light base on a night entitz… not fully understanding this. :pensive:

Sorry, wasn’t clear enough. I have a helper “it’s night/we are sleeping” which controls various things. For example it controls Adaptive Lightning night mode and mutes my phone. I’d like to use this helper to determine which light to turn on. At day control normal ceiling light, at night control ambiant light. It’s an edge use case so I really understand if you don’t want to implement it.

Accept other sensors than luminance. Assuming you are using the LUX option and motion. It looks like as you describe that the blueprint is working as it was intended.

I’d just need the option to use a template sensor as alternative to a real lux sensor. I can circumvent my issue with this template sensor perfectly. Sadly, some of my rooms have quite small windows, so an outdoor sensor won’t reflect the situation inside.

Thanks for your answer! Got another question: how does your blueprint handle no motion with various sensors? Only turn off if both detected no motion? Or as soon as one of the does?

Let me ponder on this…

Maybe I develop a different blueprint that will work.

It work of last motion detected then it start the time delay. So if any detector detects motion it will reset. Once all detectors have no motion then the time delay starts.

1 Like