šŸ’” Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights

@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 :wink:
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

@regnare

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 :crossed_fingers:

  • You have asked for the automation to only work between 8pm to 6am when motion is detected.

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 :smiley:

@Sk1vvy

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 :wink:

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 :wink:

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 :wink:

Hope this helps you and let us know how you go.

Blacky :smiley:

Update.
I think I found a bug.
If the trigger sensor becomes unavailable, the lights are controlled by the schedule and are turned on when the schedule is ā€˜offā€™
The schedule becomes the trigger for the automation, and the unavailable sensor is ignored.

Hi Blacky,

What an amazing blueprint. I am still exploring/testing it and so far so good. I am converting from Hubitat to HA, please bear with me.

My Zooz Zen72 dimmer has integrated buttons to act as momentary switches. When I ran the automation to turn on/off lights using motion sensor works perfectly, but I am looking for Bypass On to keep the lights on (considering some of the cons of the motion sensors). I have enabled single entity from the Zen switch which shows if button 1 (light switch off) or button 2 (light switch on) is pressed. I would like to use this instead of helper but I can only select the entity in the blueprint and not the actual value that the entity is reporting.

My ideal scenario will be when entity reports 2 ā†’ Bypass ON, same entity reports 1 automation resumes.

Is this possible in current version of blueprint?

@rananna

This seams strange, If you are using a schedule as the trigger it should never be unavailable. If you sensor becomes unavailable that seams to be a sensor issue.

Are you using a template sensor for this. If so you will need to set your unavailable actions. In my template examples, have a look at REF - TS-9 it shows you an example on setting the unavailable based on what the light state is.

Hope this helps you.

Blacky :smiley:

@achobaka

The bypass must have an ON / OFF state. You can use a button entity in the bypass as long as it has this state. If it does not have a state of ON / OFF then you need to make this happen by using template sensor or one of my other blueprints depending on what your button state is. You cant use the state of the light it must be independent / stand alone switch.

Example if your button does not have a state then create a toggle helper use this in the bypass and have your button toggle the helper when pressed.

Blacky :smiley:

Hi!
Iā€™m quite new to HA and this is the first Blueprint Iā€™m trying. Basically I think I understand how it works, I just have the problem, that my light (Philips HUE Lux) isnā€™t being turned off when my motion sensor (Aqara) goes back to occupancy:false.
If I understand correctly a script to turn off is needed only when Iā€™m using scenes or scripts, right? Iā€™m actually just using a light entity that turns on and should turn off again. But the turn off doesnā€™t work. Any suggestions for a noob? In Germany we use to say ā€œMaybe I donā€™t see the forest because of too many treesā€¦ā€.

Yep, correct. When using an entity just leave the Scenes & Scripts - Toggle Helper and Scenes - Scripts To Turn OFF blank.

If you are using an entity that is perfect and it work best this way. Please note that when your motion sensor stops detecting (clear) then your time delay starts. Once the time delay expires then your light turns OFF. This helps so your lights dont go ON and OFF with your motion sensorā€¦ it provides a buffer zone were you have time to trigger your motion sensor again before the lights turn OFF. You can adjust the time delay to your liking.

Let us know if that resolved it.

Blacky :smiley:

Iā€™ve been playing with this blueprint, but cannot get it to work properly. I like all the possible options! My situation: During the day the lux value of my Philips motion sensor is about 40 lux. During the day, my lights need to stay off but whatever setting I set, with every movement my lights turn on. I must be missing something. Can anyone shed some light :wink: on this?

@mountainbikert

Please make sure you have have enabled it.

If you have no luck there then 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 :smiley:

Hi Blacky

I like your Blueprint and it works fine so far. Thanks a lot for your work.

At the Moment i struggle with the Bypass options.

I have got a motion activated light (depending on the sun elevation). Now I added a Button to Turn the light on manually and I want it to turn of again when no motion is detected for some time.
I made a helper, but with a Little different name Like in your Description.

What settings do i have to activate for my usecase? Where do I define the halber in your blueprint, or is this not nessecary?

Please help
Maxx

@maxx1976

Hi Maxx, welcome to the community

No problem at all glad you like it.

Lets look at it and what is asking.

You would like the automation to only run between your sun settings. This is a global condition.

