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

Hi @Blacky. After upgrading to HA 23.10I have experienced a problem with the light level when they are triggered by this automation. They seem to be set to 0% either when they are triggered to go off, or maybe when they turn on again (less likely), which leads to very dim lights, and very unhappy wife :sweat_smile:

Any thoughts on what to do, apart from downgrading to 2023.9?

This is the automation:

alias: Stuelys
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.stuesensor
    time_delay: 60
    ambient_light_sensor: sensor.stuesensor
    ambient_light_value: 400
    include_bypass: bypass_disabled
    light_switch:
      entity_id:
        - light.stuekommode
        - light.stuelampe_ny
        - light.stuevindu
        - light.stuespisebord
    ambient_light_options: ambient_light_option_disabled
    include_ambient: ambient_enabled
    after_time: "06:00:00"
    before_time: "23:59:00"
    include_time: time_enabled
    night_light_brightness: 100
    light_transition_on: 0
    light_transition_off: 0

I’m laying in bed right now (to much information
) , but thinking through the blueprint. I mentioned higher up about also supporting a manual switch in parallel to the sensor and I think I have cracked it.

Basically it forms 2 key parts, and I config option

Config the ability to add a switch, which in my case would be a toggle. Probably in the same form area as the sensor input.

Part 1: toggle light on
If presence is off, then this will force the light on
 presence will keep monitoring in parallel and when presence is detected and this loop will end as the presence sensor will take over

Part 2: toggle light off
If presence is on and you toggle the switch, then is will force the light off
 Once presence is off then this loop will end

Another option might be too have this as a separate blueprint that sits between the presence sensor + switch and your blueprint

I am trying to replace an automation that, between two periods of time, a light is set to 30% unless the light or nearby light has been set above that level. In which case the automation sets the light to the higher level. Is that something that can be done with this blueprint?

@petersv

Hi Peter, Thanks for providing your YAML. With your set up the automation is not controlling your lights brightness at all and it is within your lights that is doing this. If you would like this blueprint to control your light brightness then you will have to enable it and set your brightness. This would be the same if you are using night lights but I can see your not using this option. So you would need to select the “Light Control Options” as shown below.

Let us know if this works for you.

PS: I am having no problems with HA23.10.1

Blacky :smiley:

@Brad_Ford

Hi Brad, If you have a light switch on the wall to turn the light ON and OFF then;

Part 1 = Works. You can force the light ON if presence is OFF and the light will stay ON until presence is detected and then the automation will run.

Part 2 = Works. If presence is ON and stays ON (If you have multiple sensors then you need to group them) and you toggle the light OFF the light will stay OFF until presence goes OFF and back ON again, then the automation will run.

So it is already there, hope this helps you.

Blacky :smiley:

@potts-mike

No, the automation will not check any of your nearby lights and mimic them.

Interesting idea though.

You would have to create a template sensor to trigger the automation when your nearby lights go above X and then use scenes to do this. So you could do it but it would be set values and not a floating %. Scene would be 100% (or whatever you like) and your OFF scene would be 30%. If you then would like to turn it OFF between certain times then you would have to also use my :gear: Turn Light, Switch or Scene On & Off with Trigger Conditions blueprint with this one.

Blacky :smiley:

hi @Blacky
In which version of your incredible blueprint is the “it’s nighttime” helper used to indicate nighttime? It would really add a lot of flexibility.
Cheers :slight_smile:

Hi, danke fĂŒr die Tollen Blueprints. Die haben mir sehr weiter geholfen.
Besteht die Möglichkeit da noch eine weitere By-pass Options hinzufĂŒgen.
Ich habe Nachttischlampen die ich ĂŒber BerĂŒhrung einschalte, dann soll aber die Lampe die ich mit ĂŒber denn Bewegungsmelder eingeschaltet habe ausgehen und bleiben. Bis ich die Nachttischlampen wider ausschalte !
Ich kann das An oder Aus der Nachttischlampen aber nur ĂŒber denn Stromverbrauch feststellen.
Gibt es da eine Möglichkeit das zu machen.

Auch habe ich anscheinend einen Fehler, und zwar schalte ich mit Zwei Automatisierungen mein Flurlicht per Bewegungsmelder ein.
Einmal Sonntags bis Donnerstags von 22,30h bis 8.00h.
Einmal Samstag und Sonntags 0.30h bis 8.00h.
Wenn ich das aber so einstelle geht ab Freitag 0.00h das licht nicht mehr an, obwohl es bis 8.00h gehen mĂŒsste.

MfG Michael

@nicknol

It was added in version 4.3. If you update to the latest then it will be there.

