I have the same set-up. I want to only turn on two lights when i enter the room. But if i happen to turn on more lights while sitting in the room i want to turn off all lights in the room when I leave.
I managed to do this with two scripts.
I have the same set-up. I want to only turn on two lights when i enter the room. But if i happen to turn on more lights while sitting in the room i want to turn off all lights in the room when I leave.
I managed to do this with two scripts.
Could you share your scripts pls?
Great work as always. Just wondering if is possible to implement making some of the settings collapsable? For example, Iâm not using Dynamic lighting in the blueprint, so I can simple collapse all settings related to it, and expand if needed, it should be collapsed by default.
The blueprint is quite powerful and has vast amount of configurations on a single page. which can become overwhelming for some. Hope you understand, thanks.
Yep a script⌠example below. A guide on this process can be found Here.
If-Then-Else script into âLights - Switches - Scenes - Scriptsâ No toggle helper in âScenes & Scripts - Toggle Helperâ
If
Then
Else
Then create a scene with all light OFF and enter into âScenes - Scripts To Turn OFFâ
Blacky
How can I add an offset for Sunset so lights come on 1 hour before sunset, and 1 hour after Sunrise? I tried tweaking the Sun Elevation either way, but it doesnât do anything for me for some reason.
Firstly welcome to the community
Please see the FAQ in this.
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 Click Here
Blacky
Hi @Blacky first of all your blueprint looks amazing! Thanks you for sharing that with the community. As I am playing around with it, I came to the following issue:
My light gets turned on whenever there is motion and the illuminance is below the lux level I have set. One minute after the last detection of motion it turns off again as it should. However, turning on the light changes the illuminance measured by the sensor, which means the lights do not turn on again when I re-enter the room, because the illuminance is now too high for the automation to trigger. I tried to figure out if I could solve this by using the ambient sensor options your blueprint provides. Unfortunately, I was not successful despite reading the FAQ.
What I guess is missing is a cutoff value for the illuminance in the room, so the automation only runs when the illuminance is below that cutoff value, as well as an illuminance value that is not provided by the motion sensor itself, because then the illuminance would be affected by the light when the light is on. The illuminance value should instead be provided by a number helper which is basically a copy of what the motion sensorâs illuminance would be BUT only changes lux when the light is off (got the idea from here). This way you only get ârealâ values for the illuminance in the room without any interference when the light is turned on.
I hope I explained this in a way one can understand and am looking forward to your answer.
Is your LUX sensor slow to react?
see âAmbient Light - Low Lux Valueâ
Select âYES - My Ambient Light Sensor is affected by the Lightsâ
If you like then to can create a template helper, then use that for your LUX sensor but when the light is OFF you will need to check LUX at quick intervals as you may close your blinds and the room gets dark. You could get a LUX sensor that reads fast and your problem is solved. See we need data to make things work if you would like it to respond quickly. If you had a LUX sensor that updates fast then everything works. The data is only stored for 10 days so you dont build a big data file thanks to the work from the HA Team.
I think all you need to do is tick the âYES - My Ambient Light Sensor is affected by the Lightsâ.
Blacky
Hi @Blacky you were of course absolutely right. My bad I got some settings wrong. Thanks for the explanation and your blueprint. This is absolutely amazing!
One final questions: Is there an option to completely block the automation from running at night? As far as I have seen, the night option only makes it possible to have different settings for the lights whenever the night condition is met, but it always means the lights will be ON in some way.
In my old automation, I used a helper that is activated whenever I say Good Night to Siri, resulting in the light automation being blocked. When I say Good Morning, the helper changed its state and the light automation would be active again.
Thanks!
This is what the By-pass options can be used for.
I use my âSleep Modeâ helper toggle to turn the lights off and stop the automation until the next morning.
Hope that helps!
Oh great, I did not realize this. I guess I have to read and try out more before asking questions Thanks for your help!
Hey, thanks for this work, itâs really awesome especially for new users!
Is it possible to have by-pass inverse option or somehow do a workaround about this?
Iâll explain: i have voice assistant where i want to expose âAuto Kitchen ON/OFFâ for example. So if itâs ON - script is working via motion detection, if i ask voice assistant âdisable auto on kitchenâ - it should work as âby-pass keep current stateâ.
Iâve tried to mess around with enable/disable automation at all via automation.turn but this one keep stalling or work not as i intended. Very new in this
Ah great, didnât realise it was a HA limitation, upvoted.
Firstly welcome to the community and thanks for your kind words.
That is not a good way. If we use the bypass when we turn it ON we can make it do 3 different things and when we turn it OFF it checks the site conditions and tries to preform the correct action. Disabling and enabling and automation will do nothing other than turn it OFF / ON and wont work well.
If you would like the bypass to work in reverse then see templating in the FAQ. See REF - TS-7 and also read REF - TS-9 as this shows you an easy way to make a template.
Blacky
Also have a look at this blueprint as it just out an may be what you are looking for.
Blacky
@Blacky This is a really awesome blueprint, thanks for sharing!
Iâm having one issue and Iâm not sure if Iâm doing something wrong, or if there is a bug.
My use case is that I want my downstairs lights to be automated at night. I set the start time to be after 8PM and before 6AM. I also used the bypass to keep the lights âas-isâ if the TV is on (using a remote entity). The issue Iâm having is, every time I turn the TV off, regardless of the time of day, all the lights turn off as well.
I was expecting Bypass Switch - Keep The Lights Current State
to keep the lights on instead of turning off after there is no longer motion (this works), but also keep the lights unchanged as soon as I turn the TV off as well. Is this possible?
Here is how I currently have the automation configured.
alias: "Sensor Light - motion automation "
description: ""
use_blueprint:
path: Blackshome/sensor-light.yaml
input:
motion_trigger:
- binary_sensor.downstairs_motion
light_switch:
entity_id:
- light.left_strip
- light.right_strip
- light.right_lamp
- light.left_lamp
- light.foyer_lamp
- light.piano_lamp
- light.dining_room
dynamic_lighting_heartbeat: 2.25
include_time: time_enabled
after_time: "20:00:00"
before_time: "06:00:00"
include_bypass:
- bypass_enabled_stop
motion_bypass_lights_stop:
- remote.harmonyhub
i know, thatâs what i mean with not working as intended
Thank you! Iâve looked into creating helper before for something like inverted sensor, doesnât know about template. Would read your FAQ about this and look into docs also
No problem, glad you like it.
Lets go through some things that may help you to better understand. Thanks for provide your YAML as it helps me to see what is happening.
Bypass - When we turn ON the by pass depending on what option you choose it will do the action. In your case 3 - Enable the Bypass - Keep the lights current state
. When we turn OFF any bypass it checks your settings and the site condition and preform the correct action
When you turn your bypass on it will 3 - Enable the Bypass - Keep the lights current state
. So if the lights are ON they will stay ON, if the light are OFF they will stay OFF.
When you turn the bypass OFF and it is not between 8pm to 6am and motion can be ON or OFF the lights will turn OFF. If it is between 8pm to 6am and motion is OFF the lights will turn OFF. If it is between 8pm to 6pm and motion is ON depending on light state the lights will stay ON or turn ON. This is what you are asking the automation to do.
I think this is your issue - When we turn the bypass OFF and it is between 8pm to 6am and the motion sensor is OFF we have an bypass option because when you turn the bypass OFF your light will turn OFF instantly and we dont want to be left the the dark. To fix this there is a setting Bypass - Time Delay. Currently you have it set to â0â so your light will turn OFF instantly. If you set this to the same setting as your Time Delay (I think is set on â5â) you will have 5 minuets to trigger the motion sensor before your lights will turn OFF. You can adjust this setting to anything you like. I think this is what your are finding, your Bypass - Time Delay is set to â0â.
Check this out and let us know if this fixes your issue, remembering what you are asking the automation to do when you turn it OFF. A lot of time and code has gone into making this happen like this and I hope once you understand it will make sense.
Blacky
Okay if your not 100% sure I will help you a bit more.
First you create a toggle helper called âAuto Kitchenâ as per you example. So when you say Auto Kitchen ON it will turn OFF your template sensor we are about to create below and enable the automation
To create a toggle helper
Go to Settings / Devices & Services / Helpers Tab at the top / Create Helper / Toggle then enter the name âAuto Kitchenâ or anything you like with a icon if you like and click create.
Once done you create a template sensor for the bypass to work inverted to your toggle helper âAuto Kitchenâ.
To create a template sensor inverted
Go to Settings / Devices & Services / Helpers Tab at the top / Create Helper / Template / Binary Sensor / Enter in the name you would like to call it and set the device class to lock (You can chose anything you like here) and in âState Templateâ paste the code below replacing the âinput_boolean.auto_kitchenâ with your entity ID of your toggle helper you just created. Once done click create.
{{ is_state('input_boolean.auto_kitchen', 'off') }}
Now enter this template sensor into the bypass. I think your are looking to use 2 - Enable the Bypass - Turn lights OFF but it is totally up to you on what happens here.
Now when you use the voice and say turn ON âAuto Kitchenâ it will turn OFF your template sensor making the automation active. When you say turn OFF âAuto Kitchenâ it will turn ON your template sensor disabling the automation
TIP: You could just create a toggle helper called âKitchen Bypassâ and use this as your voice command and all you have to do is enter this toggle helper into the bypass without creating the template sensor. But it is up to you and what you would like to do with your voice commands. Example - you would say âTurn ON kitchen bypassâ and it will stop the automation. Then say âTurn OFF kitchen bypassâ and it will enable your automation
Hope this helps you and let us know how you go.
Blacky