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

Hi
here is the yaml code

alias: kad sensor light
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.kad_mozgas_motion_detection
    light_switch:
      entity_id:
        - light.kad_led
        - light.kad_lampa
    time_delay: 1
    include_light_control:
      - use_brightness
      - use_transition
    light_brightness: 51
    include_light_colour_control: use_colour_temperature
    light_colour_temperature: 4200
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.kad_mozgas_illuminance
    ambient_light_options: ambient_light_option_enabled
    ambient_light_high_value: 50
    ambient_light_value: 30
    night_time_delay: 0.5
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - entity_state_enabled
    night_lights_entity_state:
      - input_boolean.halo_i_sleep
    include_bypass:
      - bypass_enabled_turn_on
    motion_bypass_lights_on:
      - automation.kad_tv_tv_turn_on
    include_night_light_control:
      - if_lights_are_on_adjust_when_crossing_over

@AutoShinobi

Welcome to the community.

It sounds like you’re working with a presence sensor. One solution is to adjust its positioning or detection area to prevent it from detecting incidental motion as you walk by. Another option is to configure a delay before the sensor activates, which is ideally handled directly within the sensor’s settings.

If that’s not possible, you could create a template binary sensor with a delay_on parameter. The goal here is to avoid triggering an automation when you walk by briefly by introducing a delay before the sensor turns ON. However, this requires careful consideration of timing: for example, if the presence sensor takes 4 seconds to clear but your template binary sensor has an ON delay of only 3 seconds, the binary sensor will always turn ON alongside the presence sensor. In this case, you might need to set a longer ON delay, like 5 seconds. However, keep in mind that a longer delay could result in noticeable lag when entering the room, delaying the light from turning ON when you need it.

Ultimately, the best approach is to refine the motion sensor’s placement and detection area to ensure it only triggers when and where you want it to.

Blacky :smiley:

1 Like

@rbhun

Thanks for your YAML. You need to add your night lights in, see below.

Blacky :smiley:

Thats the point. This is an area with a bathtub only. I do not want any lights on during night mode. In fact, if any lights are on, I want them to turn off. I do want them on during the use of the bathtub, which is why I have a separate motion detector and also have a bypass.

@rbhun

Then you use the bypass option 2 with your input_boolean.halo_i_sleep. Now when you turn it ON all the light will turn OFF.

See below code, I have cleaned it up, copy paste it in.

alias: kad sensor light
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.kad_mozgas_motion_detection
    light_switch:
      entity_id:
        - light.kad_led
        - light.kad_lampa
    time_delay: 1
    include_light_control:
      - use_brightness
      - use_transition
    light_brightness: 51
    include_light_colour_control: use_colour_temperature
    light_colour_temperature: 4200
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.kad_mozgas_illuminance
    ambient_light_options: ambient_light_option_enabled
    ambient_light_high_value: 50
    ambient_light_value: 30
    include_bypass:
      - bypass_enabled_turn_on
      - bypass_enabled_turn_off
    motion_bypass_lights_on:
      - automation.kad_tv_tv_turn_on
    motion_bypass_lights_off:
      - input_boolean.halo_i_sleep

Or if your TV bypass is turing the light ON and you would like it OFF then you would use a light in night lights and set the brightness to 0 like this, code below.

alias: kad sensor light
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.kad_mozgas_motion_detection
    light_switch:
      entity_id:
        - light.kad_led
        - light.kad_lampa
    time_delay: 1
    include_light_control:
      - use_brightness
      - use_transition
    light_brightness: 51
    include_light_colour_control: use_colour_temperature
    light_colour_temperature: 4200
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.kad_mozgas_illuminance
    ambient_light_options: ambient_light_option_enabled
    ambient_light_high_value: 50
    ambient_light_value: 30
    night_time_delay: 0.5
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - entity_state_enabled
    night_lights_entity_state:
      - input_boolean.halo_i_sleep
    include_bypass:
      - bypass_enabled_turn_on
    motion_bypass_lights_on:
      - automation.kad_tv_tv_turn_on
    include_night_light_control:
      - if_lights_are_on_adjust_when_crossing_over
      - use_brightness
    night_lights:
      entity_id: light.kad_led
    night_light_brightness: 0

