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

Hey Blacky, thanks again for your Blueprints! They are working fine in the hall and bathroom with a simple motion sensor. I’m now trying to get the Living Room setup to work, which is a bit more complex. I used to have a Node-RED flow that just waits for the LUX values from my Hue light sensor that is behind a window. That was essentially my trigger. It looks like that can’t be a trigger in this Blueprint, or am I missing something like a workaround for this? Thanks! :slight_smile:

1 Like

Hey, first of all thanks for the efforts in creating this awesome automation and the nice documentation!

I have a very similar problem as TheAutomator. Let me explain: in my living room, I want to use dynamic lighting. I also have a lux sensor. When I am in the living room for a real long time, and the lux sensor reading passes the lux thresholds set in the dynamic lighting tab, it won’t function as a trigger it seems. Only after I leave the room for the motion sensors to report “clear” it will work after entering the room again. Since I already configure the necessary parameters in the dynamic lighting tab, I somehow assumed that this would function as a trigger, too. Maybe there is another way to achieve this? I tried adding the sun state to the trigger sensor, but this will also not work since then the lights would be on no matter what until the sun sets again…

I am certain there is a solution to this, since I believe that this is a common use-case, but I wasn’t able to figure it out alone unfortunately. I hope someone can help.

(Btw I really tried really hard to search this topic, but the search function is quite restrictive when it comes to search terms. Even the simplest terms would yield 0 results.)

Best,
Chris

First, you’ll need to set up a trigger. Create a schedule helper that starts well before dark and ends at the time it is light. Example 4pm to 10am.

Once your trigger is set up, use the ambient settings to adjust your lights to 10%.

In night lights, use your motion sensor as the state condition and set the lights to 100%. Make sure in Night Light Control you select If lights are ON, adjust the lights when crossing over.

Or you can look at my :high_brightness: Smart Light - Entity - Sun Elevation - Ambient & Time Triggers blueprint with the same set up but you just need to use the ambient as the trigger.

Having a delay OFF for your motion sensor will make it work better.

Blacky :smiley:

@mariomaz87

You can also see this template example that too may help you click here but looks like you got it sorted.

Blacky :smiley:

@Hometoza

It might be worth trying to redo the automation from scratch, but I suggest that the issue may lie with one of the devices. When the problem occurs, check the trace line to see which trigger was activated. This can help you pinpoint the exact cause of the issue.

Blacky :smiley:

@TheAutomator

The LUX value is a condition but it will trigger the automation if the trigger sensor is ON. Example, if a motion sensor is ON and lux is high the light will be OFF but if the lux sensor goes low then the light will come ON.

If you would like to trigger on lux values then take a look at my :high_brightness: Smart Light - Entity - Sun Elevation - Ambient & Time Triggers blueprint. I use this with sun elevation but lux value is similar, it will turn the light ON when sun elevation goes below falling value you could use lux value and then a 11pm I have it turn the lights OFF but you could use the lux value to turn the light OFF. You can mix and match what you would like.

I not sure exactly what you are trying to do but hopefully it may point you in the right direction.

Blacky :smiley:

1 Like

@charlydelta

Hi Chris,

Looks like you may have a brightness of 0%. If so you will need to create a helper and enter it into Dynamic Lighting - Toggle Helper. If you have done this already 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:

1 Like

Thanks for a GREAT blueprint with a lot of time and effort invested in it!

Short question; if my light already are in the state “on” and I don’t wan’t the autimation to run and then after 2 minutes turn the light off (when it from the beginning already was on), how do I achevie it in bypass section. I reallt don’t get it :crazy_face:

I think in this case it required to set any light to night mode of script. I will try explain more clear
Day script:

  1. trigger1
  2. light1
  3. night lights - empty
  4. Enable the night lights options - true, Enable entity state option - true. Add state for night mode
    In this case when “Night state” is activated, script will be not working because no “night lights”

Night script:

  1. trigger2
  2. lights - empty
  3. night lights - light1
  4. add same night settings as for day script

For this situation it required to add any light to second point of “Night script”

@TheLordVader

If you would like to disable the automation so you can manually turn the light ON and OFF then click here for the FAQ on it.

Blacky :smiley:

No that’s not what I ment.

I mean if the light is on before the automation triggers, it should stay on :nerd_face:

