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

Will do when I make it home. Two things to mention though. The bulb and the helper group I’m trying to use are Hues connected via the hue integration. I tried with a Zigbee plug connected via ZHA and it works. :man_shrugging:t2: Thanks!

This blueprint seems to offer everything what I am looking for but haven’t found a solution for one of the cases.

I have:

  • Hue fixture with ability to dim / change color
  • Zigbee doorswitch

I would like:

  • Light goes full on when door is opened during the day
  • Light goes on in a dimmed state when door is opened after sunset/night
  • Light goes off after x minutes
  • Light goes off immediately when door is closed

All cases work flawless except the last one. If the timeout is set at 0; the light switches ON and OFF when the door is opened/closed. I would like to use the timeout only when opening the door and ignoring it when closing the door.

Is this scenario possible with this blueprint?

alias: TEST Sensor Light Blue Print
description: Living Room Lights and Presence Sensor
  path: Blackshome/sensor-light.yaml
      - binary_sensor.living_room_occupancy_presence
      entity_id: light.living_room_lights_group
    time_delay: 3
    include_dynamic_lighting: enable_sun_elevation_colour_brightness
    dynamic_lighting_min_colour_temp: 2000
    include_time: time_enabled
    after_time: "15:00:00"
    before_time: "07:00:00"
    dynamic_lighting_max_colour_temp: 6500
    include_night_lights: night_lights_enabled
      entity_id: light.living_room_lights_group
      - time_enabled
    night_lights_after_time: "22:00:00"
    night_lights_before_time: "06:00:00"
    light_transition_on: 1.5
    light_transition_off: 2
    include_light_control: []

Yes put you will have to do a script. New update is coming out soon as well.

Blacky :smiley:

Hi Dennis, please adjust your min brightness as it is set to 0 = light OFF. So if you set it on say 10% the light will come ON.

Blacky :smiley:

1 Like

New update 5.7

:partying_face: IT IS A BIG ONE :partying_face:

Embarking on this journey, countless hours of dedication have been poured into our latest release, and I am thrilled to share it with you all. :rocket: The top post has already garnered an incredible 201 likes – thank you for your overwhelming support! If you haven’t already, please take a moment to hit the like button and show some love to the blueprint. :blue_heart:

:point_right: For those who resonate with my work and want to contribute further, there’s an opportunity to make a positive impact. A donation link is available to support ongoing projects. A heartfelt THANK YOU to those who have already generously contributed! :pray::sparkling_heart:

:heartbeat: If you’re yet to make a donation and would like to be a part of this journey, consider clicking the Donation Link. Your small contribution goes a long way, and I genuinely appreciate your support! :rainbow:

:warning: Attention: Dynamic Lighting Enthusiasts! :warning:

Exciting news for users of dynamic lighting options 1 or 2! We’ve introduced some game-changing inputs that will enhance the functionality and take your experience to the next level. :rocket:

If you’re keen on maintaining your current setup, it’s a breeze! Simply follow these steps: Set the “Step Value” to 100 and adjust the “Dead Zone” to 0. This guarantees that your original preferences will stay intact, ensuring a seamless continuation of your preferred settings. :arrows_counterclockwise::bulb:

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

New Feature :new:

Dynamic lighting

I have updated LUX brightness from all your feedback and my own experiences. No longer will the brightness jump up and down to then when it gets close just change ever so slightly… that can be annoying. You now can take back control of your lighting transition to a more suitable setting and let dynamic lighting do the rest. If your lights only support brightness then that is no longer a problem, you can now slow it down using the step value. The “Dead Zone” is a ± value that realy helps. Think of it like this; Say the dynamic lighting would like to set your lights at 88%, if your dead zone is 7% then if your actual light brightness is in the range (“Dead Zone”) of 81% to 95% then your lights will not change the brightness value. 7% seams high but I have found when testing it is only realy less than 7% of what it should be and is not noticeable. The defaults have been set but you will need to adjust them to your liking.

Below is what been added to dynamic lighting.

  • Step Value - With every heartbeat, the system evaluates the lux value, light brightness, and the targeted brightness. If the targeted brightness surpasses the predefined step value, the system applies the set step value to gracefully moderate the rate of changes, facilitating a smoother transition in light brightness.
  • Dead Zone - With every heartbeat, the system evaluates the current light brightness and the targeted brightness. If the targeted brightness falls within the defined dead zone, the system maintains the current light brightness. This prevents minor fluctuations in light intensity that could be bothersome to the eye.
  • Option 6 - Sun Elevation Lighting - Colour Temp + Lux Controlled Brightness. New option added for you light control.


  • You are able to run a script at the end like we already do with scenes. All you have to do is put your script in “Scenes - Scripts To Turn OFF” and when the automation turns OFF it will run the end script.

Maintenance :toolbox:

  • General code clean up - Just doing some housekeeping.

Bugs Fixed :bug:

  • By-pass auto OFF – When all three by-passes were ON, option 3 would not turn OFF due to an automation timing issue.
  • Auto OFF Enabled – When two or three were ON and one was turned OFF manually the by-pass auto off would not work.
  • HA Restart - By-pass options.

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:


Blacky :grinning:


Great; I have updated immediately !
I assume I still would need to make a script to switch off the lights when using a doorswitch?


I will PM you.

Blacky :smiley:

Awesome, really happy with the bypass fixes. Now I can restart my HA again without my spouse getting annoyed!

Hm, too soon. I am using a template (occupancy) sensor helper that detects if my TV is on and configured this as a bypass in “By-pass Switch - Turn lights ON”. But after a restart it takes a little while before the helper becomes available and “occupied” again. The automation doesn’t handle this so the lights will turn off after the timeout (and won’t turn on again on motion because of the bypass).


Okay, thanks for the feedback. We will fix it in the next release. How long does it take for it to become available?

Blacky :smiley:

1 Like

Thanks. I’m not sure how long it takes, I think a couple of seconds. Not sure how I can specify this, the unavailable state is not logged.

No problem, I will look at my system, the only thing is my system is realy fast so maybe on a RPi it could be slower. I will work it out.

Blacky :smiley:

1 Like

Hi Blacky,
First of all, thanks for the update and great support for this blueprint.

As the functionality is increasing with each update, also the complexity increases and more and more questions will be raised. You have created many FAQ’s and tips&tricks in this thread, but these are spread over multiple posts.
Is it possible to have alle the FAQ’s etc centralized on the GitHub so it will be easier to find the answers to all our questions.

1 Like

+100. I LOVE Blacky’s Blueprints, and his devotion to answering every question. But I think he’d be doing himself (and us) a huge favor with a centralized FAQ/how-to instructions on Github. The Blueprints are very complex and having detailed help/FAQ/upgrade instructions in one spot would be a god send.


Thank you for the reply. I’ve set it for option 2-turn lights off and put the auto-off to 0. When I press the switch, the lights turn off and then immediately turn back on. Here’s my code. Maybe that will help someone spot my problem.

alias: Family Room Table Lights Toggle and Nightlight
description: ""
  path: Blackshome/sensor-light.yaml
      - binary_sensor.presence_fp2_family_room
        - light.family_room_left_table_bulb
        - light.family_room_right_table_bulb
    time_delay: 8
      - use_colour_temperature
    include_night_lights: night_lights_enabled
        - light.family_room_left_table_bulb
        - light.family_room_right_table_bulb
    night_time_delay: 1.5
      - use_brightness
      - use_colour_temperature
    night_light_brightness: 10
      - time_enabled
    night_lights_after_time: "21:00:00"
    night_lights_before_time: "04:00:00"
    light_brightness: 50
    include_dynamic_lighting: enable_lux_controled_brightness
    dynamic_lighting_lux_sensor: sensor.family_room_light_sensor
    light_colour_temperature: 3000
    dynamic_lighting_max_colour_temp: 3000
    night_light_colour_temperature: 3000
      - bypass_enabled_turn_off
      - bypass_auto_off_enabled_off
    motion_bypass_lights_on: []
      - light.family_room_lamp_switch
    motion_bypass_lights_stop: []
    bypass_auto_off_delay: 60
    bypass_time_delay: 0

