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

@sentur

Yep as that is what your asking it to do. Only work between 9 and 23:30. It is same as sun, ambient and state control. They will all turn your light OFF.

If you would like something different that is where state control input can help. You have an entity that will be ON at 9 and OFF at 23:30 but only turn OFF if motion is clear else wait until motion clears, then turn OFF. Then you use that entity in the state control. Many ways to create an entity... one is to have an automation that turns ON / OFF a toggle helper entity or another way is to create a template binary sensor entity. Whatever works for you.

Blacky :grinning_face:

Hello there,

I'm fairly new to this blueprint and would like some advice.

My current setup uses Dynamic Lighting with 25% brightness between 19:00 - 06:00, controlled by its own boolean helper. Bypass also has its own boolean helper.

Is there an elegant solution to temporarily override the Dynamic Lighting (to get 100% brightness) while it's active during that time period, without fully disabling it?

My current bypass turns the lights on to the brightness predetermined by Dynamic Lighting.

Ideally, one button press would jump to 100%, and another press would return to the Dynamic Lighting behavior

Thanks for any advice.

alias: Chodba - světla
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.cidlo_vchod_occupancy
    light_switch:
      entity_id:
        - light.zarovka_chodba_obyvak
        - light.0x54ef4410013496fc
    time_delay: 1
    include_light_control:
      - use_brightness
      - use_transition
    light_brightness: 75
    light_colour_temperature: 2700
    include_dynamic_lighting: enable_time_controled_colour_brightness
    dynamic_lighting_max_brightness: 75
    dynamic_lighting_min_colour_temp: 2700
    dynamic_lighting_state_control_entity: input_boolean.dynamicke_osvetleni
    dynamic_lighting_state_control: enable_state_control
    include_bypass:
      - bypass_enabled_turn_on
      - bypass_enabled_turn_off
    motion_bypass_lights_on:
      - input_boolean.bypass_chodba
    motion_bypass_lights_off: []
    dynamic_lighting_min_brightness: 20
    include_time: time_enabled
    after_time: "15:00:00"
    before_time: "09:00:00"
    dynamic_lighting_dead_zone: 8
    dynamic_lighting_step_value: 9
    include_state_control: state_control_disabled
    state_control_activation_state: "off"


First of all, thanks a lot, @Blacky , for your reply. Okay, so in my case it has to do with the sun elevation.

My problem, however, is that it doesn’t work in my case. I’d also like to explain why. If it starts raining during the day—when the sun hasn’t set yet—my blinds sometimes go down. At that moment, the room gets too dark. So I thought the Ambient Settings could be another option, which would turn on the lights when the light level drops below, say, 120 lux.

When it stops raining, the blinds go back up and there’s enough natural light that the lights logically don’t need to turn on anymore—they’ll only turn on again once the sun has set.

Can you somehow implement this for me, or tell me how I might be able to make it work indirectly?

Thanks very much for the reply. That seemed to be EXACTLY what I was missing.

While I have you--is there a recommended method of handling when the trigger (occupancy binary sensors in this case) are likely to be ON already when the Lux values fall below the max?

For example, my kids have been lazily lounging the living room all afternoon because they had a half-day at school all day. The trigger was in the ON state already when it got cloudy and darker outside. So the lights have not come on in that room. How best to handle that scenario?

@tomka445

I have changed your lighting control brightness from 75% to 100%. Now when you toggle your Dynamic Lighting - State Control Entity input boolean you will swap form your dynamic lighting brightness % (whatever that is at the time you toggle this helper) to 100% brightness. Then it is not fully disabled and is why we have this feature.