@SeRG1k17

I have developed a template binary sensor for you so you can use 2 motion sensors and depending on your night mode entity state (ON / OFF) it will use day or night motion sensor :wink:. Then you can use one automation.

To create a Template binary sensor, follow these steps:

  1. Navigate to Settings > Device & Services > Helpers tab at the top.
  2. Click the Create helper button.
  3. Select Template and then choose Template a binary sensor.

Next, provide a Name that you like and Device class = motion. If applicable, you can link this template to an existing device so it appears under that device’s details but you probably wont do this.

In the State template field, add the code below, replacing input_boolean.night_mode with your entity ID used to activate night lights, binary_sensor.motion_sensor_for_night is the motion sensor entity ID used for night time and binary_sensor.motion_sensor_for_day is the motion sensor you would like to use during the day.

Once you create this template sensor use it in the blueprint trigger input. You then just set up one automation to do what you would like and the motion sensors will change depending on your “Night state”. Use the same input_boolean.night_mode entity ID in the Night Lights - Entity State

{% if is_state('input_boolean.night_mode', 'on') %}
{{ states('binary_sensor.motion_sensor_for_night') }}
{% else %}
{{ states('binary_sensor.motion_sensor_for_day') }}
{% endif %}

Hope this makes sense. If you are unsure could you provide us your YAML of the automation and your 2 motion sensor entity ID’s.

Let us know how you go.

Blacky :smiley:

3 Likes

@TheLordVader

The issue is that the automation keeps triggering even if the light is already on. When the light is off, the automation triggers and turns it on. If it triggers again while the light is on, it resets the delay, and this cycle continues until no more triggers happen and the delay passes. The challenge is that you can’t simply add a condition to check if the light is already on to stop the automation because of how the automation is structured.

I have a method that might help: If you manually turn the light on, it will activate a template binary sensor that can be used to bypass and disable the automation. However, if the automation turns the light on, the template sensor won’t activate, allowing the automation to continue running. It’s not a perfect solution and has some limitations, but it might be what you’re looking for.

If this sounds useful and you’d like to know how to create the template binary sensor, just let me know, and I’ll provide the steps.

Blacky :smiley:

1 Like

Some of my lights are dimmers which support brightness. How can I achieve my use case?

Between 8pm and 5am I’d like some lights to come on at 20% brightness. These lights are usually all off. Do I understand correctly that home assistant can’t change the brightness while the light is off? How would I use this automation to accomplish this?

The only thing more amazing than this blueprint is the community support that drives it. Wow!

EDIT: I saw some other blueprints that had similar features. For my use case ^ I want it to be time driven in some cases and sun driven in others. Is this the right blueprint for me?

1 Like

Hey Blacky, thank you so much for your time and support!

You are absolutely right, it is at 0% and I do not have a toggle helper. I read that actually, but from the description I couldn’t figure out what it implies or means at the beginning, and after the automation worked well, I assumed it is optional-ish…. When I noticed the problematic behaviour later I didn’t assume it is really related to my problem, since it mentiones missing light entities etc (not a problem I have - for now at least). I now googled a bit, but I still don’t have a clear image of what is required from me.

What is a toggle helper? Is it a HA concept or is it a term specific to this blueprint (I found something related in HA docs, but i cannot connect the dots)? What does it look like implementation-wise (is it a script, a boolean, another automation, a template,…) and how should it behave so that I can achieve my goal?

I have some derived sensors for sunlight (based on elevation and Lux sensors in combination) that worked really well for my previous automations. I just registered it as additional trigger and condition, and it would work very well. If i click on the trigger helper input field in the blueprint, it gives me some switches I created, and the option to create a new one. If I create a new one, I end up with an input boolean. But this is not really what I had in mind - I don’t want to switch it on manually (at least that is what it looks like), but I want the automation to trigger using the parameters in the dynamic lighting tab (e.g., sun below certain elevation or current lux readings below threshold). And i cannot use my old trigger here for that, which would be a binary sensor (on=sunlight, lights off, off=no sunlight, lights on; at least thats how i used it previously).

I feel like I am missing something which is very obvious for everybody else (sorry for that!), but I dont really understand what I am required to do. It reads that it is imprtant, that it is recommended and I need it, but not really how I can accomplish it.