Yes it is a realy nice feature that I use all the time. Below is where it is located in the blueprint.

Blacky :smiley:

@Rubberduck73

Hi Michael, thanks for your question. For the english speaking I will translate it.

No problem, your welcome. With your bedside lamps they must communicate with HA so when you turn them ON and OFF, HA knows they are ON or OFF. Once you have this then put the bedside lamps in the by-pass as shown below.

To German Translate

Kein Problem, gern geschehen. Ihre Nachttischlampen mĂŒssen mit HA kommunizieren. Wenn Sie sie also ein- und ausschalten, weiß HA, dass sie ein- oder ausgeschaltet sind. Sobald Sie dies haben, stecken Sie die Nachttischlampen wie unten gezeigt in den Bypass.

If using 2 automation then try not select the same day in both of them. Also there is no Friday selected.
Sunday to Thursday from 10.30 p.m. to 8 a.m.
and
Friday to Saturday 12:30 a.m. to 8:00 a.m.

To German Translate

Wenn Sie zwei Automatisierungen verwenden, versuchen Sie, nicht in beiden den gleichen Tag auszuwĂ€hlen. Außerdem ist kein Freitag ausgewĂ€hlt.
Sonntag bis Donnerstag ab 22.30 Uhr bis 8 Uhr morgens
Und
Freitag bis Samstag 12:30 bis 8:00 Uhr

Blacky :smiley:

@HannesDi

Sorry I have just realised I missed your post.

It is on the road map ahead. One way we can do this now is to use scenes. You can set all your lights up to any colour you like in a scene and then use the automation to turn your scene ON.

Blacky :smiley:

Thanks a million for pointing me to the right spot in the blueprint UI! and even more thanks for adding the feature!
Cheers

1 Like

I have been watching this blueprint for a very long time. I’m currently using EntityController. But I would like to switch to HA automation.

Do I understand correctly that I even have to create a helper so that the blueprint does not switch on a light if it is already switched on? That surprises me a little. This seems to be a standard function in many other blueprints: “Don’t turn it on (temporarily) if it’s already on.”

The problem is that in addition to the normal buttons (events only), you cannot make any switching via the web interface GUI.

Or have I misunderstood something?

Make the plunge and try it.

No, but the automation will run if a light is ON as that is what we are asking it to do. If you would like to stop / pause the automation then there are by-passes for this.

You can.

It is probably a bit tricky to get your head around it when you don’t use HA. The best way to understand is to try it. It can be a bit confusing at the start but HA have done a lot of work to make it extremely easy to get HA up and running from when I started using it. If your are unsure on how to set it all up, my recommendation would be to get the new Green or a Yellow from HA as it is all ready to go. In time you will upgrade but that is like anything.

@Herr.Vorragend take the plunge into HA, but word of advice TAKE IT SLOWLY, Start small and build it up, it is easier to get your head around it all, that way. There is loads of help in the forum with plenty of people that would be glad to help you.

Hi @andyblac und @Blacky thank you both very much.
We misunderstood each other. I’ve been using HA for several years. And quite extensive. I also create blueprints myself.

EntityController is a custom component to make it easier to implement such complex automations.

I’ll fight my way through the thread.
I think I misread something.
Thank you.

Hmm maybe it isn’t clear to me then

So I can use a single switch to turn the light on before the sensor, and then the sensor will turn the light off when I leave?

Which option sets this?

Yes

Yes if the trigger sensor is triggered it will turn OFF the light. If it is not triggered then the light will stay ON.

There isn’t an option it just works this way :wink:.

If you don’t want this to happen then you use a by-pass switch to turn the light ON / OFF / Pause State (you decide). Then the light will stay ON / OFF / Pause State even if the trigger sensor is triggered until the by-pass turns OFF. When the by-pass turns OFF the automation will evaluate the site conditions. You also have the option for a by-pass auto OFF, and you can also have a time delay you can set before the light will turn OFF when the by-pass turns OFF.

Blacky :smiley:

1 Like

FAQ - Dynamic Lighting Settings

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 nine 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
9 - Sun Elevation Lighting - Colour Temp + Lux Controlled Brightness Inverted

:warning: Please note:

  • Dynamic lighting options are designed specifically for light entities within the light domain. Switches, scenes, and scripts are not compatible with the dynamic lighting options.

  • When using dynamic lighting, the standard ‘Light Control Options’ are available based on your selections in the ‘Light Control Options’. For example, selecting ‘1 - Lux Controlled Brightness’ enables brightness control, while ‘Colour Temperature’, RGB, RGBW, RGBWW and ‘Transition’ remain active if also chosen. Note that ‘Transition’ is always operational if selected, but ‘Brightness’, ‘Colour Temperature’, RGB, RGBW and RGBWW may be inactive depending on your dynamic lighting choices.

