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?
Hey!
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.
alias: Sensor Light - Wohnzimmer
description: ""
use_blueprint:
path: Blackshome/sensor-light.yaml
input:
motion_trigger:
- binary_sensor.group_motion_sensor_wohnzimmer
light_switch:
entity_id: light.wohnzimmer_decken_lampe
include_light_control:
- use_transition
include_bypass: []
motion_bypass_lights_on: []
motion_bypass_lights_off: []
include_bypass_auto_off: []
include_ambient: ambient_enabled
ambient_light_sensor: sensor.wohnzimmer_presence_sensor_illuminance_lux
ambient_light_options: ambient_light_option_disabled
ambient_light_value: 150
include_device_tracker: zone_people_enabled
zone: zone.home
people:
- person.test
night_light_brightness: 10
night_light_colour_temperature: 2300
motion_bypass_lights_stop: []
include_dynamic_lighting: disable_dynamic_lighting
dynamic_lighting_min_brightness: 1
dynamic_lighting_sun_elevation_end_falling: -13.5
dynamic_lighting_sun_elevation_start_rising: -13.5
dynamic_lighting_sun_elevation_end_rising: 60
dynamic_lighting_sun_elevation_start_falling: 60
dynamic_lighting_lux_sensor: sensor.wohnzimmer_presence_sensor_illuminance_lux
ambient_light_high_value: 350
light_transition_on: 2
light_transition_off: 5
bypass_time_delay: 5
light_colour_temperature: 2400
include_light_colour_control: disable_colour_control
include_night_lights: night_lights_enabled
night_lights_conditions:
- time_enabled
night_lights_after_time: "14:50:00"
night_lights_before_time: "15:05:00"
include_night_light_control: []
night_boolean_scenes_scripts: input_boolean.toggle_helper_night_light_wohnzimmer
night_lights:
entity_id: scene.night_light_wohnzimmer
end_scenes:
- scene.night_light_wohnzimmer_off
Tried to figure it out myself but i cant seem to. Thanks! Happy Holidays!
edit: input_boolean.toggle_helper_night_light_wohnzimmer stays on after it fires at 15:05. I guess it should turn off? At 14:50 it turned on.
Hi @Blacky ,
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?
alias: The brightness of the lamp
description: ""
use_blueprint:
path: Blackshome/sensor-light.yaml
input:
motion_trigger:
- binary_sensor.mymotionsensor_occupancy
light_switch:
entity_id: light.thelamp
time_delay: 2
include_dynamic_lighting: enable_lux_controled_brightness_inv
dynamic_lighting_lux_sensor: sensor.outdoor_lightsensor
dynamic_lighting_max_lux: 100
dynamic_lighting_min_lux: 20
dynamic_lighting_min_brightness: 5
include_ambient: ambient_enabled
ambient_light_sensor: sensor.outdoor_lightsensor
ambient_light_value: 200
ambient_light_high_value: 200
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?
Hi Danny, welcome to the community.
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.
Hope this helps you, let us know how you go.
Blacky
Thanks for reaching out and providing your YAML. It helps me allot.
Just one setting was needed, see below. Please tick this option.
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.
Let us know how you go.
Blacky
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
Welcome to the community.
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.
Blacky
Welcome to the community.
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.
Blacky
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?
Welcome to the community.
This is an unusual request.
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.
Smart Light - Entity - Sun Elevation - Ambient & Time Triggers
Blacky
Hi,
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.
Thank you very much for your work.
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 ā¦
Thanks for your kind words.
Good analogy, your close.
I think what happens is when the automation turn your light OFF sometimes the light status takes some time to update in HA. In this time the automation triggers again but it thinks the light is still ON so it leaves it alone.
See how I have written the code is that if your light is ON and the automation getās triggered then it wont send a signal to turn the light ON again as it knows the light is already ON. There are a few reasons for this.
- This stops your network from receiving extra data that is not required. Better performance over your network with less congestion.
- You light doesnāt get call after call to do something, it just runs nicely not getting bombarded with calls. Could extend the life of your light.
- You can adjust the lights once they are ON if needed and they donāt change on you.
So you may find it is the speed in witch your light reacts (status change) when it is turned OFF in HA.
If this bothers you, try creating a scene and use the scene instead of your light entities. You will also need a toggle helper for Scenes & Scripts - Toggle Helper. Now the automation will look at the toggle helper for the light status. Because this is within HA hub, it is fast reacting and you just may find that this resolves you problem.
Remember you will need to create an OFF scene as well and enter it into the automation and I would only do it to the automation that you have a problem.
Try it and let me know if it works, this way I know my theory is correct and can help others.
Blacky
You could just try and use the LUX sensor that is not effected by the light as this is the one reporting the low value anyway. Then there is no need for the group.
You may have to adjust your min LUX value to the value the LUX sensor reading + some when the light is ON and it is dark (night time no natural light). This way it will always turn ON but if it ever goes higher than that value the light will stay OFF and it should be bright enough anyway. Then you wont need to use the (āYES - My Ambient Light Sensor is affected by the Lightsā) and just set a high LUX value. Now you wont have a problem with the slow zigbee polling rate.
Blacky
You could just try and use the LUX sensor that is not effected by the light as this is the one reporting the low value anyway. Then there is no need for the group.
Well, I grouped them for more reliability, but alasā¦ At least the ādarkā value (lamps off for a long time) is reliable and consistent, but in practice it wonāt make any difference to use the āminā value or just the unaffected sensor alone.
You may have to adjust your min LUX value to the value the LUX sensor reading + some when the light is ON and it is dark (night time no natural light).
Yeah, that should be fine for a small offset. In my case it would be a bit too extreme though because the stray light comes from a floor lamp thatās hitting the motion detector from below where it has the lux sensor, so it gets something like 140 lux at night when the lamp is on. Thatās the ambient brightness around 9-10am here (in Winter), so it would be kind of wasteful. In any case, my problem was solved by being mindful of the lux sensor readings, but itās good advice when stray light is unavoidable.
Hello Blacky,
i am using youre bleuprint with great joy, but i have question.
is it possible to use the device tracker to turn off the lights when nobody is home during the day, and that the nightlights work normally, even when nobody is at home.
at the moment the lights stay on or off when nobody is home, depending on current state. the state doesnāt change when nobody is home.
or am i doing something wrong in the configuration?
would be great to get it working like that.
thanks in advance
Hello, Blacky. Thanks for your blueprint!
Iām trying to use it to control the light in the bathroom, but Iāve a problem. I have two lamps, a double switch, each switch controls one lamp, and a presence sensor. The trigger for automation is the presence sensor, which turns on one of the lamps with the first switch. I wanted to set it up so that if the second switch is on, the first switch doesnāt turn on automatically. Using a bypass didnāt help in solving the problem, as soon as I turn off the second switch, the first one immediately triggers, and I have to turn it off manually. Unfortunately, the list of conditions does not allow me to enter my own additional condition, which simply does not allow the automation to work, such as time, sun height or illumination.
No, Device tracker is a global condition.
What is your trigger? as motion sensors normally clear when no one is home.
Blacky