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

One extension of the sensor light blueprint that I have had to put in is that I don’t want the automation to kick immediately. I have a bed sensor which I use as bypass_enabled_turn_off/motion_bypass_lights_off. This has a side effect of turning on the lights if I get up in the middle of the night to use the restroom or get water – which I don’t want. They’re not dimmable lights.

I added a new helper entity and automation and entity that uses the bedsensor + 10 minutes as a state_control_entity so it basically buffers the bed sensor by 10 minutes.

My question is should i continue using the new boolean helper entity as the state_control_entity or just replace my motion_bypass_light_off entity with the helper?

@Blacky
First time posting in the forums! Be kind :joy:
I have come across your wonderful blueprints and have just started to use your Sensor Light blueprint.
I am struggling to work out how to achieve something: we live in a barn conversion with walls that are over a metre thick and need lighting all day long even in the summer months.
In our open plan kitchen I would like our lights (multiple) to switch on with motion and go off when there is no motion before sunset, but after sunset I would like the lights not to go out but just to dim down to say 25%.
Is this possible?

@aram535

Why not use the bed sensor to control the automation instead? Have it disable the automation when you first get into bed, then re-enable it in the morning when you get up.

Then use the Time condition to define when the automation is allowed to run.

For example, I normally go to bed between 10:00 pm and 11:30 pm , and if I get up during the night it’s usually 3-6 hours later . So I could set the time condition to allow the automation to run from 6:30 am to 1:00 am . That means if I get up between 1:00 am and 6:30 am , the automation won’t trigger, so the lights stay off.

Obviously those times are just an example. Adjust them to match your own routine so the lights don’t turn on when you get up during the night.

Blacky :smiley:

1 Like

@amp88759

Welcome to the community!

Thanks for reaching out.

Try and use the night lights with the night light sun condition and also with glow lights. Set your glow lights to 25% so they will be ON all night. Your night lights could also be 25% but you could increase it to 40% or anything you like. That way when the sun sets your lights will come on to 25%… if your motion sensor is triggered at night they could go to 40% then back to 25% when no motion is detected.Then during the day the normal lights would be triggered when motion is detected at the setting you choose say 100%.

If your still unsure try your best then 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
Thanks for the guidance. I did not know whether or not to create a sunset toggle helper and have state control.
I have been also looking at using a script to switch on various types of lights at various brightnesses with an off script with an if-then statement for if before sunset > off, if after sunset > set lower brightness.
I will have a play around and if I struggle I will post my YAML here.
Many thanks!
Andrew

1 Like

Hey, Blacky. Thanks for all the help; sorry I’ve been absent, unavoidable family crises.

I’m using a group entity for the lights. Here are its settings and options:


The three members are all Ikea Kajplats bulbs using matter-over-thread, and their configurations each look like:

Finally, you requested the attributes. They are:

@judebert

No problem, hope all is well.

In you attributes you have brightness and supported feature 32 (white value) or RGBW. Transition not in the attributes.

In you configuration you have transition settings for OFF, ON and ON/OFF. Try setting your transition here.

255 is your brightness value.

255 = 100%
191 = 75%
128 = 50%
64 = 25%
25 = 10%

You also have an option for a drop down selection and then a power on setting.

Play around with these configuration settings so you will achieve what your after.

Blacky :smiley:

Hi.

I’m new to home automation and obviously to Home Assistant and I’m setting up lighting automation one room at a time. For the first room I’m using the existing (dumb) lights with FP300 presence & lumen sensors and there is also an Aqara H1 switch, which I currently have in decoupled mode. I discovered your amazing blueprint and it seems totally complete and has every option that I could conceive of wanting. So thank you very much for producing this.

Normally I would expect the light to come on when it’s dark and someone walks into the room. And obviously when someone leaves the room after a short period, the lights would go out. BUT somehow or other I would expect the light switch to be able to override this by manually turning the lights on or turning the lights off. Though an empty room should still cause the lights to go off.

I suspect that the bypass feature of the blueprint might be the way to go. There is a warning in the documentation not to use the same entity for a bypass switch as is used to control the lights. But I assume that by using a decoupled switch, that warning doesn’t really apply.

