Ok Iām not sure what Iām doing wrong but Iām having trouble with the time option. I enable the time option and everything works during the day but if I enable the time option for nightlight also, night lights wonāt work. The original time I set for the regular time option is over riding. Example, bedroom is set to turn on between 8 am and 9 pm. I enable nightlight time option to start between 9pm and 10pm. But between 9pm and 10pm, nothing works. If I turn off the regular time option, I will get nightlights from 9pm to 10pm. But after 10pm I get normal lights again. I donāt want that. I want everything to stop working after 10pm.
The main time is global so it is for when the automation can run. Set this time from 8am to 10pm to the include night light time. For the night lights your 9pm to 10pm is good.
With this your automation will run between 8am to 10pm and night lights will be from 9pm to 10pm.
This FAQ will give you more information if you need it, click here.
Blacky ![]()
Ahhhhh that makes sense!! Thank you!
Iām trying to set this up and use my weather station illuminance to control the dynamic lighting section, but the min\max values possible seem off compared to what Iām reading on that sensor. I get illuminance sensors >80,000 lux, and wanted to set the lux value to turn on the lights at about 15,000, but it only goes up to 900 lux it seems. Is it meant to only use an indoor lux sensor? Please advise.
Welcome to the community.
Iāve applied a filter to the sliders to keep it within the most commonly used range. This helps make the sliders less sensitive and easier to use when selecting a specific value. When the range is too wide, the sliders can become overly sensitive, making it difficult to choose an exact setting.
The good news is, if the sliders doesnāt suit your needs, you can simply type in your desired value and click save. If the value is outside the filtered range, a red line will appear, but thatās perfectly okay, the blueprint will still work as expected.
Enjoy
Blacky ![]()
Your lighting experience, your way ā take control and customize it to perfection! ![]()
![]()
New Feature: State Control Option
Weāve added a State Control option to give you even more flexibility in how your automations run. You can now add a global condition based on a specific entityās state (e.g., toggle helper, switch, etc.), so the automation only runs when that entity is in the ON or OFF state you choose.
It builds on the existing Bypass feature, opening the door to more advanced automations.
Note: This option adds to the global conditions, so when you use multiple enabled conditions, all of them must be true for the automation to run.
One Use Case Example:
Say your wall switch is set as Bypass Option 1. Turning it ON locks the lights ON; turning it OFF returns them to automatic mode, perfect for a home office. But if the room becomes a guest bedroom, the motion sensor might still turn the lights on at night, which isnāt ideal and the wall switch just doesnāt work like a normal switch.
Solution:
Create a Guest Mode toggle helper, set it as your State Control, and choose OFF as the activation state. When your guests visit, turn ON Guest Mode to disable the automation while keeping the bypass options active. Guests can still use the wall switch to control lights manually via the bypass but the motion sensor wonāt trigger the lights ON, giving them a ādumbā light feel while your smart setup runs quietly in the background.
This feature was inspired by your feedback with many different use cases, thank you for sharing your ideas and helping shape these updates. I hope you like it and stay tuned, because thereās still more to come!
If you like this blueprint? Consider hitting the
button in the top post ![]()
If you like my blueprints, and would like to show your support or just say thank you? Click Here ![]()
Enjoy
Blacky ![]()
Thanks Blacky. It just keeps getting better and better. I donāt know why anyone writes their own lighting automations with your amazing suite of blueprints.
Hello everyone.
I had some of the automations that I made with this template started to fail recently.
I canāt be sure if it is a problem with my ZigBee2Mqtt installation (I upgraded to 2.X very recently) or if some update to home assistant made it behave differently, or if is just that some sensors are running low on battery.
However, this one that Iām going to post here shows traces that the motion sensor activated the script, but no light ever turns on. Not the night one nor the normal one.
Here is the config:
alias: "Entrada Vestidor motion "
description: ""
use_blueprint:
path: Blackshome/sensor-light.yaml
input:
motion_trigger:
- binary_sensor.motion_1_occupancy
light_switch:
entity_id: light.entrada_3
include_sun: sun_enabled
include_time: time_enabled
after_time: "18:00:00"
before_time: "23:00:00"
time_delay: 1
include_ambient: ambient_disabled
ambient_light_options: ambient_light_option_enabled
ambient_light_sensor: sensor.motion_10_illuminance_lux
ambient_light_value: 10
include_night_lights: night_lights_enabled
night_lights_conditions:
- time_enabled
night_lights_after_time: "22:30:00"
night_lights_before_time: "08:00:00"
night_lights:
entity_id: light.tasmota
night_time_delay: 1.5
You have a few things I can see.
Global conditions:
You are using Time and Sun Elevation
-
Your sun elevation is okay. Do you want this?
-
Your Global Time is wrong. You have it set from 6pm to 11pm. Thats fine when you are just using this one time but you are also using Night Lights time as the NL condition and that time is set from 10:30pm to 8am. Your main time has to include this so from 6pm to 11pm should be from 6pm to 8am. Do you want to use the main time condition?
See you have Sun Elevation and Time enabled. If you just want them to work when it is dark then maybe just use Sun Elevation
-
In Night Light Control I recommend using If lights are ON, adjust the lights when crossing over. This way when night lights are ON your lights will change.
I have updated your YAML for you. Copy and paste it in, then test it.
alias: "Entrada Vestidor motion "
description: ""
use_blueprint:
path: Blackshome/sensor-light.yaml
input:
motion_trigger:
- binary_sensor.motion_1_occupancy
light_switch:
entity_id: light.entrada_3
include_sun: sun_enabled
include_time: time_disabled
after_time: "18:00:00"
before_time: "08:00:00"
time_delay: 1
include_ambient: ambient_disabled
ambient_light_options: ambient_light_option_enabled
ambient_light_sensor: sensor.motion_10_illuminance_lux
ambient_light_value: 10
include_night_lights: night_lights_enabled
night_lights_conditions:
- time_enabled
night_lights_after_time: "22:30:00"
night_lights_before_time: "08:00:00"
night_lights:
entity_id: light.tasmota
night_time_delay: 1.5
include_night_light_control:
- if_lights_are_on_adjust_when_crossing_over
Blacky ![]()
Thank you very much. I will give it a try.
I was previously only using a light sensor, but my sensor stop working so I tried sun elevation, I think, and then I decided to try time etc. Canāt remember the order.
I thought the time and night light settings were completely independent, like the night lights donāt consider the global time setting.
EDIT:
Ok, reviewing your changes I noticed the motion sensor that was providing the illuminance settings and that stopped working was still being used. That was probably the root cause
Yeah, with so many options we can leave behind old ways.
TIP for anyone reading this:
If you stop using an option, make sure to also remove the entity that was linked to it. This keeps your automations tidy and prevents issues later if those entities get removed. It also stops the automation from being triggered unnecessarily in the background, helping Home Assistant stay clean and fast.
Example: In this case, Ambient was being used but then disabled, while the entity was still assigned in the input. Each time that entity met the conditions, it would still trigger the automation in the background, only to be stopped because it wasnāt enabled. By removing the entity from Ambient Light Sensor, the automation canāt be triggered in the background at all, since it no longer has an entity assigned.
Correct, but hereās how it works:
The global condition controls when the automation can run.
-
Example (time-based):
If the global time condition is 6:00 PM to 11:00 PM, then the automation will only run between those times.
If Night Lights is set for 10:30 PM to 8:00 AM, then Night Lights will only work between 10:30 PM and 11:00 PM (because 11:00 PM is the global cutoff). -
Example (sun-based):
With your settings of -1.5° and -4°:- The automation can only run when the sun is below -1.5° while falling and above -4° while rising.
- If Night Lights are set for 10:30 PM to 8:00 AM, they will only run within that window as long as it also fits inside the sun condition.
Note: Unlike fixed times, sun elevation changes with the seasons and can vary depending on the date. This means the exact times when conditions are met will shift throughout the year.
Case 1:
- -1.5° = 6:13 PM
- -4° = 8:32 AM
- Normal lights run 6:13 PM - 10:30 PM and 8:00 AM - 8:32 AM.
- Night Lights run 10:30 PM - 8:00 AM.
Case 2:
- -1.5° = 9:01 PM
- -4° = 7:16 AM
- Normal lights run 9:01 PM - 10:30 PM.
- Night Lights run 10:30 PM - 7:16 AM.
This is why you donāt need to enable the Time global condition when using the Night Lights Time Option. When multiple global conditions are used, all of them must be true for the automation to run. For example, if you enable both Sun Elevation and Time, then both conditions must be satisfied.
Example:
Letās say you want the automation to run when the sun is below -1.5° (falling) but to stop at 8:00 AM.
- Set Sun Elevation to -1.5° & 20°
- Set Time to 1:00 PM - 8:00 AM
Hereās what happens:
- After 1:00 PM, the sun will not yet be below -1.5°, so the automation waits.
- Once the sun drops below -1.5°, the automation can run.
- It will continue to run until 8:00 AM, because by then the sun (while still rising is below 20°) is blocked by the time condition.
This can vary slightly depending on your time zone and how sun elevation behaves locally, but in most cases this setup works as intended.
I hope this is useful for you, as well as for anyone else reading this thread.
Blacky ![]()
Thank you very much for such a detailed explanation. It was very good to have such a number of examples. Thank you very much.
I think I need to simplify drastically my conditions and number of options.
For this light, I only need it to work after or very close to sunset. At a certain time in the night, activate the night lights, and then just continue using night lights until the next sunrise. If I understood this correctly, all I need to do is set the sunset and sunrise options, and the night lights time start. Thatās all, right?
Thanks so much for this. The Aqara M2 Hub didnāt expose the lux in the P1 Motion Sensors to HomeKit. HA did, but the automations didnāt work reliably. Now it does, thanks to your blueprintā¦
Got to wait until bedtime to see it the night mode works. It took me a while to find the focus mode was in the companion app.
Also found your washing machine (Appliance Notifications and actions). Thatās running now. Got a notification when it started.
Once again, thank you for your blueprints.
Hey @Blacky Thanks for this!!! Amazing stuff!
Okay, because you would like to ācontinue using night lights until the next sunriseā we will also need to enable the sun in night lights and move the Night Lights - End Time past this point so the sun will stop it.
I have adjusted your YAML. Test it out and see how it goes. Check the sun elevation settings works for you and adjust if necessary. If you adjust the sun elevation make sure you do it in the global sun and night lights sun.
Copy and paste it in.
alias: "Entrada Vestidor motion "
description: ""
use_blueprint:
path: Blackshome/sensor-light.yaml
input:
motion_trigger:
- binary_sensor.motion_1_occupancy
light_switch:
entity_id: light.entrada_3
include_sun: sun_enabled
time_delay: 1
include_night_lights: night_lights_enabled
night_lights_conditions:
- time_enabled
- sun_enabled
night_lights_after_time: "22:30:00"
night_lights_before_time: "10:00:00"
night_lights:
entity_id: light.tasmota
night_time_delay: 1.5
sun_elevation: 1
night_lights_sun_elevation: 1
include_night_light_control:
- if_lights_are_on_adjust_when_crossing_over
night_lights_sun_elevation_rising: -1
sun_elevation_rising: -1
Blacky ![]()
Welcome to the community.
Thanks for your feedback⦠it really nice to get these ones!
Blacky ![]()
@Blacky thanks for the state option update, works perfect ![]()
Hi folks!
Not sure if this is right place for ask but anyway:
I have a problem with bypass. For some reason bypass switch does not turn lights on or off no matter how I try to configure it. Here is the bypass setting:
So I have Hue switch and I can see that pressing button is seen by HA:
And ambient setting of the BP:
What am I missing? Do I need to create automation for the button or should it work when I add it to the BP?
TIA!


