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

Hi @dkarijopawiro , firstly welcome to the community.

:smiling_face_with_three_hearts:

Could you explain how you think it should work? I will help me understand :thinking:.

Currently if you are using contact sensor (a door) and motion sensor I would recommend that you put them into a group for this to work correctly. It is in our FAQ, and here is the link on how to set one up. The only thing is if you close the door then the light will come on and I not sure if this is what your after.

If you have a fan in the toilet then maybe consider using my other blueprint called :toilet: Toilet Exhaust Fan with time delay

Hey,

Loving this blueprint. But it is always turning on my lights, even if the sensor is higher then the set Ambient Light LUX Value. any idea?

Thanks so much for you blueprint! It saved me alot of time especially as a HA beginner. Not sure if this has been discussed already but im looking for a solution for our staircase. The goal is that for example if the sun goes down OR a specific lux value a light group should go on at 20%. With detected motion the lights should go to 100% and back again to 20% after few minutes without motion detected. As soon as the sun goes up or again specific lux value the lights should turn off.
Any hints?

BR
André

First of all, I’m amazed just how much effort you have put into this @Blacky - not just providing the comprehensive Blueprint, but with all your helpful detailed responses to all the questions. A massive asset to this community! :+1:

I’ve been toying with the idea of using this Blueprint for a while now, as I only have one issue with my current automation that I put together a while back - and I think it’s the same issue/question as @dkarijopawiro mentioned a couple of posts above.

Currently I have a Hue bulb that is triggered by a Hue motion sensor, providing that the lux measurement from the motion sensor is below a certain threshold. Once there has been no movement detected by the motion sensor for 2 minutes, the light turns back off.
I also have a ‘manual override’ button on the wall in place of the original dumb light switch. This allows you to turn the light on or off as you see fit. If the light hasn’t come on by motion trigger, due to the lux value being too high for example, but you actually want the light to be on, you can click the wall button (Aqara smart button) and this turns the light on. The light will remain on until there has been no motion detected for 2 minutes, and then the original automation turns the light back off again.

Similarly, if the motion triggers the light on, but you don’t want it to be on for some reason, you can click the button and it will turn off - and it will stay off until there has been no motion detected for 2 minutes.

All works well, except if you are static for longer than 2 minutes, in which case if the light was motion triggered on originally, the light then turns off and leaves you in the dark - until you wave your hands around! Likewise if the light was motion triggered on, but you turned it off form the smart button, and again, are static for more than 2 minutes, then as soon as motion is detected, the light turns on.

To cure this, I am thinking of fitting a door sensor as a secondary condition. This would use the ‘Wasp in the box’ principal, so that if the door is opened, and then closed, the motion sensor only has to detect initial motion in order for the light to be turned on, AND STAY ON. If the door is closed and it has detected motion at least once, then you must still be in the room, and so there is no need for the regular 2 minute (in my case) cooldown to then turn the light off.

I did think about just using the ‘Occupancy Blueprint’ provided here:

Occupancy Blueprint

however I don’t know if my ‘Manual Override’ smart button would be a problem in that setup. If your Blueprint can incorporate this occupancy detection via an additional door sensor, that would be great - and I believe what @dkarijopawiro was asking also :slight_smile:

1 Like

@MrNickert

Hi Nick,

:smiling_face_with_three_hearts: thanks

We have tested it here again and it working.

The Ambient Light LUX Value works below your setting. If your setting is 20 then when your actual sensor reading is 19 it will allow your light to be turn on when triggered. Without seeing your YAML settings the only think I could think of is maybe you haven’t selected “Enable the ambient options”. See below

Let us know how you go.

@Andre3000

Hi André

Your welcome.

No haven’t had this one yet.

Currently you can’t do what your asking in just this one blueprint, but there is a work around.

This is how you would do it. In this blueprint (sensor Light) create a scene with 100% lights and put it into “Lights - Switches - Scenes”, then create another scene with 20% lights an put it in “Scenes To Turn OFF”. Now set your option, sun goes down OR a specific lux value.

