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

Thanks @Blacky, here is the YAML :

alias: GC Day
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.motion_gc_occupation
    light_switch:
      entity_id:
        - light.top_gc
        - light.desk1
        - light.desk2
    end_scenes: []
    time_delay: 0.1
    light_transition_on: 3
    light_transition_off: 3
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.motion_gc_eclairement
    ambient_light_options: ambient_light_option_enabled
    ambient_light_value: 4
    ambient_light_high_value: 300
    after_time: "10:00:00"
    before_time: "20:00:00"
    include_light_control: []
    include_time: time_enabled
    include_dynamic_lighting: disable_dynamic_lighting
    boolean_scenes_scripts: input_boolean.gc_day_helper
    include_night_lights: night_lights_disabled
    night_lights_conditions: []
    night_lights_after_time: "20:00:00"
    night_lights_before_time: "10:00:00"
    include_bypass:
      - bypass_enabled_stop
    include_bypass_auto_off: []
    motion_bypass_lights_stop:
      - input_boolean.gc_scene_activated_helper
    bypass_auto_off_delay: 1
    bypass_time_delay: 0
    motion_bypass_lights_off: []
    motion_bypass_lights_on: []

Well, here is the best I have: the helper is turned on when the scene is activated, but it’s not disabled when the lights are turned off (using the voice or the dashboard). So the automation only work while the lights aren’t turned off manually. If so, the automation never turns on the lights again.

If I use the “Enable the auto OFF for the bypass switch”, the automation turns off the helper, and the lights (I don’t want this, I want to keep the lights on if they were activated by the scene.).

Hi,
What may be the cause of having the very same automation work with a Hue Go but not with a hue TV Gradient Stripe ?
I am just changing the light targeted, works with the Go not with the Stripe…

Edit: after reading the docs, it only supports entities as lights and I was using a device…

1 Like

Hello @Blacky

I have tried your suggestion. The script for switching off is running. But if there is a new motion detected while this script is running, the light switches to 100%, but the script keeps running in parallel and turns off the light at the end.
Do you have any idea how I can avoid this behavior? How to cancel the script?

@Blacky thanks for the answer! :slight_smile:
I will try your recommendations. However, i have one additional question: When i have created a scene and a toggle helper, shouldn’t i… like connect those two somehow? like reference the toggle helper in the scene or something else? Or is it enough that i just add both in the same automation, and then the automation knows that the toggle helper is created to help toggle the scene?

@shunopoli

Thanks for letting us know.

Yep, you have to create a scripts.

Blacky :smiley:

@Hugoliv

The automation will turn ON 3 lights if it is after 8pm and before 10am (at night) and only if the ambient sensor is below 4lx and once ON it will disregard your ambient sensor.

If you have a scene and you turn it ON and you don’t want the automation to run / take over then yes use the bypass. In the scene add the bypass to it and turn it ON in the scene. This will disable the automation. You will have to make sure when your turn OFF the scene that you also turn OFF the bypass… you could use the auto OFF in the blueprint if that works for you.

I think that is what your asking.

Blacky :smiley:

@b_tton

You will probably have to use the motion sensor as a trigger to stop your end script.

Blacky :smiley:

@Strux

No the toggle helper is used for the scene status… see scenes have no ON or OFF state and we use the toggle helper for this. It makes the automation run correctly… all you need to do is create a toggle helper just for this automation and add it into the input Scenes & Scripts - Toggle Helper. Remember you will have to create an identical scene with everything OFF and enter it into Scenes - Scripts To Turn OFF so you lights turn OFF.

Blacky :smiley:

New update 7.6

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

New Feature :new:

  • Dynamic Lighting - You now have 4 new time controlled options. If you live in the far north or south, using sun elevation may not be practical during winter or summer, as daylight hours can be very limited or constant. These new options can help simulate a normal day of artificial lighting, providing a more consistent experience for those without typical daylight patterns. As always, you have full control to customize the settings to your liking.

:bug: Bug Fixes

  • Fixed a bug in Dynamic Lighting cross over from night lights.

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:

1 Like

Unbelievable Blueprint. Thanks for another refinement.

This Blueprint is the most active in Home Assistant. Bkacky spends so much of his time supporting users. Please buy him a couple of coffees.

Are there any example of something that could point me in the right track on how to create a script that would accomplish this?

Hi @Blacky,

Thanks for the answer.

You will have to make sure when your turn OFF the scene that you also turn OFF the bypass… you could use the auto OFF in the blueprint if that works for you.

This doesn’t resolve the issue, the lights are still automatically turned off after the “bypass delay” because of the second scenario:

The second scenario occurs when you turn the bypass OFF, the trigger sensor is OFF, and your lights are ON. In both scenarios, the automation will turn your lights OFF after the set time delay.