Thanks again for the very kind and quick support, it is very much appreciated! That, and the awesome blueprint!

Sorry for the lengthy post, I just hoped it would help identifying where the error in my logic is.

Best,
Chris

@charlydelta

Hi Chris,

I am all good with long post as it can give me a better understanding.

A toggle helper in Home Assistant is like a virtual switch that can be controlled manually or through automations. It helps track or trigger events in your smart home system. In our case, with dynamic lighting, we use a toggle helper to monitor whether an automation is still running, even when the light brightness is set to 0% (which effectively turns the light off). This way, the toggle helper provides a clear indication that the automation is active, even though the light is OFF.

In general, toggle helpers are useful for controlling or tracking any binary state in Home Assistant, like ‘on/off’ or ‘enabled/disabled.’ You can use its state to control automations or any service that needs a switch to indicate whether something is running, whether it’s true or false. While toggle helpers can be used for a variety of purposes, I hope this gives you a better understanding of what they can do and how developers commonly use them.

Yes, you can create a Toggle Helper this way. While they’re also referred to as Input Booleans, that term can sometimes be confusing for users who are new to HA or automations. Toggle Helper is a more intuitive name, and it’s what HA now calls it in the UI.

To create a toggle helper, follow these steps:

  1. Navigate to Settings > Devices & Services > Helpers (tab at the top).
  2. Click the Create helper button.
  3. Select Toggle.
  4. Enter a name for your toggle helper and choose an icon, if desired.

There are many types of helpers you can create in Home Assistant. By following steps 1 and 2, you’ll see a variety of helper options to choose from. All the helpers you create can be managed in the same location, as outlined in step 1.

As already stated above, HA has added a recent feature to help streamline the process. Within the blueprint, during input selection, you can now create a new toggle helper directly by scrolling to the bottom of the list of entities and selecting Create a new Toggle Helper. This avoids the need to leave the blueprint editor. The toggle helper created this way is exactly the same as the one created via the steps above, making it easier to incorporate into your automations.

Once you create a toggle helper and add it to an automation, you don’t need to manually turn it ON or OFF… the automation will handle that for you. If you add the toggle helper to a dashboard, you’ll see it switch ON when the automation is running and OFF when it’s not.

Creating the toggle helper and selecting it in this input is all you need to do. Note that this toggle helper should be dedicated to this one automation only and shouldn’t be used for anything else. If you create another automation, you’ll need to create a new toggle helper specifically for that automation. You only need to create this toggle helper if the minimum brightness value is set to 0%.

Hope this helps you understand helpers and why we use them.

Blacky :smiley:

1 Like

Maximum ON Time even if Triggers do not clear?

I use door/window sensor in some scenarios, but sometimes the door isn’t closed, so the light never turns off automatically. Is there an elegant way to turn off the lights even if the triggers never clear?

@SpaceGlider

In the FAQ I show examples of template sensors. This is the one that would best suit your needs. It will auto turn OFF. Once created you sue it in the trigger rather than your door/window sensor. Click Here

You could also create (add to this template sensor) a template binary sensor that has auto OFF with it turning OFF if the window/door turns OFF.

Note: I also have other blueprints that handle this like :door: Closet, Pantry, and Cupboard Lighting just depending on what you are trying to do.

Blacky :smiley:

1 Like

I’m new at setting up this blueprint, but it looks so amazing! I’m trying to have two lights switch.outside_front_porch_lights and switch.outside_garage_door_light turn on at sunset and turn off at sunrise. Here’s my yaml. What am I doing wrong?

description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    time_delay: 5
    include_sun: sun_enabled
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - sun_enabled
    night_lights:
      entity_id:
        - switch.outside_front_porch_lights
        - switch.outside_garage_door_light

Thank you!

Hi!
I’m trying this blueprint for the first time to replace my light automations.
I’m having trouble with the bypass. I want to use 2 different bypasses:

  1. Sleep mode: I turn this helper ON to prevent my pets to trigger the lights while I’m sleeping.
  2. Manual mode: I turn this helper ON to avoid lights from turning off, when I want to control them manually.

When I use them both simultaneosly the whole automations stops working, lights don’t turn on/off anymore.

Am I doing anything wrong here?