Below are three expandable sections depending on what information you are looking for.

Lux Controlled Brightness Settings for Options 1, 2, 8 & 9 (Click Here to expand)

Option 1 & 8 “Lux Controlled Brightness”
This will constantly adjust your lighting brightness percentage to a floating lux value. For example, when it gets darker, your brightness will increase, and as it gets lighter, your brightness will decrease, as shown in Figures 1-1 and 1-2.

Option 2 & 9 “Lux Controlled Brightness - Inverted”
This will constantly adjust your lighting brightness percentage to a floating lux value. For example, when it gets darker, your brightness will decrease, and as it gets lighter, your brightness will increase. It works the opposite way to options 1 and 8. In the graphs shown below, rather than going from high to low, it will go from low to high, as shown in Figure 1-3.

:wrench: HOW IT WORKS

Figure 1-1
The graph below (Figure 1-1) shows the default settings. As the lux value decreases, the brightness increases, and vice versa.

With this setup, when motion is detected and the lux value is equal to or above 400 lux, the lights will turn off (if they were on) or remain off when the automation is triggered because the brightness is set to 0%. As the lux value decreases, the brightness will increase. The lights will start to come on at around 399 lux. I say ‘around 399 lux’ because some lights may require a 1% to 10% brightness setting to turn on, depending on your lights and controller. At 40 lux or below, the lights will be set to 100% brightness

The blue dotted line shows how to read the graph. At 200 lux, the brightness will be around 55%.

  • Max lux = 400 lux
  • Min Lux = 40 lux
  • Max Brightness = 100%
  • Min Brightness = 0%

Figure 1-2
The below graph (Figure 1-2) shows a different setup. In this example, are setting are:

  • Max lux = 500 lux
  • Min Lux = 200 lux
  • Max Brightness = 100%
  • Min Brightness = 60%

With this setup, when motion is detected and the lux value is equal to or above 500 lux, the lights will turn on at 60% brightness. As the lux value decreases, the brightness will increase. When the lux value is equal to or below 200 lux, the lights will be set to 100% brightness.

The blue dotted line shows how to read the graph. At 350 lux, the brightness will be around 80%.

Figure 1-3
The graph below (Figure 1-3) shows a different setup, specifically when using option 2, ‘Lux Controlled Brightness - Inverted.’ In this example, are setting are:

  • Max lux = 60 lux
  • Min Lux = 20 lux
  • Max Brightness = 100%
  • Min Brightness = 20%

With this setup, when motion is detected and the lux value is equal to or above 60 lux, the lights will turn on at 100% brightness. As the lux value decreases, the brightness will also decrease. When the lux value is equal to or below 20 lux, the lights will be set to 20% brightness.

The blue dotted line shows how to read the graph. At 40 lux, the brightness will be around 60%.

Sun Elevation Settings for Options 3, 4, 5, 6, 7, 8 & 9 (Click Here to expand)

Below, you’ll find graphs illustrating the Sun Elevation feature within Dynamic Lighting. These visuals aim to provide a clearer grasp of the settings. As the saying goes, ‘a picture is worth a thousand words.’

By manipulating the proximity between the start and end points, you’re essentially altering the progression of colour temperature or brightness percentage along a linear path from their minimum to maximum values on sun rise or from their maximum to minimum on the suns descent until they reach the rising endpoint or descending endpoint. Changing the closeness or distance between these points adjusts the slope of the linear progression concerning sun elevation. In simpler terms, it influences how quickly or gradually the colour temperature or brightness changes as the sun rises or descends.

"The settings showcased in these graphs were as follows:

  • Max Brightness Value = 100%
  • Min Brightness Value = 30%
  • Max Colour Temperature = 6500 K
  • Min Colour Temperature = 2000 K
  • Sun Elevation Rising - Start Point = - 1.5 degrees
  • Sun Elevation Rising - End Point = 35 degrees
  • Sun Elevation Descending - Start Point = 35 degrees
  • Sun Elevation Descending - End Point = - 4.0 degrees

These settings were crafted as an example, demonstrating a transition from a warm, dimly lit ambiance to a brighter, cooler ambiance during the sun’s ascent. Conversely, during the descent, the settings showcase a shift from the brighter, cooler ambiance back to the initial warm, dimly lit ambiance. It’s crucial to note that these values are provided as an illustration, encouraging users to customize settings according to their preferences and unique requirements

The lowest possible start point for the Sun Elevation rising phase and the lowest end point for the Sun Elevation descending phase is set at -10 degrees. Below these specified points, the settings utilize their minimum configured values.