Does anyone have any suggestions or guidance as to how the physical smart switch could or should be used? All advice will be very gratefully received as I work my way through this powerful new set of capabilities.

Brian

@brianavid

Hi Brian

Welcome to the community.

Yes, this is all possible. You have two main options:

  1. Sun Elevation – Use the Sun Elevation option so when the sun goes down and it becomes dark enough, the automation becomes active and will allow the lights to turn on.
  2. Ambient Light – Use the Ambient option with a lux sensor to measure the room’s light level. Once the measured lux drops below your configured threshold, the automation becomes active and will allow the lights to turn on.

Yes, a decoupled switch is the way to go, but there are a few limitations to be aware of.

You would use the switch as Bypass Option 1. When the switch is turned ON, the light turns ON and the automation is bypassed. This means the motion sensor will no longer control the light, and any Sun Elevation or Ambient Light conditions are also ignored.

When you turn the switch OFF, the light may turn OFF immediately if no motion is detected. But, you can use the Bypass - Time Delay option to keep the light on for a short period, giving you time to leave the room or allowing the motion sensor to detect movement again before the light turns off. It is just a bit of a buffer you can utilize.

Regarding the empty room, because the automation is bypassed while the switch is ON, the light will remain ON even if the room becomes empty (the motion sensor is clear). This is one of the limitations of using a bypass… if you forget to turn the switch OFF, the light will remain ON. To overcome this, you can enable the Bypass Auto OFF Option, which will automatically turn the bypass OFF after the configured Bypass Auto OFF - Time Delay.

Hope this helps you get started.

Blacky :smiley:

Thank you for this. It helped a lot and I have managed to achieve exactly what I was looking to do.

I have two input boolean toggles, one to manually force the light on and one to manually force off, which are set up in the bypass section of the configuration of the blueprint. I then have two automations. One is triggered by a press of the physical light switch, which will set exactly one of those two toggles to true based on whether the light is currently on or not (If-Then-Else). And the other automation is triggered by the presence sensor for “Occupancy: Clear” , resetting both the toggles to false to revert to automatic operation when the room becomes empty.

So now I have a fully automated room light that will be used most of the time but I still have the ability to manually override it by physically switching the switch on the wall. And the manual override persists (and can be switched) until everyone leaves the room, at which point the automation returns to automatic

Your blueprint has worked amazingly in achieving this, so thank you very much.

1 Like

Hey @Blacky

First of all, thank you so much for all your effort on this, it’s been essential in me slowly swapping over to Home Assistant from Hubitat. I’ve had a few things that have popped up during me setting things up that you might be able to shed some light on and hopefully they haven’t already been covered (I haven’t been able to find anything). For context, all lights and motion sensors are Philips Hue products and they’ve been added to HA through the Hue Hub integration, this may be the source of my problems but I’m not too sure.

  1. Is there any way to have an entity pause the dim before off function. For example, having a TV light strip being on will pause the countdown and only will it restart once the light strip is off. I’ve tinkered around with the baypasses and state controls but they all just end up turning everything off once the strip turns off instead of just allowing the lights to stay on and the automation to return to normal from the countdown part.

  2. When using a motion sensor to activate a light, once the sensor stops detecting motion but the lights are still on, any kind of motion will cause the lights to raise up to 100% brightness for a moment before going to their desired state. Everything I have tried does not seem to help (from creating scenes in HA to setting specific brightness levels) and it seems to be directly tied to the sensor going from a no motion to motion detected state. If this is something that can be worked around through Sensor Light itself I’m not too sure but any insight into this would be brilliant.

Apologies for the long post but thanks again for all your efforts and hopefully you might have some clues on how I can get everything up and running!

@autom8-this

Welcome to the community.

  1. If you use bypass option 3 it will pause the automation or keep it in it’s current state. If the dim before option is active (lights dimmed) and you turn ON this bypass (TV light strip) the lights will resume the normal setting before it was dimmed. If you then turn OFF the bypass (TV light strip) the light will turn OFF… only if the motion sensor is clear. You do have an option to use the Bypass - Time Delay so if you motion sensor is clear it will wait for this delay before turning OFF the lights. If the motion sensor is active then the lights will stay ON or if the motion sensor becomes active in the Bypass - Time Delay period the light will stay ON.

  2. I will relate this question to using an entity, as scenes can be different depending if you used the Scenes & Scripts - Toggle Helper. If your motion sensor turns the light ON to a set brightness and the motion sensor goes clear to then detected the light will remain the same. Even if you change the brightness manually once the light is ON. Once the light is ON we wont send it another action. If your using the dim before OFF option and the lights dim then if dimmed and the motion sensor becomes detected again the lights will resume their normal brightness they were set on before it was dimmed.

If you would like me to look at your settings 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:

For the first one, that Bypass - Time Delay worked like a charm, thank you so much!

As for the second, my main issue is that no matter what I attempt, the lights will turn on at the correct value initially (80% in this case) and once motion is detected a second time, the brightness will boost straight to 100% and stay there (it will only correct back down if I combine it with a scene but that will cause the quick rise to 100% before lowing again mentioned in my initial post). If I strictly use entities, it will turn on correctly then always max out the brightness on the second detection. I’ll attach my YAML configuration to look over but nothing is standing out to me that should cause this issue. I’m not sure if this is an issue with the command being sent to the Hue hub or something else but I just can’t seem to figure it out so any insight would be super appreciated.

alias: Office Motion Sensor
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.office_motion_sensor_motion
    light_switch:
      entity_id:
        - light.office_ceiling_light
        - light.hue_play_1
        - light.hue_play_2
    time_delay: 10
    include_light_control:
      - use_transition
      - use_brightness
    light_transition_on: 0.5
    light_transition_off: 1
    include_bypass:
      - bypass_enabled_stop
    motion_bypass_lights_on: []
    motion_bypass_lights_stop:
      - input_boolean.office_motion_bypass
    include_night_lights: night_lights_disabled
    night_lights_conditions:
      - time_enabled
    night_lights_entity_state: []
    night_lights_before_time: "06:00:00"
    night_time_delay: 1
    end_scenes: []
    include_light_colour_control: disable_colour_control
    include_dim_before_off: dim_before_off_enabled
    dim_before_off_time_delay: 15
    light_colour_temperature: 4300
    include_time: time_enabled
    include_sun: sun_disabled
    after_time: "06:00:00"
    dynamic_lighting_max_colour_temp: 6400
    dynamic_lighting_min_colour_temp: 2900
    before_time: "00:00:00"
    include_state_control: state_control_enabled
    include_night_light_control:
      - if_lights_are_on_adjust_when_crossing_over
    motion_bypass_lights_off: []
    light_brightness: 80
    state_control_entity: input_boolean.office_motion_bypass
    sun_elevation: 4

@autom8-this

Thanks for your settings, this makes it easy. In Light Control because your using Dim before OFF you must select a toggle helper in Dim Before OFF - Toggle Helper. Once you have done this you should be all good to go.

Blacky :smiley:

Oh wow, I was under the impression that I had to connect a helper up to an automation of some type outside of Sensor Light but just creating an empty one and linking it has fixed everything. Thank you for all your help and for responding so quickly, you’re a gem!

1 Like

Awesome blueprint and has helped a lot!

I have outside lights that currently dim to 20% for nightglow, but if there is motion - they don’t go up to 70% during the nightglow period, they do go up to 70% after nightglow time. Is there an easy way to fix it? I must be missing some setting.

