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

Thanks @Blacky - now it works. Rookie mistake on by side. Thank you for taking the time to answer😎 Cup of coffee coming your way👍

1 Like

I’ve never seen a developer in HA support a project like this. I feel bad for Blackie for all the time he devotes. Please, everyone should be buying him a coffee.

5 Likes

Hello Guys,

this Blueprint is accectly what i am looking for.
Ther is only one problem.
The Binary_Sensor triggers not.
The Bypass_Switch wont work too.

Where is my mistake?

alias: Licht Außen Auto
description: “”
use_blueprint:
path: Blackshome/sensor-light.yaml
input:
light_switch:
entity_id: light.shelly1_349454742657
motion_trigger:
- binary_sensor.shelly1_349454742657_input
time_delay: 0.5
include_bypass:
- bypass_enabled_turn_on
motion_bypass_lights_on:
- button.haustur_relay_2
bypass_time_delay: 0
include_bypass_auto_off:
- bypass_auto_off_enabled_on
bypass_auto_off_delay: 1

@Addi1975

Firstly welcome to the community :wave:

Thanks for providing your YAML. As a tip for next time, when you post your code into this forum it is best to use the “</>” button in the header and paste your code in there. It just makes it easer to read and use as it keeps the correct format.

looking at your automation settings it looks like you are using a button in your by-pass that probably has no “state”. The by-pass requires the entity to have an ON and OFF state. So it is probably getting stopped here.

Try and disable the by-pass and it should work. If it works after you have done that then you have some options for your by-pass.

  1. Keep using your button but you will need to create a bypass toggle helper and link the button to the toggle helper. you can do this by;

  2. Create a trigger template sensor with your button as the trigger and use that new sensor in the by-pass. Some examples of templates are Here

  3. Create a toggle helper and use that in the by-pass

    • Q: By-pass 101 - Every thing to know about the by-pass and how to use the “Trigger Sensor By-pass” without having a physical switch?

    • A: Please Click Here

  4. If you used ESPHome to created your button then add a switch to your code and have the button control the switch and use that. ESPHome area of this forum would be the best place to ask how to do this if you are unsure on the How To.

Hope this helps and let us know how you go.

Blacky :smiley:

1 Like

So to create this situation, you need to have three automation, or is it possible to have one automation to cover both morning, day and evening situation?

Hi Blacky,

Any chance we could get a trigger for on and a separate trigger for off?

My use case is that I have an open plan kitchen and living room. I want the living room lights to come on when someone is in the living room (occupancy sensor group), and kitchen lights to come on when someone is in the kitchen. but i dont want the living room lights turning off when someone is still in the kitchen.

I have this setup with my current automatons, but i like your use of the brightness turning the lights off when it gets too bright to have the lights on anymore.

@mars2020

Going through my head it looks that way for what you are trying to do but I have not tested it so I have no idea if that works for you. You will have to test it and see. If you think you can have one automation then sure test it out, if it works then all is good.

Blacky :smiley:

This could work… maybe try this.

Create a trigger template binary sensor that will handle what you ask.

Example

  1. Triggers for kitchen and living room ON. Both must be ON = Template sensor ON
  2. Then trigger on kitchen going OFF. = Template sensor OFF

Or something like that :thinking:… once created then add that template sensor into your living room group trigger.

Here are some template examples to go through but you will have to mix and match Click Here. If your unsure how to do this then just let us know.

Job done :wink:

Blacky :smiley:

Love this blueprint. Good work!

Unfortunately from time to time it finishes leaving the lights on. The configuration is primitive one sensor - one light - one minute delay. What could be wrong with this?

Thanks for your quick response to my question. I will do some homework and do some testing……

Yeah, thats not a bad idea. I’m changing some of the lights around in that room, so i’ll hold off for now until i have them sorted

1 Like

Hello,
First of all, congratulations on the automation. It’s the most incredible thing I’ve seen so far.
In particular, I have to solve a problem in your automation but I can’t find the solution.

I put you in the situation:
Use a motion sensor with Trigger.
Lighting sensor for dynamic brightness.

and night mode to set a lower brightness starting at night time.

Well, what I want to do is that if someone presses the switch (switch momentary), I run a script to activate a boolean and use it as a bypass so that the lights do not turn off (At least until the motion sensors do not detect movement for 60Min for example), after they turn off. My daughters always press but leave the light on.

I have tried By-pass time delay but it doesn’t work for me because it takes into account the time without resets and at the end of 60 minutes it turns it off even if the motion sensor detects movement.
I have tried the AUTO Off By-Pass option but at most I get the By-Pass to turn off but not the light.

And another problem, but I find this complicated, is that when we press the state of the light it necessarily changes state, which forces us to turn it off and on again so that the light remains fixed due to the By-Pass.

I’ll give you an Automation so you can see how I currently have it (Now, it stays on indefinitely).

alias: Auto Light Comedor v4
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.multi_comedor_home_security_motion_detection
    light_switch:
      entity_id: light.dimmer_comedor
    time_delay: 1
    include_dynamic_lighting:
      - enable_dynamic_lighting_brightness
    dynamic_lighting_lux_sensor: sensor.multi_comedor_illuminance
    dynamic_lighting_max_lux: 80
    dynamic_lighting_max_brightness: 90
    dynamic_lighting_min_brightness: 0
    include_bypass:
      - bypass_enabled_turn_on
    motion_bypass_lights_on:
      - input_boolean.estado_auto_luces_comedor
    bypass_time_delay: 10
    include_bypass_auto_off: []
    include_ambient: ambient_disabled
    include_night_lights: night_lights_enabled
    night_lights:
      entity_id: light.dimmer_comedor
    night_time_delay: 1
    include_night_light_control:
      - use_brightness
    night_light_brightness: 10
    night_lights_conditions:
      - time_enabled
    night_lights_after_time: "23:00:00"
    night_lights_before_time: "07:00:00"
    motion_bypass_lights_stop: []
    bypass_auto_off_delay: 0
    ambient_light_high_value: 80
    dynamic_lighting_min_lux: 20
    motion_bypass_lights_off: []
    ambient_light_sensor: sensor.multi_comedor_illuminance