Now you will need to get another one of my blueprints called :gear: Turn Light, Switch or Scene On & Off with Trigger Conditions. This will turn it on and off on a trigger condition when the sun goes down OR a specific lux value. Once you got the other blueprint enter your scene of 20% in “Lights - Switches - Entities - Scenes” then create another scene that turns everything off and enter it in “Scenes To Turn OFF”. Now set your option, sun goes down OR a specific lux value.

The 2 blueprints will work together and give you what your asking :tada:

Hope this helps

Edit: Let us know how you go.

Blacky :smiley:

2 Likes

@Scoff

Hi, Scott

Thanks for your kind words :smiling_face_with_three_hearts:

Thanks for the clear detailed example. Very interesting
 you got me thinking now :thinking:. I like the idea :+1: . I will put this on the list. If I did this I would like it to be a 2 click item
 maybe 3 and very easy to understand.

Thanks again!

Blacky :smiley:

Hi Scoff and Blacky,

This is exactly what I meant.
@Scoff, for now i’m using the blueprint from @Blacky and the Occupancy blueprint for the bathroom and toilet.
It works great, would love to see this feature in this blueprint.

1 Like

Hello,

first of all that blueprint is awesome!

But i have one scenario and stuggeling a bit

I have bulb that is used as an evening light (lower brightness) and is off during the night.
My idea is as soon my motion sensor detect someone the brightness should go up or on and after a period of time back to the state before (lower brightness or off). Any ideas how to archive that?

1 Like

That option would be pretty Awesome

You’re a hero! It’s working as described. Thank you so much for your time. Where is the donate button?

I will use your automation also for my outdoor lights.

Use case:

Sun goes down or LUX lower X → Turn light on at 20%

If motion detected (coming home or guests) → set brightness to 100%

After 2 minutes of no motion → set lights back to 20%

If sun goes up or above X Lux → turn light off

—

This is now easy doable due to your both automations mentioned in your reply :heart::heart:

3 Likes

I keep getting a warning in my log but the automation runs fine. I can’t figure out what I’m setting wrong.


The Light switch is a dimmer does that make a difference ? Maybe I should setup a scene instead? I have night light setup also with the same dimmer. But I get this warning for every automation I use with this blueprint but they all run fine. maybe Use Entity instead of device? version 3.0
Screenshot 2023-04-13 at 10.58.54 PM
Maybe I need both Entity and Device

this was indeed on disabled. Thanks.

1 Like

Hi @Mar1us

I think I am following you but not 100%

I think this is what we call “Night Lights”

I think this is “night Lights” It will turn it on and off.

Hi @geox19

Try and expand your devices and use entities. It is always better if you can use entities. I find having “area” and “devices” is a quick way to find your entities.

The expand button is here

1 Like

I donÂŽt think thats what i search for. Here a bit more in detail:

  1. I have an automation that active a bulb at 8PM.
  2. As soon the motion sensor is detecting motion the bulb should be active a scene.
  3. After a period of time the bulb should go to the level of brightness from 1.
  4. At 11pm the light will be off.
  5. same behavior like 2.
  6. After a period of time the bulb should go to the stat of off (4.)

So it would be great to store the state of the bulb before the activation and set this after the time after motion.

Hi @Mar1us

This is a custom automation but you still can do it with this blueprint and another one of my blueprint. It is simpler to André question above.

Below example is if your using the same light/s in everything.

First you will need to download another one of my blueprints called :gear: Turn Light, Switch or Scene On & Off with Trigger Conditions. This will be used for your (1) ON at 8pm and (4) OFF at 11pm. Set it up for this time. Then set up a scene for your ON (1) and put that in “Lights - Switches - Entities - Scenes”. We will call that scene “scene 1” for this example but you can name it anything you like. Then create an identical scene with everything OFF and put that into “Scenes To Turn OFF”

Once that is done Use this blueprint (sensor Light) for (2) and (3). So for (2) you would create a scene and set the brightness level you like and put that in “Lights - Switches - Scenes”. Then enter “Scene 1” used in the other automation and put that into “Scenes To Turn OFF”. Set the time under “Use The Time Options” to only run between 8pm and 11pm.

Now use this blueprint (sensor light) again and create another automation for (5) and (6) this time you can use a scene or not and set up the light to come ON and OFF as you like. Set the time under “Use The Time Options” to only run between 11pm and 8pm (note the reverse time).

With the 2 automations using the blueprint (sensor light) you can also set the other options if you like. Example “Use The Sun Option (Optional)”.

Hope this helps you.

Let us know how you go.

Blacky :smiley:

1 Like

Very nice blueprint here! The only thing i’m missing here is to make the lamps go to there previous state. Or am i looking over this?

I think two post up explains how to achieve this. Didn’t read it real close yet but I’m thinking that’s what Blacky is explaining

1 Like

FAQ - The Settings & Best Practice Guidelines

:zap: Trigger Sensor - Binary Sensors

The trigger sensors are responsible for turning the lights, switches, scenes, or scripts ON and OFF. You can choose any Binary Sensor you prefer as triggers. Alternatively, if you prefer a time-based trigger, you can also add a schedule

For more information + Pro Tips Click Here

On how to set up a schedule helper and a pro tip to use it with a sun condition please click here.

:spiral_notepad: NOTE: When adding multiple trigger sensors, in particular a sensor that can remain in an ON state for long periods of time, it is recommended to group these sensors together as the automation will function correctly. Sometimes depending on many factors, just having 2 or more trigger sensors prevents the automation from function correctly and grouping these sensors together helps. For more information on how to set up group sensors please click here. If you would like to know more about groups and why we use them then please click here. Example of these sensors are;

  • Presence sensor
  • mm wave sensor
  • Contact sensor
  • Door sensor
  • Window sensor
  • Garage door sensor
  • Motion sensors with long inbuilt delays

If you find your trigger is not triggering the automation then see below under “Lights - Switches – Scenes - Scripts”.

If you would like to create a template trigger sensor so you can use it in the blueprint click here for some examples. This is a realy good read, and I would strongly recommend you take a look at it. This shows how you can make this blueprint even better. The ‘Bee In The Hive’ sensor is the one I realy love :heart:, it will take your automatons to the next level.

:bulb: Lights - Switches – Scenes - Scripts

The lights, switches, scenes, and scripts that will be activated by the trigger sensor/s.

More information on scenes and scripts please click here

The automation exclusively supports entities. To conveniently locate your entities, you have the option to also select areas, devices and labels, providing a quick and easy method. Simply click the expand button " < > " as shown below. This expands your area, device or labels, allowing for a swift identification of your entities. Ensure your final selection is all green, containing only lights, switches, scenes, or script entities.

Areas :x:

Devices :x:

Labels :x:

Entities :white_check_mark: :+1:

:link: Scenes & Scripts - Toggle Helper

Scenes and scripts lack a discernible state within Home Assistant, making it challenging for the automation to determine their activation status. To address this, it’s recommended to use a toggle helper alongside scenes or scripts. This enables the automation system to recognize when a scene or script has been activated, ensuring smooth operation. When entering scenes or scripts in “Lights - Switches - Scenes - Scripts” or “Night Light,” it’s advisable to create a dedicated toggle helper for each input.

If you would like to know how to create a toggle helper then please click here.

:film_strip: Scenes - Scripts To Turn OFF

If you have selected a scene or a script to be turned ON above in “Lights - Switches - Scenes - Scripts” or below in “Night Lights,” and you would like it to be turned OFF after the time delay, then you must create a scene or a script with everything OFF and enter it here. See below example.

More information on scenes and scripts please click here

:hourglass_flowing_sand: Time Delay

The time delay setting dictates how long the lights, switches, scenes, and scripts will remain active after all triggers have returned to their inactive state, effectively initiating the countdown to turn them off. Additionally, the time delay also acts as a buffer zone between trigger events, preventing the lights, switches, scenes, and scripts from turning off immediately when the trigger is deactivated. If you find that your lights are turning off and then back on again too quickly, consider extending the time delay. In cases where multiple trigger sensors are used and adjustments to the time delay aren’t effective, grouping the trigger sensors may be necessary. Click here to learn more about grouping trigger sensors.

:white_check_mark: Light Control Options

This allows you to select what option you would like to control in your light entity.

  • Brightness – Your light must be able to support brightness control by being able to dim the light in Home Assistant.
  • Transition – If your lights support brightness or colour temperature then this is the time it will take to transition to the next state. A state change can be from OFF to ON, from ON to OFF, from normal lights to night lights and from night lights to normal lights.
  • RGB - Your light must be able to support RGB colour by being able to adjust the colour in Home Assistant. You can choose RGB, RGBW or RGBWW.
  • Colour Temperature - Your light must be able to support colour temperature by being able to adjust the colour temperature in Home Assistant. Some LED lights that can change colour may also support colour temperature.

For each option you select you also have the ability to adjust the setting. More information is next to each setting.

If you have selected an option and your light doesn’t support it then the light will simply just turn ON.

:balance_scale: Dynamic Lighting

This option aims to make continual adjustments in your lighting setup by modulating brightness according to floating lux values or adapting colour temperature and brightness based on the sun’s changing elevation. Choose from eight preset options available in the dropdown menu.

1 - Lux Controlled Brightness
2 - Lux Controlled Brightness Inverted
3 - Sun Elevation Lighting - Colour Temp
4 - Sun Elevation Lighting - Brightness
5 - Sun Elevation Lighting - Brightness Inverted
6 - Sun Elevation Lighting - Colour Temp + Brightness
7 - Sun Elevation Lighting - Colour Temp + Brightness Inverted
8 - Sun Elevation Lighting - Colour Temp + Lux Controlled Brightness

If you would like more information on dynamic lighting then please click here.

:pause_button: Trigger Sensor By-pass

The by-pass allows you to regain manual control your lights, switches and scenes. When you turn ON the by-pass the automation will be paused. When you turn OFF your by-pass the automation goes OFF pause. For the automation to work correctly the by-pass entity cannot be included in, “Lights - Switches - Scenes - Scripts” and or “Night Lights” selections.

If you don’t have a physical switch to use as a by-pass you can create one in Home Assistant that will allow you to use the by-pass. If you would like to create a by-pass switch in Home Assistant then follow the steps below.

How to Create a Bypass Without Using a Physical Switch and Add It to a Dashboard:

  1. Navigate to Settings > Devices & Services > Helpers.
  2. Click on the “Helpers” tab, then click “+ CREATE HELPER” and select “Toggle.”
  3. Enter a name for the helper, such as “Sensor Light Bypass,” and click save.
  4. Return to the automation settings.
  5. In the “Use The Bypass Options (Optional)” section, select an option you’d like to use.
  6. In the corresponding “Bypass Switch” field, search for and select the name you created earlier (e.g., “Sensor Light Bypass”).
  7. Click save to apply the changes.

How to Add a Bypass Switch to a Dashboard:

  1. Open your dashboard and click “Edit dashboard.”
  2. Click “+ ADD CARD,” then choose “Button” or “Entities.”
  3. In the entity field, search for the name (entity) you created earlier, such as “Sensor Light Bypass.”
  4. Click save to add the card.
  5. Click “DONE” to finalize the changes.

You now have a “Sensor Light By-pass” switch to disable the trigger sensor of your sensor light automation. :tada:

There are also a few extra by-pass settings to set when using this option. More information is next to each setting.

By-pass 101 - For more information on the by-pass then please click here.

:infinity: By-pass Auto OFF

This is used when you turn the by-pass ON and you would like the by-pass to automatically turn OFF in a set time delay.

It can also be used as a timer to turn the lights ON and then OFF if you have chosen to use “Enable the By-pass - Turn lights ON”. When you turn ON the by-pass it will turn ON your light. When the by-pass turns OFF in its set time delay and the trigger is OFF it will turn your light OFF.

:scroll: Global Conditions

All the conditions are global and can work alongside with the other conditions. You can select one or all of them but if enabled each condition must pass for the lights, switches or scenes to turn ON. Example: If you enable all of them and one of them has not been met, then the automation will not run.

