This is a great blueprint, thankyou. I have a few improvements mainly allow multiple ambient light sensors.
I think I have found a bug or oversight, if I have night glow enabled and dont have all of the “night light entities” selected in the “night glow” entities then the night light entities never end up turning off.
I have a hallway with a few bathrooms that I have 4 of the Third Reality night lights that have a motion, illumination and color bulb. I have 2 of them in them in a hallway and another 2 in bathrooms connected to the hallway. Ideally Id like the lights in the hallway to enable night glow and then have the 2 lights in the bathroom only act as a night light and turn off after no motion. As it is now the lights in the bathroom dont seem to get the off signal.
I have tested it here and it is working… please look at Night Lights - Time Delay as this is the time it will take to transition back to night glow once your motion sensor is clear.
I am working on this blueprint now so if you 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.
Merry Christmas to all and all the best for the New Year!
Your lighting experience, your way – take control and customize it to perfection!
Bugs Fixed
Fixed a bug in the bypass function where, when the bypass was turned ON, changes in site conditions from normal lights to night lights or glow lights were not evaluated correctly when the bypass was turned OFF. This bug has now been resolved.
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
Trying to see if this would work for me. My biggest problem is my cat that keeps me from just using mmWave.
Is it a correct use of the bypass to use the PIR for triggering and mmWave for Keep current state bypass?
I want to trigger with PIR but keep on if mmWave is detecting something.
Ideally I’d like to trigger with PIR, keep on if mmWave is detecting but no longer than 30 minutes (unless PIR is high again).
I would try and look at the problem (The Cat). So there are a few ways.
You could use the Device Tracker so the automation will only run then you are home. If you are away the cat wont / can’t trigger the automation.
Maybe manually turning ON the light but then have the PIR or the mmWave keep the light ON and turn it OFF for you. Take a look at this blueprint Manual light control with auto OFF
Have a look at the Aqara FP2. I don’t have one but I understand that they may ignore cats and only look for humans. You will have to research this.
Hello all! I’m not sure i’m using it right or if its possible.I have until now just had 2 scenes to control my garden lights. 1 turn off at 8am and 11pm, 1 turn on 5.30am and 6pm. But i bought a sensor and would use this blueprint to turn on the lights in the periods where its not controlled by the timebased scenes. Problem is that then the sensor is triggered within the scenes turn on periods, its turn off the lights after the time set in the blueprint. Is that what the bypass function could be used for or?
I am trying to implement the night light function in my automation. Turning the night light on at the selected time works just fine. But it doesnt turn back to the normal light at the end night light time. I guess i have an error in my logic. It fires at 15:05 but nothing happens at still stays at the night light.
Let’s imagine that the lights are on (with a scene for example). Can you explain how to keep the lights on after the delay if the automation has triggered?
I suppose that I need to use a by-pass but I don’t know how.
Sorry, but I need someone that understands this blueprint to give me a hand.
I have a light and an IKEA motion sensor. Until now I have bind the motion sensor in Zigbee2MQTT to turn the light on/off when activated.
Now I want to use my outdoor illuminance sensor to adjust the brightness of this light. I want the light to be less bright when if gets darker outside. I also want to light not to be turned on at all when it is very bright outside.
I want the motion sensor to turn on the light as usual and be on for two minutes.
I started by unbinding the sensor from the light in Z2M, so it no longer controls the light, but allowing for this blueprint/automation to control the light.
I used the configuration wizard and this YAML is the result. However nothing happens. What have I done wrong?
Hi! I have the problem described in the FAQ that the lights ignore the timer and turn off immediately after the motion sensor stops detecting motion if I use the ambient light condition. I added a toggle helper as described but it does nothing.
My setup: I have 2 motion detectors controlling several lights. The occupancy sensors from both detectors are grouped and the ambient light sensors are also grouped. The occupancy is used as trigger and the grouped ambient sensor as the ambient light condition (all are entities). The lights are also grouped (entity). I only use the normal light switching with the ambient condition, nothing else (no night lights, dynamic lighting or whatever). Why is the timer (“time delay”) ignored when the ambient light condition is used? How can I debug it?
What we need to do is group everything but in order to group them it must be in the same domain (binary sensor). I am assuming you using a schedule helper to turn on your scenes… I wish I had more information on what you doing as I could just be going down the wrong path… but I will try my best.
First we need to create a template binary sensor for your schedule times. I think this is what your after.
ON at 5:30am OFF at 8am, ON at 6pm OFF at 11pm. This is how I will set it up but you can change the times if you like.
To create a Template binary sensor, follow these steps:
Navigate to Settings > Device & Services > Helpers tab at the top.
Click the Create helper button.
Select Template and then choose Template a binary sensor.
Next, provide a Name and Device class of your choice. If applicable, you can link this template to an existing device so it appears under that device’s details.
In the State template field, add the code below, and adjust the times that suits you.
{% set now = now() %}
{% set morning_start = now.replace(hour=5, minute=30) %}
{% set morning_end = now.replace(hour=8, minute=0) %}
{% set evening_start = now.replace(hour=18, minute=0) %}
{% set evening_end = now.replace(hour=23, minute=0) %}
{{ (morning_start <= now <= morning_end) or (evening_start <= now <= evening_end) }}
Now you will have a binary sensor (schedule) you can group with your motion sensor. Group them together and use the group as the trigger only. In the blueprint under triggers there is a link that will show you how to group them. You then can also still use the sun or ambient conditions so it makes sure it is dark when the automation can run.
TIP: Scenes can sometimes be tricky to work with, depending on what you’re controlling. When possible, it’s generally better to use entities directly, as this ensures the blueprint functions at its best. That said, scenes are ideal for setting specific colors and brightness levels across different lights. If your scene consistently uses the same brightness or colors, I’d recommend using entities with light control options instead. This approach can also help reduce the chances of light flicker.
Do you mean? “Can you explain how to keep the lights on after the delay if the automation has not triggered?”
If so then yes you can use the bypass. I have a FAQ on the bypass that may help you. Have a read of it and if you got any questions just ask. Click Here
You did everything right but I found one thing that I will need time to think about before or if I fix it as it could impact something else.
Your min brightness is 5% and then dead zone is 7%. Because your brightness is lower than your dead zone it is not turning the light ON. I am doing this so it keeps HA working faster (I know it is only a little but every bit helps). So for now you have 2 options. Increase your min brightness to +8% or reduce your dead zone to 4%. You may find from 5% to 8% there is no real difference anyway or your can adjust both like min brightness to 7% and dead zone to 6%.
Let me know what you think and if it worked for you.
You can look at the traces and see what triggered it to turn OFF.
Just checking everything as you didn’t provide your YAML.
In the trigger you have one and only entry and that is the group of your 2 occupancy sensors.
Because your are using the ambient as soon as it goes above your High Lux Value the lights will go OFF instantly and that is what I think is happening for you but I could be wrong.
How did you group the ambient sensors and are they effected by the lights? You do have an option to tick called YES - My Ambient Light Sensor is affected by the Lights but then your High Lux Value will not be in use. Check this out and make sure your settings are correct here and monitor your lux values.
If you like 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.
Hi! Is there an example how to use this blueprint with a button like a Sonoff SNZB-01 - for example to turn the light off manually after turned on by the sensor?
I played with the Overrides but always end up with a nonworking setting
My working steps:
Using a zigbee motion sensor to trigger
no sun, timer, nightlight whatever to keep it simple in the beginning
using a simple light to be automated
→ This works so far as supposed.
Now the non-working steps:
Sonoff SNZB-01 Buttons (no switch!) implemented with the blueprint Sonoff SNZB-01
as the override needs a state → i added a helper input_boolean that is toggled by that sonoff Button
added that input_boolean helper to the override
That works like I can use the button to toggle the light on and off.
BUT: as soon as the sensor is triggered - then the states of the helper is not the same as the light itself → so it seems this breaks the condition to let the automatisation work.
Where is my error in thinking?
Do i have to do some logic with the Scenes & Scripts - Toggle Helper?
You would like to turn the light ON when motion is detected but turn it OFF manually. What happens when you turn it OFF, can you be out of the way of the motion sensor?
If you look at this blueprint and use Trigger Entity State - ON only it will only turn your light ON.
i really love your blueprint and use it for every light strip, some rooms and even for the Awtrix3 Matrix.
Since the New config Layout it got even better.
I sometimes (really not often) have the following problem:
If the light time (e. g. 1 Minute) is over and someone triggers a Motionsensor right in the moment where the light goes off it doesn’t turn on until the person triggers the Motion sensor again. But the Motion sensor wont be triggered again until there was no movement for 10 seconds (cooldown time).
Is there a way to fix this? Maybe it’s related to my setup.
Home Assistant VM <—> MQTT LXC <—> Z2M LXC
There is a delay of maybe some milliseconds.
I think the problem could be the following sequence:
Motion sensor gets’s triggered. Light turns on
Motionsensor is not triggered anymore. 1 Minute Timer starts
At 59, 9 seconds (example) someone triggers the motionsensor again. And sends a call to the automation to reset the timer.
The automation turns off the light because the reset call comes too late.
The automation does not check anymore if the light is really on
Maybe a forced “turn on call” would be better instead of just resetting the timer? I’m really no developer and this are just some thoughts about it.
As i already said, it doesn’t happen really often, but it mostly happens to my wife and this is really bad for the Woman Acceptance Factor of our smart home.
Thanks for the elaborate reply! You were exactly right - one of the lamps was shining into one of the motion detector’s ambient light sensor resulting in a high lux value after the light turned on, which causes it to turn off right away. I have 2 motion detectors and I grouped their ambient light sensors to return the mean value - which is an issue if one of them gets blinded by a lamp. Now I changed the group to report the minimum value instead of the mean and everything is fine now because only one of the motion detectors is affected by stray light.
The mitigation in the script (“YES - My Ambient Light Sensor is affected by the Lights”) prevents the lamps from turning off immediately, but there’s potentially a second issue with stray light: When the lamps turn off normally after the timer expires, the (currently high) lux value may not get updated for up to a minute or so due to the slow zigbee polling rate, causing the automation not to trigger during this time. I don’t know whether your script accounts for that - I only tested it with a simple test automation and then I fixed my lux sensor value so I don’t have the problem in the first place.
I guess the lesson is to be careful with stray light …