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

First of all, thanks for this great Blueprint… I love it!
My lovely wife has a question (request) about the blueprint.

We have 5 motion sensors here in the house, and the lights turn on with the “Use The Dynamic Lighting Options (Optional)”, so the lights changes during the day.
All motion sensor have a 1 or 2 minute time periode, because the sensors are all in areas that you just pass through. So normally you wont stay long in these areas.

Sometime though, my wife wants to clean the areas, and then she wants the light to go on with full brightness, and that the stay on longer (lets say 5 minutes).

Is there a way to set this up in de blueprint? I did see the option “Use The By-pass Options (Optional)”, but as far as I can see, I can only change the delay, and not the brightness value…

I really hope that the option is there, or can be build in. It would be super helpful.

@Hassio

Thanks for your kind words.

For this I would do this and see if it works for you.

  1. Create a toggle helper maybe call it “Cleaning”. FAQ shows you how to do all this.
  2. Use by-pass option 3 Keep current state and enter in the toggle helper “Cleaning”.
  3. Install this new blueprint :gear: Turn Light, Switch or Scene On & Off with Trigger Conditions
  4. Enter in all the light you would like to trun ON in the new blueprint and set your brightness.
  5. Enable “Use The Entity State Option (Optional)” and enter in your by-pass toggle helper “cleaning” you use for by-pass in the sensor light option 3.

Now when you tun on the by-pass the automation will be disabled and turn on all the lights in the new blueprint.

TIPS:

  1. In the sensor light blueprint you can use the by-pass auto OFF that may help you.
  2. You can use the same toggle helper “cleaning” in all your sensor light automations and in the one automation using the new blueprint just add all your lights… then when cleaning the whole house goes ON with one toggle.

Hope this helps you.

Blacky :smiley:

1 Like

thanks you for the quick reply.

But from what I can read/understand/see, I only have a brightness option there right? I also want to set the Kelvin to 4000.

Is the option there somewhere, because I cant find it.

Hi, thanks for the response. I just tried again. First re imported the blueprint to be sure up to date. This time it worked right.

Great work!

@Blacky

For some reason the motion sensor doesnt work at all with these settings.
I did look at all settings, but cant find the problem why it doesnt work.