alias: Sensor Light - Front Upstairs 2026-07-25
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.front_door_motion
    light_switch:
      entity_id: script.front_upstairs_light_on
    boolean_scenes_scripts: input_boolean.front_upstairs_light_toggle
    include_light_control:
      - use_brightness
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - time_enabled
      - sun_enabled
    night_lights_entity_state: []
    night_boolean_scenes_scripts: input_boolean.night_light_toggle
    night_lights:
      entity_id: script.front_upstairs_light_on_25
    include_night_light_control:
      - use_brightness
      - if_lights_are_on_adjust_when_crossing_over
      - manage_scripts_crossing_over
    include_night_glow: night_glow_enabled
    night_glow_lights:
      entity_id: script.front_upstairs_light_on_25
    include_night_glow_light_control:
      - use_brightness
    end_scenes:
      - script.front_upstairs_light_off
    include_dynamic_lighting: enable_sun_elevation_brightness
    include_sun: sun_enabled
    dynamic_lighting_state_control_activation_state: "on"
    include_ambient: ambient_disabled
    include_bypass: []
    motion_bypass_lights_on:
      - binary_sensor.front_door_motion
    motion_bypass_lights_off:
      - switch.front_door_detections_motion
    night_glow_light_brightness: 16
    motion_bypass_lights_stop:
      - script.front_upstairs_light_on_25
    bypass_time_delay: 2
    include_bypass_auto_off: []
    time_delay: 1
    include_time: time_enabled
    after_time: "19:50:00"
    before_time: "06:00:00"
    night_lights_after_time: "20:30:00"
    night_lights_before_time: "22:30:00"
    night_time_delay: 2
    dynamic_lighting_boolean: input_boolean.front_upstairs_light_toggle
    dynamic_lighting_time_start_morning: "04:00:00"
    dynamic_lighting_time_end_morning: "06:00:00"
    dynamic_lighting_time_start_evening: "19:00:00"
    dynamic_lighting_time_end_evening: "22:00:00"
    dynamic_lighting_state_control: disable_state_control
    dynamic_lighting_state_control_entity: binary_sensor.g6_bullet_is_dark
    dynamic_lighting_min_lux: 100
    night_light_brightness: 18
    include_state_control: state_control_disabled
    light_brightness: 70
    include_light_colour_control: disable_colour_control

@sasfs2

Welcome to the community.

Thanks for your YAML of your settings.

You got a lot going on here.

  1. Your using scripts. Can I ask what is happening in your script. If your just turning ON some lights to a set brightness and or colour temp then it will be easier to jut use the light entity and let the blueprint do the rest. It will work with scripts but sometimes people use them just to set a brightness level and is not needed. If you use light entities then dynamic lighting will work and that is my next point.
  2. Scripts don’t work in dynamic lighting so your settings for DL will be doing nothing.
  3. The question that you having problems with is in Night Lights. You are using a script that indicates the lights will be set to 25%. You also using this same script for your Night Glow - Lights. This is why your not seeing any change. In Night Lights you should have a script that is 70% and in Night Glow - Lights you can keep the script for 25%. Then test it out and it should work.

Hope this helps.

Blacky :grinning_face:

1 Like

@Blacky I literally created an account here to thank you for your work on the blueprints and also to ask for a little advice, specifically regarding the Bypass function.

At first, after setting up the blueprint I couldn’t get anything to trigger, but after systematically disabling things I confirmed it was the bypass I had configured.

In a nutshell, I wanted a button on my IKEA smart switch to temporarily disable the motion activation and keep the lights on for the set period of time, before reverting back to normal. Here is a screenshot of what I configured:

Right now, everything is working if I turn the bypass off, but I can’t figure out where I’m going wrong with the settings here.

Below I’ve also included the YAML for the entire blueprint:

alias: Family Bathroom Motion Sensor
description: ""
use_blueprint:
 path: Blackshome/sensor-light.yaml
 input:
   motion_trigger:
     - binary_sensor.family_bathroom_motion_sensor_occupancy
   light_switch:
     entity_id: light.family_bathroom_lights
   time_delay: 4
   include_light_control:
     - use_brightness
     - use_transition
   light_transition_on: 0.5
   light_transition_off: 4
   light_colour_temperature: 3500
   include_dim_before_off: dim_before_off_enabled
   dim_before_off_boolean: input_boolean.var_dim_before_off_main
   motion_bypass_lights_on:
     - event.main_bathroom_main_bathroom_switch_button_6
   include_bypass:
     - bypass_enabled_turn_on
   include_bypass_auto_off:
     - bypass_auto_off_enabled_on
   bypass_auto_off_delay: 80
   ambient_light_sensor: sensor.family_bathroom_motion_sensor_illuminance
   include_ambient: ambient_enabled
   ambient_light_value: 80
   include_night_lights: night_lights_enabled
   night_lights_conditions:
     - time_enabled
   night_lights:
     entity_id: light.family_bathroom_lights
   include_night_light_control:
     - use_brightness
     - use_transition
     - if_lights_are_on_adjust_when_crossing_over
   night_light_brightness: 40
   night_light_transition_on: 0.5
   night_light_transition_off: 4
   night_light_colour_temperature: 2500
   night_light_include_dim_before_off: dim_before_off_enabled
   night_light_dim_before_off_time_delay: 10
   night_light_dim_before_off_boolean: input_boolean.var_dim_before_off_night
   ambient_light_high_value: 90
   ambient_light_options: ambient_light_option_enabled
   night_lights_entity_state: []
   night_lights_after_time: "22:00:00"
   night_lights_before_time: "06:00:00"