Sun, ambient & time can also trigger your automation. This will only happen when the “trigger Sensor” is ON at the time the sensor crosses over it setting. Example: If your motion sensor is ON (motion detected) and you are using the sun as a condition, if the sun is above the “Sun Elevation” setting the light will be OFF. If the sun then crosses from above to below the “Sun Elevation” setting then the light will be turned ON. The same theory applies for ambient and time and also works for turning your lights ON and OFF.

  • Sun - Can trigger the automation if the main trigger is ON*
    This option is used to add a condition that only allows the automation to run when it is dark or below the ‘Sun Elevation’ settings.

    I initially considered using Sunset and Sunrise, with a time offset but Home Assistant recommends using sun elevation for more consistent performance throughout the year. Following their advice, I opted for sun elevation. This is because the actual light level differs when using a fixed time after sunset or sunrise during winter versus summer. By setting a sun elevation, you achieve consistent light levels throughout the year.

    If you would like more information on this and how to set it up correctly then please click here.

  • Ambient - Can trigger the automation if the main trigger is ON*
    This option is used to add a condition that only allows the automation to run when it is dark or below the ‘Ambient’ settings.

    If you’re seeking more detailed information on the ambient settings, feel free to click here.

    If you would like to use 2 or more ambient light sensors and would like to know how to set this up correctly then please click here.

  • Time - Can trigger the automation if the main trigger is ON*
    This option is used to add a condition that only allows the automation to run between the start time and end time settings on the selected weekdays.

    If you’re seeking more detailed information on the time settings then please click here.

  • Device Tracker
    Home Assistant can track the location of your devices (such as mobile phones) within a designated zone via the mobile app device tracker.

    To utilize this option, you need to set up a zone and configure your devices for tracking in Home Assistant. There are two enable options available; “Zone” tracks all devices within the zone, while “Zone + People” allows you to track individuals within a zone.

    This feature can be particularly useful if you have pets triggering the sensor, turning your lights ON and OFF when no one is home.

:first_quarter_moon_with_face: Night Lights

Night lights allow you to set different lights, switches, scenes or scripts by using a entity state, time or sun condition to choose when these lights will be active.

While some settings are similar to those of normal lights, night lights offer additional options tailored to nighttime lighting control. For further information on night light settings that resemble those of normal lights, please review the details provided above. However, for the unique settings exclusive to night lights, please see below.

  1. Night Lights - Use The Light Control Options

    • If lights are ON, adjust the lights when crossing over

    Selecting ‘If lights are ON, adjust the lights when crossing over’ option ensures that the light control settings will be applied to any lights that are already ON during the transition from normal lights to night lights and vice versa.

    If the ‘If lights are ON, adjust the lights when crossing over’ option is not selected, lights that are already ON when transitioning from normal lights to night lights will remain in their current state. This allows for situations where you may want the lights to stay on later at night or during gatherings without transitioning to night mode immediately. However, once these lights are turned OFF, the night mode settings will be applied the next time they are turned ON. While this option may suit some areas, it may not be preferred everywhere, providing you the flexibility to choose your desired scenario by simply ticking a box.

    Regardless of whether this option is selected or not, if any lights are OFF during the transition from normal lights to night lights and their settings differ, they will either turn ON to the specified light control settings or turn OFF, depending on the configuration.

    • Yes - Manage OFF script when crossing over

    Selecting ‘Yes - Manage OFF script when crossing over’ is beneficial for scripts containing if-then-else actions that toggle various functions on and off during the transition from normal lights to night lights and vice versa.

    If you’re seeking more detailed information on scripts with a working example and would like to know how to set this up correctly then please click here.

  2. Night Lights Conditions

    If you choose to “Enable entity state option” the night lights will be active when the selected entity is ON. If you choose to “Enable time option” the night lights will be active during the set time period. If you choose to “Enable sun elevation option” the night lights will be active when the sun is below the “Sun Elevation” setting. You can enable both conditions if you like but they both must be met for the night lights to work.

    Note: Night lights will still have to pass all the global conditions set for normal lights.

    For more information on the entity state, then please click here.
    For more information on the time settings, then please click here.
    For more information on the sun settings, then please click here.

    Here’s a helpful tip: If you prefer softer, dimmer lights when using the bathroom at night, you can utilize the ‘Night Lights’ feature. Simply configure one or more of the night lights conditions to activate during your typical sleeping hours. Then customize your light settings to your preference. Now, whenever you get up during the specified time period at night, your lights will automatically adjust to provide the desired ambiance.

Hope this helps to explain some of the settings :face_with_monocle:

Enjoy

Blacky :smiley:

Back to FAQ: Click Here

5 Likes