I don’t want the lights to be turned off, at any delay, if they were activated before, because the scene is turned on by the user (higher priority).

Maybe you can add a toggle to enable/disable this behavior and let us define if we want to keep the lights on? May I miss something?

Hi,

Since the last update of HA core and Z2M my light automations stopped working. It seems this is not a problem with the triggers because that part is executed but regardless of the sensor state it is not turning on the lights. Anyone else experiencing similar issues?

this is my automation yaml

alias: Fürdő emelet - motion controlled light
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.furdo_emelet_motion_group
    light_switch:
      entity_id: switch.furdo_em_kapcsolo
    boolean_scenes_scripts: input_boolean.furdo_emelet_motion_helper
    time_delay: 3
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.furdo_emelet_motion_illuminance_lux
    include_time: time_enabled
    after_time: "05:00:00"
    before_time: "23:59:30"
    ambient_light_value: 41
    ambient_light_options: ambient_light_option_enabled
    ambient_light_high_value: 101

Thank you
L:

ps: Blueprint is already updated to the latest (7.6) version.

Is there a way to change the delay time of the Night light from minutes to seconds?

So, basically it was nothing to do with the blueprint. I think last Z2M update renamed the illuminance sensors in my Vallhorn motion sensors from sensor.konyha_motion_2_illuminance_lux to sensor.konyha_motion_2_illuminance and disabled them :slight_smile:

Hi,

First of all thank you for your automation blacky.

I’ve been having a problem with my automation since today. It’s no longer being triggered even though the sensor is switching from one state to another. I’m currently in 2025.1 with the latest version of the blueprint. There is my simple automation :

alias: Lumière garage
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.portes_garage
    light_switch:
      entity_id: light.interrupteur_garage
    time_delay: 0.25
    include_bypass:
      - bypass_enabled_turn_on
    motion_bypass_lights_on:
      - input_boolean.bouton_garage
    motion_bypass_lights_off: []
    motion_bypass_lights_stop: []

is there a way to only turn the light on when it´s off and don´t do anything if it´s on already?

so basicly ignore the automation when the light is already on.

Hi Harry,

Once again I would like to thank your for your support / donation. It really helps me to continue to support my blueprints. :smiling_face_with_three_hearts:

Blacky :smiley:

@shunopoli

You will have to work out what you would like to do first. Example

What priority would you like and what is your logic. There are so many ways. Once you have your logic then you can wright your script to suit that. Below is an example… it is now getting a bit advanced.

What we can do is look at the toggle helper used in the automation Scenes & Scripts - Toggle Helper. The automation will turn this ON and OFF. We then run a loop if this toggle helper is active and we can even turn off the lights once the toggle helper is OFF. Disclaimer: I have not tested any of this just typed it out but this may start you on the correct path once you can see how it can be done. The delay is every 5 seconds but you will need to change this.

Create a new script, edit in YAML and copy and paste this code in. I going to assume you have some knowledge here. The look at it in the visual editor and this will help you make a start. It is not set to do anything correctly so you will have to work out your logic.

alias: Zone Lighting Control Script
sequence:
  - repeat:
      while:
        - condition: state
          entity_id: input_boolean.your_toggle_helper
          state: "on"
      sequence:
        - choose:
            - conditions:
                - condition: state
                  entity_id: binary_sensor.main_zone
                  state: "on"
                - condition: state
                  entity_id: binary_sensor.desk_zone
                  state: "off"
                - condition: state
                  entity_id: binary_sensor.rack_zone
                  state: "off"
              sequence:
                - target:
                    entity_id: light.target_light
                  data:
                    color_name: green
                  action: light.turn_on
            - conditions:
                - condition: state
                  entity_id: binary_sensor.main_zone
                  state: "on"
                - condition: state
                  entity_id: binary_sensor.desk_zone
                  state: "on"
                - condition: state
                  entity_id: binary_sensor.rack_zone
                  state: "off"
              sequence:
                - target:
                    entity_id: light.target_light
                  data:
                    color_name: warm_white
                  action: light.turn_on
            - conditions:
                - condition: state
                  entity_id: binary_sensor.rack_zone
                  state: "on"
              sequence:
                - target:
                    entity_id: light.target_light
                  data:
                    color_name: cool_white
                  action: light.turn_on
        - delay: "00:00:05"
  - action: light.turn_off
    target:
      entity_id: light.target_light
    data: {}

Blacky :smiley:

@Hugoliv

Maybe I am not following you.

You would like to manually turn a scene ON and if you do disable the automation.

Use bypass 3. The toggle helper used in bypass 3 add to your scene and in the scene make sure it is ON.

Now when you turn the scene ON it will turn bypass 3 ON and the automation will be disabled.

Blacky :smiley: