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

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

Absolutely amazing work, thanks!

I do have a question I couldnā€™t find an answer to: is there an option to NOT change the brightness with dynamic lighting IF the light is already on?
What happens is, as an example, that the light turns on 1% in the middle of the night, and then I change it to letā€™s say 30%, and on the next motion sensorā€™s motion detection basically the automation runs again and changes it back to 1%. My time delay is set to 10 minutes and that happens within those 10 minutes. Any setting I missed to treat that?
Thanks!

@deliverer33

Sounds good, here is the code you will be looking for in your script. Once ceated add it into Scenes - Scripts To Turn OFF.

alias: New Script
sequence:
  - condition: state
    entity_id: switch.pool_bathroom_fan_2
    state: "on"
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.pool_bathroom_fan_2

If you would like a delay before you turn the fan OFF after the light A is OFF then this.

alias: New Script
sequence:
  - condition: state
    entity_id: switch.pool_bathroom_fan_2
    state: "on"
  - delay:
      hours: 0
      minutes: 30
      seconds: 0
      milliseconds: 0
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.pool_bathroom_fan_2

What happens is in the end of the blueprint automation it turns light A OFF, then it will run the script. The script says if light B (the fan) is ON then turn fan OFF. The second code I gave you just has a delay of 30 min.

Now I know it is a fan for your pool and your removing humidity I would look at my :shower: Bathroom Humidity Exhaust Fan and link it with the light automation. You will need a humidity sensor to turn the fan ON. In the :shower: Bathroom Humidity Exhaust Fan blueprint look at the FAQ and my set up. I think you will love it.

Blacky :smiley:

@esrauscht

Hi Sebastian, sorry I missed your last post. I normally respond to everyone, but sometimes I miss one, so thanks for asking again.

We canā€™t use the light in the bypass as when the automation turns the light ON it turns the bypass ON and then the automation will never turn the light OFF.

BUT

I do have a blueprint that if you manually turn the light ON (not the automation) it can turn the bypass ON so when the automation turns the light ON the automation will still turn it OFF. You use this blueprint to create a bypass and then use the bypass in the sensor light blueprint. I havenā€™t released this blueprint as of yet but if this is what you are looking for I can provide you a link so you can download the blueprint and test it out. Just let us know and I will set it up for you.

Blacky :smiley: