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


Initially I wanted to start controlling my lights based on circadian lighting using the adaptive lighting custom integration GitHub - basnijholt/adaptive-lighting: Adaptive Lighting custom component for Home Assistant which looks very good.

Then I also found this blueprint which looks amazing and also offers similar functions like color temp and brightness based on time of day and lux and also a night mode.

Before I start doing test use cases and spend lots of time I was wondering if anyone has done that already and knows both? What do you prefer? Where are major differences?

Thanks a lot!

I have a question to the bypass. You write that I should add the switch entity and depending on the setting my lights will go on, off or keep their state.

I use primarily Friends of Hue EnOcean switches (Friends of Hue Smart Switch - EnOcean) that are connected to HA via Zigbee2MQTT (same as the lights). These have 4 “buttons” with multiple actions each (e.g. press, hold etc.). Currently they are setup (via automations) that one button turns lights on, one turns off, and other 2 call scenses.

In the blueprint I can select the switch e.g. under bypass switch - turn lights ON but how will be determined which action was triggered / which button was pressed? Or will simply any press on the switch turn the lights on? That would kinda defeat the purpose of the way the switches are setup.

Or do I understand this function completely wrong?

Hi Blacky,

I’ll set the time to 60 as you suggest and work from there, I’ll let you know how I get on.

I’ll also set the ‘Trigger’ to end at 9pm ish and then have the ‘Night Lights’ start at 10pm ish and see what happens.

How about the idea of running a new instance of your ‘Blueprint’ after the first instance has finished at say 9pm ish at 10pm ish and have it turn down the lights using your original ‘Dim the Lights’ as the Sun drops even more over my horizon?

I’ll try it and let you know how I get on after trying your idea re the 60 setting above…

Again thanks for the help…

I’m sure we/you will eventually crack it and it will help a lot more people with there home and outside lighting.

Best Regards,


PS: If I wanted to try and write my own code to drive something like my lights or whatever how would I get started? I’ve done some code bashing many years back, done some assembler coding +++ some C+ coding so I’m not exactly innocent…

Any idea where I should start educating myself?



Hi Backy,

This is my new YMAL.

A few points:
1, My lights can dim to 1% so no problem with this setting.

2, I’ve set the lights to come on at sun set ,elevation falling, 0’ (Don’t have a degrees sign) and off at Dusk -6’ just to test.

3, Through the ‘Sun’ global option I have enabled only Sun Descending Action as I have set it to Elevation Falling between 1’ and -7’ ie: just before Sun Set and just after dusk. (I’m in the UK and we are going into late Sun Set’s…

4, Night Light set to transition 60 as requested down to 1’ and stay on at 1’ until turned off by the Trigger Helper (9.30pm off - 5 below)

5, Trigger Helper set to on at 3pm and off at 9.30pm - I’m hoping this will turn the Test Light OFF for the night (9.30pm OFF).

Thanks yet again for your support…



alias: Blacky Outside light tester
description: Blacky Outside Lights on and off test
  path: Blackshome/sensor-light.yaml
      - schedule.a_test_light_schedule
      entity_id: light.my_test_moer_zigbee_dimmer_light_2
    time_delay: 0
      - use_transition
    light_transition_on: 1
    include_dynamic_lighting: enable_sun_elevation_brightness_inv
    dynamic_lighting_min_brightness: 1
    dynamic_lighting_sun_elevation_start_falling: 0
    dynamic_lighting_sun_elevation_end_falling: -6
    include_sun: sun_enabled
    sun_elevation: 1
    include_night_lights: night_lights_enabled
      entity_id: light.my_test_moer_zigbee_dimmer_light_2
    night_time_delay: 0
      - if_lights_are_on_adjust_when_crossing_over
      - use_brightness
      - use_transition
    night_light_brightness: 1
    night_light_transition_on: 60
    night_light_transition_off: 2
      - time_enabled
    night_lights_after_time: "21:00:00"
    night_lights_before_time: "21:30:00"
    night_lights_sun_elevation: 0
    dynamic_lighting_sun_elevation_start_rising: -6
    dynamic_lighting_sun_elevation_end_rising: 0
    sun_elevation_rising: -7

Hy Blacky,

I’m trying to implement weather bypass for motion sensors in following way:

  1. I do not possess ambient light sensor.
  2. I’d like to be able to activate motion sensor lights if it’s “cloudy” or “rain” outside.
  3. It can be a simple helper switch automated to get ON or OFF state based on weather conditions.

In other words, I’m trying to activate lights if it is a day (and with already existing settings lights would not turn ON) but if this helper switch is ON, it would bypass normal behavior and activate lights when motion is detected.

Something like this:

Many thanks for your help.


The blueprint requires an entity that has a ON / OFF state. You may need to have your buttons toggle a toggle helper and then add the helpers to the blueprint. Not sure what you are doing in regards to your trigger and if you are wanting a button to be used as the trigger to run dynamic lighting or just the automation. You can do this by inserting your button entity ID into the YAML. To do this, just use any entity as the trigger then edit in YAML and swap over the entities ID’s.

If you had the buttons toggle a toggle helper and use those toggle helpers in the automation then you could have one button as the trigger, one button as the bypass and the other 2 you can keep what you have to call scenes but I am not sure what you are exactly trying to doing.

Blacky :smiley:


Hi Bobie

I will go through your points.

  1. Nice okay noted.
  2. These settings are for dynamic lighting to follow and because you have 1% in the ‘Min Brightness Value’ is not for when the light comes ON. It is the linear line for dynamic lighting. Example. If you don’t use the sun global condition and just your schedule the light would turn ON at 3pm at 1% and when it get below 0° the light will start to transition to 100% linear between 0° to -6°. When it gets to -6° it will be 100%. This is all good the way you set it up just trying to explain the settings. See point 3 for when it comes ON.
  3. All good. The main setting we are looking at for your set up is ‘Sun Elevation Falling’ @ 1°. Because the schedule is 3pm well before 1° the automation will wait for sun elevation to turn the light ON. When it gets to 1° and below the light will turn ON @ +1% as per your ‘Dynamic Lighting - Min Brightness Value’. This is what turns your light ON not point 2. Example, say your ‘Sun Elevation Falling’ was set @ 5°, between 5° to 0° your lights would be at 1%. Then the light will start to transition to 100% linear between 0° to -6° as per you dynamic lighting settings. I use ‘Sun Elevation Falling’ @ 5° in this example because your settings are 1° to 0° and this will happen quickly and you may not notice anything. All your settings are okay with what you have just trying to explain to hopefully make sense.
  4. That is good. Because your trigger helper set to on at 3pm and off at 9.30pm at 9:30pm is when the light will turn OFF. Because your ‘Night Lights - End Time’ is also set to 9:30pm is should work without transition back to normal lights. If you would like to be safe then you could set your ‘Night Lights - End Time’ to say 10pm. This setting of 10pm is not when the light will turn OFF as your trigger helper set at 9.30pm, it is for when night lights will be applied. I am just trying to avoid a flash of 100% brightness in the transition to OFF. Try setting your ‘Night Lights - End Time’ to 10pm if you are getting a flash of 100%.
  5. Yes this will happen. It will start to transition OFF at 9:30pm and because you have 0 time delay with 2 sec transition delay it should be OFF at 9:30:02pm.

Looks like we finally got there.

Blacky :smiley:


Okay, so you would like a condition that the motion sensor will only work if it is “cloudy” or “rain” outside.

What you can do is create a binary template sensor so when motion is detected and the helper switch is ON the binary template sensor is ON. Then use this binary sensor in your trigger not the motion sensor.

But not sure if you would like it to work at night when it is dark. If so in your helper switch for the weather you will need to make it so if it is day time and it is cloudy or raining then ON else ON. Make sure you put a day condition in it so the else ON will be ON at night. You could also just do all this in a binary template sensor also adding in your motion sensor and use this as the trigger.

Blacky :smiley:

Hello everyone,

Can anyone enlighten me on how I can add the motion detection time?
I’m using a Hue Philips motion sensor, which, in normal automation, allows the detection time to be added (e.g.: on same places, I would prefer to only activate lights if movement is detected for 5 seconds).

Have a nice weekend!

Kind regards


Some motion sensor can have this option in there settings. If not, to make it work you can create a template binary sensor using your motion sensor and put a delay in of 5 sec. I have template examples in the FAQ but here is the link to them, click here

The example you would use it REF - TS-2. Once you create this template binary sensor you would use it as your trigger and not your actual motion sensor.

Hope this helps you.

Blacky :smiley:

1 Like



Thanks for the proposed solution. Although I know how to do it as a separate automation, I wanted to implement this feature as an addition to your marvelous blueprint. :blush:

It has all of the other features needed, but I’m missing this one.

So either to add additional condition that will override currently inactive lights during the day via switch or by checking string value of a provided helper.

This is what I’m trying to do. Form of a blueprint feature request :slight_smile:

And yes, you got it right. During the night it shouldn’t change behaviour.

Many thanks for support.

Hey again! That was a bit long but now i 100% know what this issue is caused by zigbee2mqtt new version which got updated few days before 2024.4 release. Zigbee2mqtt 1.36.1 have this issue with my Sonoff zigbee stick. And issue disappearing after i restore 1.35.3


Okay, looking at your example above (the image) and your post… looks like bypass 2 is what you are looking for. This will disable the automation based on your helper and turn the lights OFF. The bypass is quite powerful in what it can do, it digs deep analyzing what it happening when the bypass turns OFF.

I understand you know how to do this but for the others reading I will provide an example.

If we create a template sensor helper that has some conditions that are, it must be day time + cloudy or raining and if not turn the helper ON else turn it OFF. In the code below I have added unavailable and partlycloudy in the example but you can remove them. Then when bypass is ON the lights will turn OFF if the conditions are met + the automation will be disabled. When the bypass turns OFF as the conditions are not met it will check the site conditions and preform the correct action. I have not tested this code just typed it out but it should work. We would enter this code into the ‘State template’ of the template sensor helper.

EDIT I have updated the code.

{% set weather_state = states('weather.forecast_home') %}
{% if is_state('sun.sun', 'above_horizon') and weather_state not in ['partlycloudy', 'cloudy', 'rainy', 'unavailable'] %}
{% else %}
{% endif %}

Is this something that would work for you?

Blacky :smiley:


Thanks for the update. I am glade you found it as these bugs can drive you crazy. Nice one :+1:

Blacky :smiley:

Hi. I am having issues when using this automation with IKEA Styrbar remote control for manual override. I connected this switch though ZHA but it does not create binary output. Instead, this switch generates zha_event with unique cluster_id and end_point_id.
Below is an automation written by Malte to control lights using this remote switch.
ZHA - IKEA four button remote (Styrbar) for lights (E2001, E2002) - Blueprints Exchange - Home Assistant Community (home-assistant.io)
Are there any possible way to use this switch for manual override control? Your input is much appreciated. Thank you.


Welcome to the community

What I would do is have the switch (IKEA Styrbar remote) toggle a “Toggle Helper” ON and OFF when you press the switch. I would then use the “Toggle Helper” in the bypass as they have an ON / OFF state.

To create a toggle helper go to settings > devices and services > click on helpers tab at the top > click create helper and select toggle.

Let us know how you go.

Blacky :smiley:

I’m new to HA and a friend of mine helped me get started with your blueprint. It’s really awesome. However there is one thing I could not figure out:

We have some color Hue lights and is there a way to set the color for those with your blueprint? The only thing I’ve seen is to set the “temperature”.

Can the Night Lights - Entity State be a Motion Sensor?
Coming up the stairs, a motion sensor triggers the light in the hall (this is a Sensor Light BP) that leads to the bed and bathroom. The bathroom has a motion sensor too.
Using the Night option of the bathroom Sensor Light BP, I want the bathroom light to switch on when motion is detected by the hall (landing?) motion sensor, but only during the Night Time hours setting.
I tried to use the hall motion sensor as a Night Lights - Entity State for the bathroom but this does not work. Any suggestion how to get it working?

Hi Blacky,

Just been diagnosed with Covid!! :sneezing_face: :woozy_face: :face_with_spiral_eyes: :face_with_head_bandage: :face_with_thermometer: :roll_eyes:

I can read your words but can’t make out the sentences…

When I’m better I’ll have a better chance of understanding your reply above…

Best Regards,

Bob… :face_with_spiral_eyes: :face_with_spiral_eyes:

Hi Blacky. Can you just point me in the right direction. Have motion sensor dimmable smart bulbs, I use night light feature for quieter light after 9pm and the bypass when a day/night helper binary toggle switches to night.

So…question is, I just bought a lux sensor from these Screek, love their esp32 5v radar sensors for motion. This one for lux is new, just released:

Anyway, I’m already using the bypass for the day/night toggle. How would I also bypass the light turning on if the lux level is below a certain level?