You would like to manually turn the light ON so you would use 1 - Enable the Bypass - Turn lights ON with your helper.

Now you would like it to turn OFF when motion is not detected for some time. This currently is not possible. You can have it so the bypass will turn OFF after X amount of time and you would use the Bypass Auto OFF Option. When you turn it OFF manually or using the auto OFF it will check your sun condition and then preform the correct actions turning OFF or staying ON. If you didnā€™t have the sun condition then you could create a template sensor to handle what you are asking and then use a script to control the light with a sun condition using a if-then-else action so you could make it work if you did it this way.

Blacky :smiley:

I want to use the dynamic lighting only when itā€™s really dark and late. So I set the values for sun elevation between -40 and -50Ā°. However itā€™s even using the darkest light setting at 7 PM (Sun elevation -13Ā°). What am I missing?

Thank you for your quick answer!

I think i donĖ‹t understand the function of the Bypass helper. Is it a trigger, or someting like a boolean condition?

Thanks Maxx

Okā€¦ now here is a new dumb person (yesā€¦ i can say that for myself :slight_smile: )

First of allā€¦ thank you Blacky for your BluePrints and hard work. I am using your BP Bathroom Humidity Exhaust Fan (v 1.3) for a long time now and Iā€™m really satisfied (and also my wife, which is the most important of having HA)

Now Iā€™m trying to remove some of my Node Red automations and came across this BP. But it is a lotā€¦ and because of ā€˜it is a lotā€™ Iā€™m loosing a bit of the overview.
Please help me on my wayā€¦

I have a sensor and start an action when Lux < 400 for 120 sec, but only between a time frame (14:00 and 23:00).
It will switch a boolean (from 0 to 1)
And it will turn on several lights (where each light will increase brightness to a max of x% and it will take x seconds to reach the state

Then during specific nights after 23:30 the lights must turn off (each with their own random delay [5 ā†” 20 min]) And the boolean needs to be turn from 1 to 0
During other nights sort of the same action (turn off lights) but on a later hour (but this is sort of a copy of the previous ā€˜turn offā€™

And Iā€™m looking for some kind of override in case of we have people over for a drink or something

Is this something which can be done using this BP?

Thank you for your support

This blueprint is incredible, thank you for the wonderful work and willingness to help the community!

Iā€™m currently accomplishing the following with 2 separate cobbled together automatons and was wondering if this blueprint can replace them in a more elegant and reliable way?

Current setup:

Garage Lights

Sensors: PIR & Door Contact Sensor

  1. Open hallway door to garage, contact sensor triggers garage lights on immediately.

  2. Donā€™t actually step into the garage, PIR sensor never detects presence (itā€™s too far away to detect the door without stepping into the garage), close hallway door to garage, garage lights turn off immediately.

  3. Actually step into the garage, PIR sensor detects presence and sets a 5 minute timeout if no further motion is detected turn off garage lights.

  4. Enter garage through large garage door ā€“ PIR detects motion turns on lights with 5 min timeout

Iā€™ve successfully configured the Blueprint to group my PIR & Contact sensors and they are working beautifully as expected but I seem to only be able to set a timeout globally. I canā€™t seem to set a timeout for the condition where the door contact sensor is triggered but the motion sensor is not to turn lights off immediately.

Is there a way to do this? Iā€™ve attached screenshots of my current cobbled together automations that accomplish this.

I checked all the options but it still activates during daytime. Hereā€™s my code. Iā€™m using a Philips Hue lamp and a Philips Hue Motion sensor. I also made a helper that should keep the light on when doing a long press on the Hue dimmer.

alias: Lamp keuken aan bij beweging - v2
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.beweging_keuken_occupancy
    light_switch:
      entity_id: light.hue_keuken
    light_brightness: 50
    light_colour_temperature: 2500
    include_light_control:
      - use_brightness
      - use_transition
      - use_colour_temperature
    light_transition_on: 2
    light_transition_off: 5
    include_bypass:
      - bypass_enabled_stop
    motion_bypass_lights_stop:
      - input_boolean.sensor_overbruggen
    include_bypass_auto_off:
      - bypass_auto_off_enabled_stop
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.beweging_keuken_illuminance_lux
    ambient_light_value: 50
    ambient_light_high_value: 110

I have a limit of -10 deg. I will consider updating it.

Blacky :smiley:

1 Like