alias: Chodba - světla
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.cidlo_vchod_occupancy
    light_switch:
      entity_id:
        - light.zarovka_chodba_obyvak
        - light.0x54ef4410013496fc
    time_delay: 1
    include_light_control:
      - use_brightness
      - use_transition
    light_brightness: 100
    light_colour_temperature: 2700
    include_dynamic_lighting: enable_time_controled_colour_brightness
    dynamic_lighting_max_brightness: 75
    dynamic_lighting_min_colour_temp: 2700
    dynamic_lighting_state_control_entity: input_boolean.dynamicke_osvetleni
    dynamic_lighting_state_control: enable_state_control
    include_bypass:
      - bypass_enabled_turn_on
      - bypass_enabled_turn_off
    motion_bypass_lights_on:
      - input_boolean.bypass_chodba
    motion_bypass_lights_off: []
    dynamic_lighting_min_brightness: 20
    include_time: time_enabled
    after_time: "15:00:00"
    before_time: "09:00:00"
    dynamic_lighting_dead_zone: 8
    dynamic_lighting_step_value: 9
    include_state_control: state_control_disabled
    state_control_activation_state: "off"

Blacky :grinning_face:

@Sushibomba

Yes.... the best way to handle this is to only use the ambient condition as this will handle your blinds and low light (sun dropping). If you try to do both then your run into conflicts.

I have adjusted your settings so the light will come on when your lix value drops below 120 and it will turn OFF when the lux value rises above 150 for at least 1 min. I have also selected NO - My Ambient Light Sensor is not affected by the Lights even if they are you will set up the Ambient Light - High Lux Time Delay to handle this.This stops your lights form coming ON and OFF when it is cloudy or your blinds close. The Ambient Light - High Lux Value setting of 150 that I adjusted will need to fine tuned. Turn your lights ON when it is dark and look at the lux value... just say it is 180 then adjust this (150) to say 200.... if it is 130 then 150 will be a good starting point for testing. Now when it gets dark as the sun sets the lights will come ON and if your blinds go down the lights will come ON... forget about the sun elevation setting and just use ambient.

alias: Presence - EG Gäste-WC
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.presence_eg_gaeste_wc_presence
    light_switch:
      entity_id:
        - switch.decken_licht_eg_gaeste_wc_switch_1ch
    time_delay: 1
    include_light_control: []
    light_brightness: 1
    include_sun: sun_disabled
    include_device_tracker: zone_people_enabled
    zone: zone.home
    people:
      - person.1
      - person.2
    include_night_lights: night_lights_disabled
    include_night_light_control:
      - use_colour_temperature
      - use_brightness
    night_light_colour_temperature: 2000
    night_light_brightness: 1
    light_colour_temperature: 2000
    sun_elevation_rising: -2
    light_transition_on: 2
    light_transition_off: 3
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.presence_eg_gaeste_wc_illuminance
    ambient_light_high_value: 150
    ambient_light_options: ambient_light_option_disabled
    ambient_light_low_value_delay: 0
    ambient_light_high_value_delay: 1
    ambient_light_value: 120
    include_dynamic_lighting: disable_dynamic_lighting

Blacky :grinning_face:

1 Like

@ryanhindinger

Your welcome, glad you got it working.

So you have a Dynamic Lighting - Max Lux Value of 770 and at that point your brightness will be 0% and a Dynamic Lighting - Min Lux Value of 70 and your brightness will be 97%. If they are in the room and the lux is 770 + then the lights wont come ON. You will need to set it up exactly how your want it (This is the power of this blueprint, you have full control). Have a look at the FAQ click here and expand out Lux Controlled Brightness Settings for Options 1, 2, 8, 9, 15 & 16. It give you good graphs on how it works.

Blacky :grinning_face:

Sorry, I am still having an issue here I cannot sort out. Every time this automation triggers in my kitchen it is sending those lights to 100%...and then slowly dimming them per the heartbeat and step values as expected. But it goes to 100% every single time it triggers--without any transition value--then slowly dims from there rather than going directly to the target brightness values. Oddly, it's going to 100% every time even though the max brightness value is set to 97%.

Is this the expected behavior on a trigger? It's a little jarring and I am wondering if there's a way to avoid it going to 100.

My YAML for convenience:

