💡 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

Your lighting experience, your way – take control and customize it to perfection! :bulb::sparkles:

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

Version: 7.2 :fire:

:warning:You must be on Home Assistant Version 2024.6 or later.

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

:newspaper: The Automation:

  • Trigger:
    • You can choose any binary sensors or schedules to trigger the automation. Really anything with an ON / OFF state can be used.
    • A trigger sensor, such as a Motion Sensor, will activate lights, switches, scenes, or scripts when the automation is triggered.
    • A time delay begins the turning OFF process after all triggers are clear. See grouping sensors for more information.
    • If triggers are activated again before the time delay ends, the automation resets for continuous lighting.
  • Scene and Script Integration:
    • Scenes or scripts offer additional customization for your spaces.
  • Light Control Options:
    • Utilize “Light Control” to adjust brightness, colour temperature, colour and transition times.
  • Dynamic Lighting Options:
    • Opt for ‘Dynamic Lighting’ to continuously adjust brightness based on lux values or adapt colour temperature and brightness according to the sun’s changing elevation.
  • Manual Override:
    • Use “Bypass Options” for manual bypassing of trigger sensors, providing manual control and additional customization.
  • Sun Elevation Options:
    • Implement “Sun Elevation” to restrict automation to darker conditions aligned with the sun’s position.
  • Ambient Light Sensing Options:
    • Set up an Ambient Light Sensor for activation in low-light conditions, customizable with specified LUX values.
  • Time-Based Options:
    • Specify precise start and end times along with weekday selections to define when the automation should run.
  • Device Tracker Options:
    • Utilize “Device Tracker” to activate automation when home or within specified zones, preventing unnecessary activations. This feature is particularly useful to prevent unnecessary lighting activations when pets trigger sensors while no one is home.
  • Night Lights Mode:
    • Enable “Night Lights” for softer illumination during night time activities, automatically enabled based on conditions.
  • HA Restart Safeguards:
    • Benefit from built-in safeguards for Home Assistant restarts.
  • Blueprint Add-On Integration:
    • Sensor Light Add-On - Enhances media control automation. Click Here to learn more.
    • Bathroom Humidity Exhaust Fan - Keeps the lights ON when showering. Click Here to learn more.

:rocket: CHANGELOG

  • Version: 7.2 - 21 Nov-24 - Update to Home Assistant YAML standards and coding practices.
  • Version: 7.1 - 4 Aug-24 - Added new option for dynamic lighting. Fixed a bug with bypass & scene script helpers.
  • Version: 7.0 - 22 July-24 - Added RGB colour selection, fixed bug in dynamic lighting when crossing over.
  • Version: 6.9 - 26 June-24 - Added collapsible sections, update deprecated code in light and some code clean up.
  • Version: 6.8 - 3 June-24 - New input and fixed bugs in dynamic lighting.
  • Version: 6.7 - 26 May-24 - Update to description to show labels are excluded.
  • Version: 6.6 - 21 May-24 - Major update to dynamic lighting.
  • Version: 6.5 - 16 April-24 - Added new option selection to dynamic lighting.
  • Version: 6.4 - 12 April-24 - Fixed bug in crossing over from normal lights to night lights and vice versa when using scenes.
  • Version: 6.3 - 25 Feb-24 - Fixed bug in dynamic lighting condition.
Changelog of all releases click here
  • Version: 6.2 - 8 Feb-24 - Fixed bugs when using scenes & scripts for sun, ambient & time. Cleaned up conditions.
  • Version: 6.1 - 7 Feb-24 - Fixed bugs errors logs when evaluating some condition.
  • Version: 6.0 - 6 Feb-24 - Fixed bugs in bypass when using scenes or scripts.
  • Version: 5.9 - 3 Feb-24 - Added 3 new inputs for scenes and scripts. New descriptions to inputs.
  • Version: 5.8 - 22 Jan-24 - Safe Guard HA restart has been rebuilt. Bug fixes to by-pass.
  • Version: 5.7 - 20 Jan-24 - Dynamic Lighting, added step value and a dead zone. Added ability to run a scripts at the end. Bug fixes to by-pass and HA restart.
  • Version: 5.6 - 18 Jan-24 - Fixed bugs in by-pass when two were ON and one turn OFF.
  • Version: 5.5 - 16 Jan-24 - Fixed bugs in disabled by-pass when entities are entered in.
  • Version: 5.4 - 7 Jan-24 - Updated numbering system to Dynamic Lighting.
  • Version: 5.3 - 7 Jan-24 - Added 4 new features to Dynamic Lighting.
  • Version: 5.2 - 14 Dec-23 - Added to allow the use of scripts.
  • Version: 5.1 - 2 Dec-23 - Added a night light control option. Fixed bugs for end condition to sun, lux and time.
  • Version: 5.0 - 1 Nov-23 - Added sun rising and falling elevation settings. Cleaned up some code for end condition to sun, lux and time.
  • Version: 4.9 - 21 Oct-23 - Added Dynamic Lighting Option. Added high and low lux settings to Ambient Options.
  • Version: 4.8 - 7 Oct-23 - Fixed bugs in By-pass.
  • 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