Blacky :smiley:

New update 7.3

Your lighting experience, your way – take control and customize it to perfection! :bulb::sparkles:

New Feature :new:

  • Night Glow - This feature activates a low-level light when no trigger is detected, creating a subtle ambient glow perfect for nighttime use. When a trigger, such as a motion sensor, is detected, the light gradually increases to the night light’s brightness level, providing enhanced visibility and functionality without abrupt changes in lighting. You can also customize the light’s colour temperature or RGB colour for added personalization.

Maintenance :toolbox:

  • Just some code clean up.

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:

Enjoy

Blacky :grinning:

3 Likes

Amazing thank you for the night glow feature! Quick question, what does this feature use for determining when it is night? Is it the settings from Night Lights (which has separate device/entity selection though). What’s also a little bit confusing is you select devices/entities for Lights, Night Lights and Night Glow - what is the difference between all of these for the same automation?

EDIT: with a number of the settings I’m actually struggling a bit with what seems like should be two simple use cases: the first is I just want lights that turn on at night (e.g. with sun elevation) and stay on until day (e.g. “traditional” night lights with no trigger just on at night), and then lights that use the lower “glow” level at night and an occupancy trigger (which works if I just keep things simple to just a trigger only) to go up to a higher level. I seem to keep ending up with lights that never turn on at all, turn off entirely after a few minutes or that seem to stay on the entire time and don’t seem to use the glow feature at all. Can’t entirely figure out the interplay of the various options between trigger (or no trigger if I just want them on at a single level like a classic night light for the night), lights, light control, night light settings, night lights, and night glow to either have all night long night lights or all night long “glow” lights that increase with occupancy. I’m also trying to go through the FAQ and guides but haven’t sorted this out yet - but perhaps just two examples would really help of these cases.

@tman98

Looks like you would just like to turn ON some lights at sunset and OFF at sunrise. To do this you will need this blueprint :high_brightness: Smart Light. Just set your Trigger - Sun Elevation to Sun Elevation Falling - ON and Sun Elevation Rising - OFF, then adjust the elevation. Then add your lights in and any light control option.

That will turn it ON and OFF at night.

Now if you would like to increase the brightens when motion is detected use night lights. Select Enable entity state option and add your motion sensor to Night Lights - Entity State. Then set the night lights and any night lights control options. Make sure you select If lights are ON, adjust the lights when crossing over in Night Light Control

Now you light will come ON and OFF at night. When motion is detected it will activate night lights and the night lights settings.

Blacky :smiley:

@Blacky
Yup, already tested it. For some reason when my phone is on DND the blueprint doesn’t register it correctly? I have my bathroom lights using my DND as a bypass and that works fine.

Hi,

I’ve installed this blueprint; using my Blink door camera as the motion sensor. But it doesn’t seem to turn off correctly after the time delay.

Any advice.

Found this gem and have a question. I understand the trigger, but there are times where I may only want the trigger to turn on one entity, while other times I may want multiple like time of day. I can achieve this with scripts correct? Also based on time of day, I may want additional switches that were turned on manually to turn off. Is this possible?

Example trigger turns on light 1, no motion after 5 mins turn off light 1 and light 2. Light 2 may have been turned on manually and now I want to turn off, but I also don’t want to turn it on automatically.

@Yaksha

Thanks John, lets go through a few things as we know your DND works in HA because it works in the bypass.

  1. Your trigger has 3 entities, lets try and group these entities into one group. In the blueprint it has a link on how to group them in the description of the trigger. Once you group them just add the group entity into the trigger.

  2. Next just enable the state option in night lights.

  3. Next tick If lights are ON, adjust the lights when crossing over.

Now when your phone is on DND and you trigger the automation the lights should turn ON at 10% brightness.

Blacky :smiley:

@104

Hi Steve, welcome to the community.