Este es el script que ejecuta tras pulsar una vez.

alias: Evento 1 Click comedor V2
trigger:
  - platform: event
    event_type: zwave_js_value_notification
    event_data:
      node_id: 26
      value: 16
      command_class: 43
      value_raw: 16
condition: []
action:
  - if:
      - condition: state
        entity_id: light.dimmer_comedor
        state: "on"
    then:
      - service: input_boolean.turn_off
        data: {}
        target:
          entity_id: input_boolean.estado_auto_luces_comedor
    else:
      - service: input_boolean.turn_on
        data: {}
        target:
          entity_id: input_boolean.estado_auto_luces_comedor
      - condition: state
        entity_id: input_boolean.avisos_alexa
        state: "on"
      - service: notify.alexa_media_echo_dot_fama
        data:
          message: Apagado automático anulado en comedor
          data:
            type: announce
        enabled: true
mode: single

thanks in advance

For some reason, one of the automations stopped working in the night after updating from 4.4 to 5.0 version. Sun has been under the horizon for several hours, other similar automation works fine.

The one which is not executed after the 5.0 update:

alias: Stairs nightlight
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.stairs_nightlight_sensors
    time_delay: 0.3
    include_bypass: bypass_disabled
    include_sun: sun_enabled
    include_light_control: []
    light_transition_on: 1
    end_scenes: []
    light_switch:
      entity_id: light.stairs_nightlight
    light_brightness: 20

This one still works:

alias: Upstairs Hallway Light on Motion when dark
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.upstairs_hallway_sensors
    light_switch:
      entity_id:
        - scene.upstairs_hallway_night
    time_delay: 1
    include_sun: sun_enabled
    sun_elevation: -1.5
    include_bypass: bypass_enabled_stop
    end_scenes:
      - scene.upstairs_hallway_day
    motion_bypass: light.stairs_top_lights
    bypass_time_delay: 0.5
    include_light_control: []
    light_transition_on: 0.5

Could it be because the first one uses the default sun_elevation (-1.5), while the second one has it set explicitly to -1.5?

@i-93

Hi Yuri, and welcome to the community :wave:

Thanks :smiling_face_with_three_hearts:

I am very interested in this… can you provide more information.

  1. What type of motion sensor do you have?
  2. Is it battery operated.
  3. When this happens does the motion sensor become unavailable and then go OFF.
  4. Can you also provide 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:

@mars2020

No problem, one thing I have seen is in automation 3 it shoud be “am” not ‘pm’

Automation 3

  • Global time = 22:00pm to 6:00am
  • Brightness = 20%

@bento

Hi,

Not sue where you would like the 60min and I am not following 100% but I will try to answer.

All good so far

Now there is a problem. If the by-pass is ON the motion sensor will have no effect on the automation as the by-pass is ON. Until the bypass turns OFF the automation will stay this way. You can manually turn your light ON and OFF but the automation will do nothing.

If this button is the by-pass then yes the light will stay ON but you can turn them OFF. Again the automation is disabled when the by-pass is ON.

For your settings the by-pass time delay will only come into play when you turn the by-pass OFF and no motion is detected. If that is the case the time delay will start and then turn you light OFF.

If you use the auto OFF then when the by-pass turns OFF it looks if there is motion. If yes then your light will stay ON, if no then it looks at the by-pass time delay, waits for the time you have set then turns OFF. So example if your by-pass time delay is set to “0” and no motion is detected and you turn the by-pass OFF the light will go OFF instantly.

To me looking at your YAML you have selected the wrong By-pass Auto OFF in the past and that is why it not working for you. Below is the settings you should have and the red lines show you the links between the by-pass settings. Try these settings and then let us know if it works for you. You can reduce the 60 min to your liking and the by-pass time delay you can change the setting. I would recommend at least 1 minute.

Blacky :smiley:

1 Like

@JetSerge

Looks like it is about the by-pass.

TIP: If you are updating from an older version and you would like to check if there was anything to do when a new version came out you can go into the FAQ. Down the bottom of the FAQ post it provides the versions and what was needed to be done link. So from version 4.4 to 5.0 there were 2 things both related to by-pass.

The first automation that is not working remove this line, save and :crossed_fingers: it should work.

The second automation works because you selected by-pass settings but you need to reselect your by-pass entity and remove a line first. Remove the line below and reselect your by-pass entity.

Hope this helps you and let me know how you get on.

Blacky :smiley:

1 Like

Not sure how I missed this important FAQ section. Sorry about that. I’m sure it will work after the suggested changes. Thanks for helping, as always!

I have Aqara motion sensor. It doesn’t seem that it went to unavail state before clearing.

Here is the configuration:

alias: Yuri's Closet
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.yuri_s_closet_occupancy
    light_switch:
      entity_id: light.yuri_s_closet_light
    time_delay: 1

I have a complete trace as well, if you are interested.

Thanks!

Hey Blacky

Sorry for my late reaction.
Your solution was exactly what i needed. I changed the two things according to your suggestion and everything works 100%. Thank you very much.