Once again, thank you for the work you do!

@TheRealDax

Welcome to the community.

Thanks for your kind words.

The bypass must be a switch with an ON/OFF state, but you’ve selected a button.

A button only fires an event when it’s pressed… it doesn’t have an ON or OFF state. The automation needs to know whether the bypass is currently ON or OFF, so a button can’t be used directly.

The solution is to create a toggle helper:

  • Navigate to Settings > Devices & Services > Helpers .
  • Click the Helpers tab, then click + CREATE HELPER and select Toggle .
  • Give the helper a name (e.g., Family Bathroom Lights Bypass ) and click Save .

Now replace your button entity in the bypass input with this new toggle helper.

Next, download the :nazar_amulet: Press Button - Turn ON & OFF Entities blueprint. Configure it as follows:

  • Press Button: Your button entity.
  • Main Entity: The toggle helper you just created.

Now, whenever you press the button, it will toggle the helper ON or OFF, allowing the bypass to work correctly, including the Bypass Auto OFF Option . This works because the toggle helper has an ON/OFF state and automation can only turn a switch (or toggle helper) OFF… it can’t turn OFF a button.

Hope this helps you.

Blacky :smiley:

Yes, script was just doing brightness, will change to light entity and see. Thanks again!


alias: Sensor Light - Front Upstairs 2026-07-25
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.front_door_motion
    light_switch:
      entity_id: light.front_upstairs_front_upstairs_upstairs
    boolean_scenes_scripts: input_boolean.front_upstairs_light_toggle
    include_light_control:
      - use_brightness
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - time_enabled
      - sun_enabled
    night_lights_entity_state: []
    night_lights:
      entity_id: light.front_upstairs_front_upstairs_upstairs
    include_night_light_control:
      - use_brightness
      - if_lights_are_on_adjust_when_crossing_over
      - manage_scripts_crossing_over
    include_night_glow: night_glow_enabled
    night_glow_lights:
      entity_id: light.front_upstairs_front_upstairs_upstairs
    include_night_glow_light_control:
      - use_brightness
    end_scenes:
      - script.front_upstairs_light_off
    include_dynamic_lighting: enable_sun_elevation_brightness
    include_sun: sun_enabled
    dynamic_lighting_state_control_activation_state: "on"
    include_ambient: ambient_disabled
    include_bypass: []
    motion_bypass_lights_on:
      - binary_sensor.front_door_motion
    motion_bypass_lights_off:
      - switch.front_door_detections_motion
    night_glow_light_brightness: 16
    motion_bypass_lights_stop:
      - script.front_upstairs_light_on_25
    bypass_time_delay: 2
    include_bypass_auto_off: []
    time_delay: 1
    include_time: time_enabled
    after_time: "19:50:00"
    before_time: "06:00:00"
    night_lights_after_time: "20:30:00"
    night_lights_before_time: "22:30:00"
    night_time_delay: 2
    dynamic_lighting_boolean: input_boolean.front_upstairs_light_toggle
    dynamic_lighting_time_start_morning: "04:00:00"
    dynamic_lighting_time_end_morning: "06:00:00"
    dynamic_lighting_time_start_evening: "19:00:00"
    dynamic_lighting_time_end_evening: "22:00:00"
    dynamic_lighting_state_control: disable_state_control
    dynamic_lighting_state_control_entity: binary_sensor.g6_bullet_is_dark
    dynamic_lighting_min_lux: 100
    night_light_brightness: 18
    include_state_control: state_control_disabled
    light_brightness: 71
    include_light_colour_control: disable_colour_control
1 Like