EDIT:
If I turn on the cleaning toggle, the light is going to 100%, even if there is no motion.
When I turned the cleaning toggle off, the light turns off and the motions sensor started working again. So

  1. The settings are not right, or…
  2. I didn’t mention that the settings should only work when there is motion. (also the cleaning mode

So if the cleaning toggle is On, (and) there is motion detected…The light should go to 100% brightness and 5000 Kelvin. If the Cleaning toggle is Off, the normal motion sensor behavior should be triggered.

@Blacky Thanks again for this amazing tool! I have it set up in several rooms and it is working perfectly, but I’d like to add in one extra level of complexity in our family room when we watch TV. Currently, I have two lamps that turn on/off with occupancy and can be interrupted by a switch. What I would like to do is have one of the two lamps turn off when the TV is turned on since it causes a glare. I’m thinking I might need a second virtual switch in HA that is activated by the TV turning on and will interrupt the blueprint so the lights are no longer controlled by motion. Is that a viable approach? I’m at the edge of my HA abilities, so any suggestions from the community would be appreciated.

Thank you for the this blueprint, struggling with one question I cannot find the answer to. I want to use the ambient option to only turn lights on when it is dark. I am however using a binary sensor that just provides a ON/OFF instead of a Lux value.

Can I use this type of sensor? The blueprint seems to only select luminance types

Nice one, thanks for letting us know.

Blacky :smiley:

@Hassio

If you are not using night lights then use the “cleaning” in “Enable entity state option” option for night lights. Then set up your lights as required under night lights.

.

If you are using night lights then you will need to create another automation useing this blueprint and have your “cleaning” toggle the automations. Like this;

  1. In the main normal mode automation by-pass option 3 add “Cleaning” helper.
  2. Create a new template binary sensor go to helpers / create helper / template / binary sensor / in states add this. Let name this “Cleaning Lights”.
{{ is_state('input_boolean.your_cleaning_helper', 'off') }}
  1. Create your 2 automation with your lights as required.
  2. Then add then new template binary sensor (Cleaning Lights) into your 2nd automation by-pass option 3.

Now when you turn ON your “cleaning” helper your main automation will be disabled and your “Cleaning Lights” will be turned OFF enabling your 2nd automation activating your cleaning mode you would like.

Let us now how you go.

Blacky :smiley:

@kman42

First you need HA to know your TV is ON or not. Some TVs have a integration or something that works for HA. If not a smart plug can do this. If you use a smart plug then create a template binary sensor using this code. go to settings / devices & services / helpers tab / create helper / template / binary sensor / add your name (lets call it “TV ON”) and in “state template” use this code adding your smart plug entity in and adjusting the 85 to your requirements (when TV is ON/OFF check power and adjust).

{% if states('sensor.your_power_sensor_here')|float > 85 %}
  on
{% else %}
  off
{% endif %}

If you are not using night lights then use the “TV ON” or you TV may have a state when it is ON already and you didn’t need to create the template sensor using a smart plug… what ever it is use it in “Enable entity state option” option for night lights. Then set up your lights as required under night lights and you are done.

If you are using night lights see above post for a rough guide as it is the same way… create another automation …

Let us know how you go.

@fvhemert

Welcome to the community :wave:

If this is the case then you will need to use your binary sensor in the by-pass option 2. Your binary sensor has to be OFF when you would like the lights ON. Not sure if you can edit your binary sensor to do this. If not create another one using your binary sensor you have making it work the opposite way like this.

Go to settings / devices & services / helpers tab / create helper / template / binary sensor / add your name (lets call it “LUX Dark”) and in “state template” use this code

{{ is_state('input_boolean.your_binary_sensor_here', 'off') }}

Then add “LUX Dark” to the by-pass option 2

Let us know how you go.

Blacky :smiley:

@Blacky thanks for the quick reply. I’ll give it a try this weekend and post the results.

Thank you again for the quick response.

The nightlight option is working :slight_smile: , but the problem is that I do want to use the nightlight option later on.

The other option is (for me) to much a work around, and I am afraid I cant recall the automation later on. I know that this is not your problem, but I am not a everyday poweruser of HA. So I do want to make things as understandable as possible for myself.

May I brutally ask if there is a plan to add the Kelvin (and maybe the transition) option to the bypass option? That would solve all the problems. And I really do think there are more people who want to override the settings (bypass) with other settings then the original, and not only change the delay.

There are a ton of options you can use the bypass option for, if you can change the brightness and Kelvin.

@Hassio

Nice one

This is a problem for me to as it keeps growing and has so many scenario / options to keep track of.

This will grow the automation. Then there so many more different options. The best way is to provide the by-pass trigger then the user can go in any direction they like.

Blacky :smiley:

FAQ: How to use scenes and scripts

Scenes or scripts offer an effective means of providing additional customization for your spaces within Home Assistant. They serve as versatile tools that allow you to define and automate specific states or sequences of actions for various devices and components within your smart home environment. By utilizing scenes or scripts, you can create tailored configurations and behaviours that align with your preferences and requirements. Whether it’s adjusting lighting, setting the ambiance, controlling devices, or orchestrating complex sequences, scenes and scripts offer a high degree of flexibility and control, empowering you to personalize your smart home experience to suit your unique needs.

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

Scenes

Scenes can be particularly useful when you want to set a specific colour for your lights, especially because the lighting control options don’t offer this feature. The controlling behaviour to adjusting your light colours can vary significantly across different manufacturers and platforms, leading to confusion. Using scenes eliminates this guesswork, as Home Assistant will handle everything for you. Additionally, scenes can help unify lighting settings, even if you have multiple lights with different formats, ensuring consistent colour representation when turning them on.

Scripts

Scripts offer a versatile approach if you want to customize which lights or switches turn ON or OFF based on your specific requirements. They can activate different lights or switches depending on the time of day or set a soothing glow light when turning OFF during night lights. The level of creativity is entirely up to you. Below is a basic automation examples to kick-start your creative inspiration.

Scenes - Scripts To Turn OFF

In Home Assistant, scenes and scripts are invaluable tools for automating tasks and streamlining operations by activating predefined configurations across various devices. Unlike individual entities like lights or switches, scenes and scripts are not inherently designed to be “turned OFF” because they represent preset states or sequences rather than ongoing statuses.

To address this, supplementary scenes or scripts are created to restore the environment to its desired state once the automation sequence is complete. These additional commands serve as reset mechanisms, ensuring that the environment returns to its default or preferred settings, such as turning OFF lights or switches, once the automation ends. Once the desired scene or script has be created entering it into “Scenes - Scripts To Turn OFF” will facilitate this action.

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.

Toggle helpers also assists when crossing over from normal lights to night lights and vice versa, when using the ambient options and setting the ambient site conditions to ‘Yes’, or when Home Assistant restarts.

Scenes & Scripts - Crossing Over From Normal Lights To Night Lights

Having a toggle helper for scenes & scripts assists for the smooth operation when crossing over from normal lights to night lights and vice versa when a scene or script are ON. You will still need to enable “If lights are ON, adjust the lights when crossing over” in the night lights “Light Control Options” for your scenes and scripts to transition to their new state.

We can create scripts for use in ‘Scenes - Scripts To Turn OFF’ to apply different off settings based on whether normal lights or night lights are activated. To ensure smooth operation when crossing over between normal lights to night lights and vice versa, and if your lights, switches, scenes, or scripts are OFF, we’ve included an input selection in ‘Night Lights - Use The Light Control Options’ labelled ‘Yes - Manage OFF script when crossing over.’ Enabling this option accommodates the different OFF settings you may have in your script when transitioning from normal lights to night lights and vice versa. When this happens the script gets activated applying your script settings.

Automation Example

1. Setup script and scenes to provide a night glow when night lights are activated.

This automation example is particularly useful for households with stairs, providing a gentle, low-level glow throughout the night (night glow). Families with young children often find this comforting, as it creates a soft, safe ambiance. It also work realy well with your outdoor lighting. It would be one of the most common how to request I get asked.

In this example, we have chosen a set of brightness % levels, but feel free to adjust them according to your preference. You can also customize the light colour and/or colour temperature. Additionally, you are not limited to controlling just lights; you can also toggle switches or control any other device you like.

What will happen when setting up the automation this way.

During normal lighting conditions, your lights will turn ON at 100% brightness and turn OFF when the time delay ends. When night lights are activated, your glow lights will be set to 10%. Then, when the automation is triggered, your lights will adjust to 50% brightness and then return to 10% when turning OFF. When the night lights are deactivated, your lights will turn OFF.

We will need to create 2 scenes, 1 script and 2 toggle helpers. It is very easy to do :sparkles:

  • Scene 1 = 100% brightness for normal lights
  • Scene 2 = 50% brightness for night lights
  • Script 1 = Turn OFF during activation of normal lights and 10% brightness during activation of night lights.
  • Toggle Helper 1 = Lights Scene & Script Helper
  • Toggle Helper 2 = Night Lights Scene & Script Helper

Creating a Toggle Helper

Go to Settings / Devices & Services / click on the “Helpers” tab at the top / create helper and select toggle.

Input the name you would like to call it and click create.

28

Then just repeat the proses for the second toggle helper.

Creating a scene

Go into Settings / Automation & Scenes / Click on the scene tab at the top / click “Add Scene” and enter in a name you would like to call it.

Then add your entities in. We will add in a light entity and set the brightness to 100% , then click save.

We will do the same process creating another scene with the light at 50% brightness.

Creating a script

Go into Settings / Automation & Scenes / Click on the scrips tab at the top / click “Add Script” and click create new script, then enter in a name you would like to call it.

We will then click the “Add Action” button.

In the search action start typing "if’ and the “If-then” action will appear. Select it.

First we will select the “Add Condition” button.

For night lights in this automation we are using the “Entity State” condition, so in the search action start typing "state’ and the “State” action will appear. Select it.

If you are using a different condition other than state for night lights then choose from the below 2 steps as to the condition you are using:

  • If you are using Time as a night light condition type " time" in and select it. Then enter in for “After” = Start and “Before” = End settings in the night light time conditions.
  • If you are using Sun as a night light condition type " Numeric state" in and select it. Enter sun as the entity. Then using fixed number the “Above” = Rising and the “Below” = Falling settings in the night light sun conditions.

Then we will select the entity we used in the night lights condition and set the state to ON.

Then we will click the “Add Action” button in the “Then”.

In the search action start typing "light’ and the “Light: Turn on” action will appear. Select it.

Then we are going to enter in our light, set the transition to 4 (Very important for smooth operation) and our brightness to 10%. Once done we will select the “Add Else”

Then we will select the “Add Action” under “Else”

In the search action start typing "light’ and the “Light: Turn off” action will appear. Select it.

Then we are going to enter in our light, set the transition to 4 (Very important for smooth operation) and click “Save Script”

Now we have created our script :tada: :partying_face:

Setting up the automation

You will need to input your trigger and then input your scene 1 at 100% as shown below. We have also created a toggle helper because we are using scenes in “Lights - Switches - Scenes - Scripts” and entered it into “Scenes & Scripts - Toggle Helper”. We then added our script into “Scenes - Scripts To Turn OFF”.

In the “Light Control Options” we set the transition to 2 and 5 (Very important for smooth operation)

Down to night lights we have enabled it, entered in our scene 2 at 50%. We have also created another toggle helper because we are using scenes in “Night Lights” and entered it into “Night Lights - Scenes & Scripts - Toggle Helper”.

In the “Night Lights - Light Control Options” we set the transition to 2 and 5 (Very important for smooth operation). We have also selected “Yes - Manage OFF script when crossing over”. This will apply the 10% when night lights condition entity state turn ON even if the lights are OFF.

Click “Save” and you are done :partying_face: :tada:

Now during normal lighting conditions, your lights will turn ON at 100% brightness and turn OFF when the time delay ends. When night lights are activated, your glow lights will be set to 10%. Then, when the automation is triggered, your lights will adjust to 50% brightness and then return to 10% when turning OFF. When the night lights are deactivated, your lights will turn OFF.

I hope this explanation helps you understand how scenes and scripts are utilized in the blueprint automation process.

Enjoy

Blacky :smiley:

Back to FAQ: Click Here

Back to “The Settings & Best Practice Guidelines” Click Here

4 Likes

Great! Thank you. I will try it today

Is there any way to have the blueprint ignore lights that have become unavailable? Sometimes my lifx bulbs drop off the net temporarily and the automation fails because of this

Kitchen Lights: Choose at step 1: default: Parallel Actions for dynamic lighting: parallel 1: Choose at step 7: Set the Sun Elevation Lighting - Colour Temp + LUX Controled Brightness for the normal lights switch: Dynamic Lighting Control: Choose at step 1: Set the dynamic lighting lux brightness and dynamic sun elevation colour temperature for the normal lights switch: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'brightness'
Kitchen Lights: Choose at step 1: default: Parallel Actions for dynamic lighting: parallel 1: Choose at step 7: Set the Sun Elevation Lighting - Colour Temp + LUX Controled Brightness for the normal lights switch: Dynamic Lighting Control: Error executing script. Error for choose at pos 1: Error rendering data template: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'brightness'
Kitchen Lights: Choose at step 1: default: Parallel Actions for dynamic lighting: parallel 1: Choose at step 7: Set the Sun Elevation Lighting - Colour Temp + LUX Controled Brightness for the normal lights switch: Error executing script. Error for repeat at pos 1: Error rendering data template: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'brightness'
Kitchen Lights: Choose at step 1: default: Parallel Actions for dynamic lighting: parallel 1: Error executing script. Error for choose at pos 7: Error rendering data template: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'brightness'
Kitchen Lights: Choose at step 1: default: Error executing script. Error for parallel at pos 4: Error rendering data template: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'brightness'

@johnwang16

Hi John, welcome to the community.

Can you confirm that your lights have a attribute brightness. Go to developer tools / states tab and search all your light you are using in the automation for the attribute brightness as shown below.

Blacky :smiley:

Thanks, @Blacky, I’m going to try this approach this weekend. Which post are you referring to when you say “see above post”? Here’s a summary of what I think you are suggesting. Note: I am currently using the night light feature.

  1. Create a toggle helper called “TV ON”
  2. Use by-pass option 3 in my existing Sensor Light automation and enter the “TV ON” helper
  3. Create a new template binary sensor. Go to helpers / create helper / template / binary sensor / in states add this. Let’s name this “TV Lights”.
{{ is_state('input_boolean.TV_ON_helper', 'off') }}
  1. Create 2nd automation with lights as required. Do I use the new Turn Light, Switch or Scene On & Off automation or another instance of the Sensor Light automation?

  2. Add the new template binary sensor (TV Lights) into the 2nd automation by-pass option 3.

Do I have this right?

Thanks!

thanks! Yes, the light does have a brightness attribute. Here’s the list when it’s online. I can reproduce the exception if I unplug any light such that it’s unavailable

min_color_temp_kelvin: 2500
max_color_temp_kelvin: 9000
min_mireds: 111
max_mireds: 400
effect_list: effect_colorloop, effect_pulse, effect_stop
supported_color_modes: color_temp, hs
color_mode: color_temp
brightness: 176
color_temp_kelvin: 4999
color_temp: 200
hs_color: 27, 19.257
rgb_color: 255, 227, 205
xy_color: 0.373, 0.349
effect: null
friendly_name: Kitchen Sink
supported_features: 36