alias: "NEW Illuminance Based Kitchen Lighting "
description: >-
  Using the Blacky Blueprint to determine Kitchen lighting based on outside Lux
  readings.
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.aqara_fp300_002_pir_detection
    light_switch:
      entity_id:
        - light.kitchen_center
        - light.kitchen_left
        - light.kitchen_centerline
        - light.kitchen_middle
        - light.kitchen_right
        - light.kitchen_sink
    include_light_control: []
    light_transition_on: 5
    light_transition_off: 8
    include_light_colour_control: disable_colour_control
    light_colour_temperature: 2700
    include_dynamic_lighting: enable_lux_controled_brightness
    dynamic_lighting_lux_sensor: sensor.solar_lux_fraction
    dynamic_lighting_max_lux: 900
    dynamic_lighting_max_colour_temp: 3000
    dynamic_lighting_step_value: 2
    dynamic_lighting_dead_zone: 4
    dynamic_lighting_state_control: disable_state_control
    include_ambient: ambient_disabled
    ambient_light_sensor: sensor.aqara_fp300_002_illuminance
    ambient_light_options: ambient_light_option_enabled
    ambient_light_value: 30
    ambient_light_low_value_delay: 0.25
    dynamic_lighting_min_lux: 100
    dynamic_lighting_min_brightness: 0
    light_brightness: 97
    dynamic_lighting_max_brightness: 97
    dynamic_lighting_min_colour_temp: 2200
    include_state_control: state_control_disabled
    state_control_activation_state: "on"
    ambient_light_high_value: 100
    ambient_light_high_value_delay: 0.5
    include_dim_before_off: dim_before_off_enabled
    dynamic_lighting_heartbeat: 0.25
    dim_before_off_time_delay: 45
    time_delay: 10
    include_bypass:
      - bypass_enabled_stop
    motion_bypass_lights_stop:
      - input_boolean.light_level_lighting
    bypass_time_delay: 3
    dynamic_lighting_boolean: input_boolean.kitchen_dynamic_lighting_helper

@ryanhindinger

I have tested it here with your settings and it goes to 97% depending on the lux value. If the lux is higher it goes lower.

Some ideas.

  1. See if the lights are used in another automation thus setting the brightness to 100%.
  2. It could be an internal thing for your lights to go to 100% when power ON. Is there internal settings for your lights?
  3. Test to do. Make sure all your automations using these lights are disabled. Manually turn your light/s ON and adjust to 50%. Manually turn them OFF. Then manually turn your light/s ON again and see what happens. Does it go to 100%?

Hope you find it.

Blacky :grinning_face:

Okay, so I kept testing and for some reason the change that seems to have fixed this behavior was disabling the dim before OFF option? Once I did that it stopped jumping to full on every trigger!

No idea what the logic was there but I think it's now doing everything I need it to do!

Nice find! Glad you finally got it all working...

Enjoy

Blacky :grinning_face:

You sir.... are a amazing!!!

Changing the triggers to a group and being able to add the garage entity that easy has now made operations PERFECT!!! Light's come on and go off when they should and MOST IMPORTANTLY.... they stay on no matter how long I'm in there!!

I told you once I got the hang of it, i was gonna use it and I already got 4 automations so far!

Thank you again! :clap:t5: :clap:t5: :clap:t5:

1 Like

Hi @Blacky and all:

Thank you for sharing the blueprint!
I have some sensors that can't differciate human and clean robot, so would like to tweak the automation *not to turn on light when the clean robot is in that room.
I have a sensor called "sensor.livingroom_cleanrobot_current_room" which indicate which room the robot is cleaning, and would like to ask is there a smart way to prevent the automation to turn on light using a template condition like:

  {{ not is_state('sensor.livingroom_cleanrobot_current_room', 'Living Room') }}

I could have another automation to disable the automation but I almost have sensor light in all the rooms it doesn't sound like the best approach. Any suggestion? Thanks!

@maisun

Your welcome.

Yes.

Your code will be OFF when it is cleaning (or in) the living room. I not sure what room your trying keep the lights OFF in. If you would like it to be ON when it is in the living room then

{{ is_state('sensor.livingroom_cleanrobot_current_room', 'Living Room') }}