:shield: MY OTHER BLUEPRINTS

:high_brightness: Smart Light - Entity - Sun Elevation - Ambient & Time Triggers
:infinity: Sensor Light Add On - Media & Movie Lights - House Alarm Lights - Smoke Alarm Lights & Exhaust Fans + More
:shower: Bathroom Humidity Exhaust Fan
:low_battery: Low Battery Notifications & Actions
:vibration_mode: Appliance Notifications & Actions - Washing Machine - Clothes Dryer - Dish Washer - ETC
:loudspeaker: Notifications & Announcements
:calendar: Calendar Notifications & Actions
:round_pushpin: State Notifications & Actions
:robot: Android Notification Channel Manager
:toilet: Toilet Exhaust Fan with time delay
:hourglass_flowing_sand: Entity - Run ON Timer
:stopwatch: Trigger - Run ON Timer
:magic_wand: Manual light control with auto OFF
:door: Closet, Pantry, and Cupboard Lighting
:timer_clock: Timer
:thermometer: Temperature Control Fan
:snowflake: Temperature Control Exhaust Fan - Inverted
:eight_spoked_asterisk: Toggle Switch - Turn ON & OFF Entities
:nazar_amulet: Press Button - Turn ON & OFF Entities
:on: Switch - Turn ON & OFF Entities

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

344 Likes

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.

Enjoy

Blacky :grinning:

2 Likes

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.

2 Likes

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:

1 Like

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.

Enjoy

Blacky :grinning:

1 Like

FAQ

:warning: A good starting point is to read The Settings & Best Practice Guidelines. It is presented in an easy-to-follow format and includes many FAQ links for each area of the blueprint, making it easier to find the information you need.

PROBLEM SOLVING

1. My trigger isn’t activating the automation.

2. My light turns on but then turns off and stays off, or the automation isn’t working correctly with multiple trigger sensors or binary sensors.

3. The slider won’t let me set a different value.

  • Simply type the desired number in the field and click save. A red line may appear under the number, but it will disappear after you save, exit, and re-enter the automation.

4. The lights keep turning off, or the automation isn’t working as expected after setting Ambient Light Sensor - Site Conditions to YES. I’ve only entered in a scenes or script under Lights - Switches - Scenes - Script or Night Lights. What am I doing wrong?

5. Scenes or scripts aren’t turning off

  • If you’ve set a scene or script to turn on and want it to turn off after a delay, create another scene with everything off and add it to the Scenes - Scripts To Turn OFF section. See the examples below:

6. What are the primary differences between the Sensor Light and Smart Light Blueprints?

SETTINGS HELP

1. Trigger Groups - How they work and why we use them.

2. Dynamic Lighting

3. Sun Elevation Condition

4. Ambient Light Condition

5. Time Condition Including Night Lights Time - More information?

6. Bypass

7. Night Lights - Entity State condition?

TIPS AND TRICKS

1. Toggle Helper

  • Learn how to create a toggle helper here.

2. Scenes & Scripts - Night Light Glow

  • Get more information on setting up scenes, scripts, and a Night Light Glow here.

3. Template Sensor

  • Enhance your automations with template sensors. Find a detailed how-to with examples here.

4. Special Event Lighting

  • Discover how to set up lighting for special events like Halloween, Christmas, New Year, and more here.

5. Schedule Helper & Times of the Day Helper

  • Learn how to set up these helpers, plus some pro tips here.

6. Using Multiple Ambient Light Sensors in Automation’s

  • Yes, it’s possible! Follow the steps here.

5. Setting Up a Schedule Helper with Sun Condition

  • Learn how to combine a schedule helper with a sun condition, plus a pro tip here.

UPDATES OF BLUEPRINT

1. How do you update the blueprint without deleting or recreating existing automations?

The update process depends on your Home Assistant version and installation method. Follow the steps below, and be sure to review the section on Things to Do When Updating. Occasionally, changes are made to improve the blueprint, so it’s essential to check the release notes for detailed instructions on what is required.

Things that need to be done when updating?

  • From version 4.7 - 6.9 to version 7.0 and above: Click here
  • From version 4.5 - 4.6 to version 4.7: Click here
  • From version 3.8 - 4.4 to version 4.5: Click here
  • From version 3.2 - 3.7 to version 3.8: Click here
  • From version 2.9 - 3.1 to version 3.2: Click here
  • From version 1.8 - 2.8 to version 2.9: Click here
  • From version 1.4 - 1.7 to version 1.8: Click here
  • From version 1.1 - 1.3 to version 1.4: Click here
3 Likes

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.

Solved.
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.
4

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.
5
code below

    motion_trigger:
      - 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.

Enjoy

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,
Mike

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.

Enjoy

Blacky :grinning:

2 Likes

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

Hi,
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