Thanks, Blacky!

I updated to 5.7 and I think my problem has been fixed! Thanks!

@mars2020 @DuckDuck25

I 100% agree it would be realy nice to have a type of manual of the blueprint. I never initially thought it would just keep on growing like it has. I keep telling my wife “I think it is all done now”. One can understand why she doesn’t believe me any more, but I’m fortunate that she remains understanding.

I do have a FAQ and a “The Settings & Best Practice Guidelines” Within the two links there are more links that take you to what you may be looking for. In every link you go to, down the bottom you will find 1 or 2 links that take you back to where you came from being the FAQ or “The Settings & Best Practice Guidelines”. I am not sure if this is the best way, but I am open to and appreciate your feedback.

Blacky :smiley:

Hey Blacky,

first of all a big thanks for this awesome blueprint!
I was fighting the whole last year to set up my presence sensors properly in Google Home. After switching to HA last week I was able to implement a basic lighting automation in minutes thanks to your blueprint. However I’m facing the following two issues with my Aqara FP2 sensor and I’m not sure how to get rid of them. I would be happy to get some tips from you.

As an example I’ve four virtual switches in HA for the sensor: ‘tv zone’ just in front of the couch, ‘dining zone’ at the tables location, ‘kitchen zone’ and ‘global zone’ for the whole room (-> containing all zones ‘tv’, ‘dining’ & ‘kitchen’).

  1. As soon as I enter the room (-> presence detected for ‘global zone’) there’s one automation that enables the scene ‘dark’. All lights in the room will stay on for 2 minutes after the last presence detection and will be turned off after these 2 minutes.
    I enter the ‘dining zone’, enabling a second automation. Only the dining lamp changes to my ‘bright’ scene for 1 minute after the last presence detection. After this 1 minute, the lamp will switch back to the ‘dark’ mode. This works flawless as long as I stay in the room. But by leaving the room (-> ‘global zone’ switches to absence) and re-entering the room within the one minute (‘dark’ scene still active, dining lamp still on ‘bright’) the ‘global zone’ automation starts again, resulting the dining lamp to change to ‘dark’. Is there a way to prevent this behavior? Maybe to only run the ‘global’ automation when the lights are off? But in this case the automation will not work to turn off the lights after two minutes, right? What’s about the by-pass option?

  2. As soon as presence is detected in ‘tv zone’ only, the ‘tv’ scene with help of a third automation is being activated. I’ve created a binary sensor via a template that starts the automation in case ‘dining zone’ & ‘kitchen zone’ are off and ‘tv zone’ is on. By walking from the ‘kitchen zone’ in the ‘dining zone’ there’s the problem that for a few milliseconds the binary sensor switches to on since the ‘kitchen zone’ is already off but the ‘dining zone’ not on at that point. Is there a way to adjust the template of the binary sensor that it only turns on when all requirements are fulfilled for at least one second?

I would be happy for any kind of support.

Thanks :grinning:


1 Like


Nice one, I think a lot of people will switch from having just Google Home once they know about HA.

I am trying to get my head around it all, so I apologise if I have got it wrong. I see you are using scenes to control your lights. If you opt to use only a scene or script, it’s advisable to include just one individual light or switch as a separate entity used in your scene or script. This ensures proper automation functionality, as it can accurately reference that specific entity. If only a scene or script is used, the automation lacks awareness of the ON/OFF status of individual lights or switches, potentially leading to malfunctions in its operation.

So can you put one light entity from your scene used in the automation into “Lights - Switches - Scenes - Scripts” You will end up having your scene and 1 light/switch entity. If possible best to just use the light control options with entities and no scenes, but you may be using colours so if that is the case then you will have to use scenes.

Test this and see how you go, let us know if you need more help and or if it worked.

Blacky :grinning:

1 Like