You have 2 options.

  1. Bypass - Works with an ON state only. You have 3 bypass options. 1 - will turn your light ON (you don't want that option) 2 - will turn your light OFF if ON ( you may want this option ) 3 - will keep the lights current state so if it is ON stay ON or if OFF stay OFF ( you may want this option). Because it is a sensor "sensor.livingroom_cleanrobot_current_room" your not going to be able to turn it OFF so you wont be able to use The Bypass Auto OFF Option.
  2. State Control - this will work with an ON or a OFF (you choose) state and is a condition. This will trigger the light ON or OFF depending on the site conditions.

The trick will be when this sensor turns ON / OFF. Example will the automation turn the light ON first and then the sensor changes state to then disable the automation or will the sensor change state before it enters the room so the automation can be disabled before so the light stays OFF.

Blacky :smiley:

Hi @Blacky

Thank you for the detailed explanation.
I’ll create some template binary sensor for each room and use the bypass option - sounds like the best option.
Have a great day!

1 Like

What I want to achieve is "do not turn lights on or off based on the presence during the night time"
I have multiple automations for multiple rooms, some of them do have night lights entities and/or night glow, but some do not. Those, that do not contain the night lights will not turn off/on the day lights on crossover (day -> night, night -> day)
I want to avoid having different setups, when instead of tracking night entity state in one automation i need to tracj bypass entity in the other.

Hi @Blacky

First thanks for your work, your blueprints are awesome. I guess it’s a lot of work to create them and to maintain.

My main purpose right now it’s to reduce the brightness if the light is turn on between 00am and 07am.

I currently have sonoff zb dim for this and I have a « problem » : if I set an automation to set the brightness to 20%, it will first turn on the light at 100% then reduce to 20%. So my eyes will burn.

Is there a way to improve this with your blueprint ??

Thanks again

@allflame

You can use the time condition to disable the automation during night time.

Blacky :grinning_face:

@Hydro8

You do this trough Night Lights using the night light time condition and make sure you select If lights are ON, adjust the lights when crossing over in Night Light Control.

This is not the blueprint as it sends the action to turn the light ON with your set brightness. I will do a FAQ on this because it asked a lot (see below).

Blacky :grinning_face:

FAQ: Why Does My Light Briefly Turn On at 100% Before Dimming to the Requested Brightness?

This is not caused by the blueprint or automation.

When Home Assistant sends a light.turn_on action with a brightness value, some lights or integrations may:

  1. Turn the light ON immediately.
  2. Restore the previous brightness level (or default to full brightness).
  3. Process the requested brightness value.
  4. Adjust the light to the requested brightness.

This can create a brief flash at a higher brightness level before settling at the requested brightness.

The behavior occurs because the light or integration is handling the ON command and brightness command separately, even though Home Assistant sends them together in a single action.

How to Check

Trigger the automation so the lights turn ON at a high brightness level (100%), then allow the automation to turn them OFF.

Next, enable Night Lights so the next trigger will turn the lights ON at a lower brightness level (20%).

When Night Lights triggers for the first time, you may notice the lights briefly change from 100% to 20%. Allow the lights to turn OFF again, then trigger Night Lights a second time.

If the lights now turn ON directly at 20%, this indicates that the light is restoring its previous brightness level when turning ON and then adjusting to the new brightness setting. The change may only last for a fraction of a second, but it can still be noticeable.

If the lights still briefly turn ON at 100% the second time, the device may be configured to always power on at 100% brightness before applying the requested brightness level.

This behavior is controlled by the light or its firmware and is not caused by the blueprint or automation.

Things to Try

There may be a way to reduce or eliminate this behavior, depending on your light and integration.

  1. Use the Transition option in Light Control if your light supports transitions. This can help smooth out brightness changes when the light turns ON.

  2. Use the Dim Before OFF Option in Light Control so the light always dims to a lower brightness level before turning OFF.

    This option can be particularly effective if you performed the check above and found that the second Night Lights trigger turned the light ON directly at 20% brightness. In this case, the light is likely restoring its previous brightness level when turning ON. By dimming the light before it turns OFF, the lower brightness level is stored as the last known state, which may prevent the brief flash at a higher brightness level the next time the light turns ON.

Note: These options may not work with all lights, as some devices are designed to always turn ON at a default brightness level before applying the requested brightness setting.


Enjoy

Blacky :smiley:

Back to FAQ: Click Here