💡 Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights

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!

2 Likes

Oh great, I did not realize this. I guess I have to read and try out more before asking questions :smiley: 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 :slight_smile:

Ah great, didn’t realise it was a HA limitation, upvoted.

@Sk1vvy

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

Also have a look at this blueprint as it just out an may be what you are looking for.

Blacky :smiley:

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