This is how it looks in a sensor card

If you chosen to select “Brightness Inverted” in an option then the graph below also show how the brightness will be as inverted apposed to just selecting “Brightness”.

The Settings (Click Here to expand)

:gear: THE SETTINGS

The default settings are just random numbers I used. You will have to adjust them to suit your site conditions and to your liking. Play around with it and try different settings to make it work for you. Don’t forget you still can also use the “transition” and “colour temperature” in “Light Control Options”. Only “brightness” in the “Light Control Options” will be disabled if your use brightness in “Dynamic Lighting”. Transition is a nice way to smooth out your lights.

  • Dynamic Lighting - Ambient Light Sensor

    This is the ambient light sensor that will be use. You can have a local light sensor in the same room as your lights or you can use and outside sensor.

  • Dynamic Lighting - Max Lux Value

    You can see in the above graph (Point B) the maximum lux value is set to 400 lux.

  • Dynamic Lighting - Min Lux Value

    You can see in the above graph (Point A) the minimum lux value is set to 40 lux.

  • Dynamic Lighting - Max Brightness Value

    You can see in the above graph (Point A) the maximum brightness value is set to 100%.

  • Dynamic Lighting - Min Brightness Value

    You can see in the above graph (Point B) the minimum brightness value is set to 0 % If setting the brightness to 0% then the light will turn OFF.

  • Dynamic Lighting - Toggle Helper

    When you set up dynamic lighting with a brightness level of 0%, the light will turn off. Dynamic lighting relies on the state of the lights being “ON” to function correctly. If the lights are not detected as “ON,” dynamic lighting stops, which is not desired. By using a toggle helper, dynamic lighting will monitor the toggle helper’s state instead, ensuring it continues to run. This is why the toggle helper is necessary only when setting a brightness level of 0%. Toggle helpers in Home Assistant are reliable and don’t get lost on the network. If a light drops off momentarily when dynamic lighting checks the state, it can cause dynamic lighting to stop. Using a toggle helper ensures consistent functionality without relying on network connections.

  • Dynamic Lighting - Heartbeat

    This is the speed it will run at. At each heartbeat it will check your lux value and change the brightness if necessary. Every Lux sensor report differently so you will need to adjust this to suit your lux sensor. There is no point checking every minute if your lux sensor reports every two minutes.

  • 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.

    To understand its function, consider this scenario: Imagine dynamic lighting aims to set your lights at 44%. If your actual light brightness is at 96%, and with a Step Value set at 4%, instead of applying the full 44%, it adjusts to 92%. This adjustment pauses, allowing the LUX sensor time to adapt before proceeding to the next step, synchronized to your heartbeat setting. As your actual light brightness reaches 92%, the target value may be adjusted to 50%. This process repeats with each heartbeat until the target value aligns with your actual light brightness. The introduction of the Dead Zone comes into play when the target value approaches the brightness of your lights.

  • Dynamic Lighting - 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.

    To understand its function, consider this scenario: suppose dynamic lighting aims to set your lights at 88%. With a Dead Zone set value of 7%, if your actual light brightness falls between 81% and 95%, there will be no alteration to the brightness value. Although a 7% Dead Zone might initially seem substantial, testing has shown that it is actually considerably less than 7% of the intended value.

Trouble Shooting & Testing

In order for dynamic lighting to work well, it needs data from your lux sensor. Having a lux sensor that reports every 5 - 10 min + or on 5% change will not work well. The more data we can have the sensor provide the better it will work. Dynamic lighting only works with light (domain) entities. It will not work with switches and scenes.

A good way to test it is to add your motion sensor, light and lux sensor into a dashboard. This way you can see what is happening. Reduce your heartbeat to the minimum 0.25. If possible make your lux sensor report every 20 seconds. Now you will have a fast reacting dynamic lighting. From there you will then need to expand out your settings until you find what works for you. Below shows the dashboard.

45

Enjoy

Blacky :smiley:

Back to FAQ: Click Here

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

3 Likes

I come from another hub and I had to set up 4 separate automations to meet my needs, I don’t understand if this could help me, I’ll explain:

in each room with 2 lights, I have 1 light that turns on when movement is made and turns off at the end of movement only if the other light is off, or if desired they must remain on. All this only if a virtual switch is turned on.
With Home Assistant I don’t know how to set something like this, either I copy the logic I had created, with virtual devices and so on, or I don’t know. I saw the project and tried to use it, but I found myself with the switch that was going crazy trying to figure out continuous on-off-on-off. definitely my mistake but I can’t find a solution

Also, I also have a location mode and would like the Automations only work in those cases. Is it possible with this program?