It should turn OFF your light once the motion sensor is cleared. Cameras can be tricky, just make sure it clears and then wait for the light to turn OFF. Sometimes when lights turn OFF the camera thinks it is motion so camera settings is critical.

If you are still having issues 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.

Please check it before you post your YAML as the blueprint works and is used by many people.

Blacky :smiley:

@deliverer33

If we look at this setup you would like… add your light 1 in so it turn ON and OFF with a 5 min delay. With light 2, create a script that has this logic, if light 2 is ON then turn OFF. Then add that script into the Scenes - Scripts To Turn OFF in the Lights section. If you find it hard to make this script then you could create a scene with light 2 OFF and add the scene in instead of the script.

Blacky :smiley:

Thank you for the guidance! Yes lots to learn. Script seems like the better long term solution so will start learning that logic.

@Blacky

Sorry to bother, but could you maybe have a short look at my question. I still did not figure out how to set it up so that lights that have been on before don’t get effected by the motion sensor (no changing of the light as well as no turning off).

Thanks a lot!

Sorry I don’t know how to quote, so here is my last entry:

Blockquote

Hello, thanks for the great blueprint!
I have a question and I am sorry in case it was asked already.
Is there a way to bypass the automation when some lights are on already? In this case the motion sensor would not turn on or off any of the lights and leave them in their current state. I tried to set the lights as bypass switch (option 3) but as I understand that’s not how it’s intended and it also didn’t fully work.

Thank you!

Hi,
I currently have an automation that I would like to upgrade using this blueprint.

My current automation is triggered like this:

triggers:
  - trigger: state
    entity_id: event.zijdeur_beweging

However, I can not select this entity as a trigger in this blueprint, only binary sensors. Is there a workaround?

I tried creating a template binary sensor via the UI, but the blueprint automation does not seem to be triggered.


I want the light to come on between the hours noted, when motion detected and then turn off again after 2 minutes of no motion. Camera is Blink door bell, light is Phillips Hue through a Bridge.  

alias: Front door on/off
description: “”
use_blueprint:
path: Blackshome/sensor-light.yaml
input:
motion_trigger:
- binary_sensor.front_door_motion
light_switch:
entity_id: light.downstairs_landing
time_delay: 2
include_light_control:
light_brightness: 60
after_time: “15:45:00”
before_time: “23:00:00”
include_time: time_enabled

Hi, thank your for your great work on this automation. Every time I look at the traces I thank my lucky stars I didn’t have to set all that up :sweat_smile:

I have an issue where two occupancy sensors control the same lights, through two different automation instances of this blueprint, since one is for when I’m sitting at the dining table and one is for when I’m on the sofa, and I want different lighting for both. I tried using the bypass feature to keep current lights when the other sensor is active in both automations, but that only seems to trigger both automations when one sensor detects movement. Am I doing something wrong or is this not the right approach to solve my issue? All I really want is for the light to not turn off if the other sensor is active, since otherwise the other automation activates due to the sensor detecting occupancy, and then the first sensor clears, causing the automation to turn off the lights.

Thanks again for responding. I attempted a script but it’s not working the way I want. Basically the blueprint turns on light A when motion is detected in the room and turn off after 5 mins of no motion. I attempted to write a script that said if light A is on, using the same motion sensor, wait 30 mins without motion to turn off light B.What is actually happening is only light A is turning off and B remains on. Should the script work with this logic? I’m sure I have something configured incorrectly. In this scenario, B is being turned on manually by someone. Code below and this is tied to the blueprint under Scenes-Scripts to turn off. Do I need to use helpers to make this work correctly?

if:
  - condition: device
    type: is_on
    device_id: e36874622e3f77dd57e79f554fa9d2f4
    entity_id: 97c166a6ac585c5c4a6ce1121460b8b7
    domain: switch
  - type: is_no_motion
    condition: device
    device_id: e36874622e3f77dd57e79f554fa9d2f4
    entity_id: 24f5306d57fcb59a1e7d746d2232807e
    domain: binary_sensor
    for:
      hours: 0
      minutes: 30
      seconds: 0
then:
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.pool_bathroom_fan_2