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

@Fred54

Use the BP for the hall. Then set up you night lights with your time hours. Include the light in the hall and the light in the bathroom in night lights.

Hope this helps you.

Blacky :smiley:

@Bobie

All good Bobie, hope you are feeling better soon.

Blacky :smiley:

@harryfine

Hi Harry, hope all is going well.

I am just trying to get my head around what you are doing. Not sure if you are using time for night lights (9pm) for your softer lights and then a toggle helper in the bypass to turn the light ON in bypass option 1. Then your question is to also include a LUX reading to turn the light ON using the bypass option 1.

Maybe provide your YAML of the automation and confirm what you would like the LUX sensor to do. Example

  1. Turn the light ON using bypass 1 when the lux value drops below a set value.
  2. Activate night lights using the lux sensor when the lux value drops below a set value.
  3. Use the LUX sensor to activate the automation when the lux value drops below a set value for day and night mode.
  4. Use the LUX sensor with the toggle helper to turn the light ON if both are true using bypass option 1.
  5. Something else?

Blacky :smiley:

Hi Blacky

First time using dynamic lighting since I now have a few lux sensors. So forgive my slow start. Here is the YAML:

alias: Master Bedroom Lights on by Motion
description: Master Bedroom Lights on by Motion if Night Mode Off
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.master_bedroom_presence_and_motion_sensors
    light_switch:
      entity_id: light.master_bedroom_bedside_lamp_group
    include_light_control:
      - use_brightness
      - use_colour_temperature
    include_bypass:
      - bypass_enabled_turn_off
    motion_bypass_lights_off:
      - input_boolean.day_night_mode
    time_delay: 4
    include_night_lights: night_lights_enabled
    night_lights:
      entity_id: light.master_bedroom_bedside_lamp_group
    include_night_light_control:
      - use_brightness
      - use_colour_temperature
    night_lights_after_time: "22:00:00"
    night_lights_before_time: "08:30:00"
    night_lights_conditions:
      - time_enabled
    night_time_delay: 5
    night_light_brightness: 10
    include_dynamic_lighting: enable_lux_controled_brightness
    dynamic_lighting_lux_sensor: sensor.light_sensor_ls2_master_bedroom_ambient_light
    dynamic_lighting_max_lux: 45
    dynamic_lighting_min_lux: 35
    dynamic_lighting_max_brightness: 60
    light_colour_temperature: 3500
    light_brightness: 80
    night_light_colour_temperature: 3500
    dynamic_lighting_max_colour_temp: 3500
    dynamic_lighting_min_colour_temp: 3500
    dynamic_lighting_heartbeat: 1

I’m trying to have the light intensity at 0 (off) when the light is at 45lx or above, and when it hits 25lx, start progressively heading up to 60% brightness. The heartbeat is set to1 just to make testing easier.

Question. How does night light affect all this (ignore for the moment that the binary sensor is a bypass and it won’t come on). Does using dynamic lighting replace the need for night light?

Also is this description incorrect?

Used in options 1, 2 or 7 - 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.

Should it not be

“if the targeted brightness surpasses the actual targeted value by the amount of the predeefined step value…”

Hi Harry

Okay so from 45lux to 25lux what brightness would you like. And then from 25lux to ?? to start heading up to 60%.

Night lights don’t have dynamic lighting. It is only for normal lights.

Yes

No

I will explain as best as I can.

When dynamic lighting turns ON it can jump to a high brightness %. Lets say when dynamic lighting turns ON because it is dark the brightness target is 90%. Then when the light turns ON this effects the lux sensor and the next target is 20%. If it then goes to 20% the next target may be 97% then the next target it 24%, you get the idea… the light jumps around and this is not pleasant to the eye.

Now lets look at "Step Value’. Again when the light turns ON the target brightness is 90%. Then when the light turns ON this effects the lux sensor and the next target is 20%. That is 60% target value and the step value is 4%, so the light next step value will be 86%. Then it checks again and the target value is 30% that is 56% so the next step will be 82%, you get the idea… this is more pleasant to the eye and slowly gets to a set value. The dead zone stops the final small adjustments so these micro adjustments don’t play on your eyes and keeps it a comfortable space to live in.

Knowing this you have to have a correct heart beat to your lux sensor reporting value. If you speed up the heart beat and the lux sensor is slow to react then you will not get the correct design / experience of this feature. This is critical. Example say your lux sensor updates every 30 sec then setting a heart beat of 1 sec is not good because the heart beat would like to see the change in the lux sensor and preform a new calculation based on its last adjustment. If your lux sensor updates every 30 sec then it is best to set a heart beat at 30 sec + like 45 sec. This is for testing. Once you see it work having a longer heart beat is better but not too long so it doesn’t work. It is a bit of a balancing act and ever setup is different and every site is different all depending on how it is used. The good news is… you have full control in your hands to make it perfect as you would like it.

Dynamic lighting is best used when the sun is out during the day and going to sunset. It can also be a nice way to wake up with a sunrise affect. Also google ‘circadian rhythms’. It is a really nice feature. From 25lux to ?? is a small window to have though but it can be a lot of fun testing it out.

Anyway if you can get back to me on this question. “Okay so from 45lux to 25lux what brightness would you like. And then from 25lux to ?? to start heading up to 60%.” I will set it all up for you and provide your YAML.

Blacky :smiley:

What I’m trying to do is make the lights stay off (brightness 0) on motion during the day when it’s bright. Then when it starts to get dark as the sun sets, maybe 50lux, start turning on when triggered perhaps at 100% brightness. The brightness would drop down to 10 percent on triggering as it gets down to 0 lux. The numbers are arbitrary, need to test for lux vs light brightness, but that’s the concept.

I like to walk up to the bedroom after reading or TV, let’s say 10pm, and outside of course it’s dark, but have the lights come up to just 10 percent. Ten percent would be the lowest. Don’t need bright lights to get ready for bed.

Of course when I trigger the bypass (hey google, good night triggers binary helper) that would prevent lights from going on.

In the morning when waking up, it would reverse itself, coming on dim and then eventually NOT turning on the lights when it hits 50 lux.

Hope this makes sense.

@harryfine

Looks like sun elevation would work better for you and then use your lux sensor in the global conditions. We use dynamic light option 4. When the sun elevation is 5 deg and lux is below 50 the light will turn ON at 100%. At night sun elevation is -4 the lights will be 10%. In the morning at sun elevation -1.5 lights will be at 10%. Night lights is sun elevation from -4 to -1.5 and the lights will be 10%. Before any lights can turn ON the lux must be below 50lux so they will be OFF during the day.

Have a look at this one. Copy paste it into you YAML.

alias: Master Bedroom Lights on by Motion
description: Master Bedroom Lights on by Motion if Night Mode Off
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.master_bedroom_presence_and_motion_sensors
    light_switch:
      entity_id: light.master_bedroom_bedside_lamp_group
    include_light_control:
      - use_colour_temperature
    include_bypass:
      - bypass_enabled_turn_off
    motion_bypass_lights_off:
      - input_boolean.day_night_mode
    time_delay: 4
    include_night_lights: night_lights_enabled
    night_lights:
      entity_id: light.master_bedroom_bedside_lamp_group
    include_night_light_control:
      - use_brightness
      - use_colour_temperature
    night_lights_after_time: "22:00:00"
    night_lights_before_time: "08:30:00"
    night_lights_conditions:
      - sun_enabled
    night_time_delay: 5
    night_light_brightness: 10
    include_dynamic_lighting: enable_sun_elevation_brightness
    dynamic_lighting_max_lux: 50
    dynamic_lighting_min_lux: 0
    dynamic_lighting_max_brightness: 100
    light_colour_temperature: 3500
    night_light_colour_temperature: 3500
    dynamic_lighting_max_colour_temp: 3500
    dynamic_lighting_min_colour_temp: 3500
    dynamic_lighting_heartbeat: 1
    dynamic_lighting_min_brightness: 10
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.light_sensor_ls2_master_bedroom_ambient_light
    ambient_light_value: 50
    dynamic_lighting_sun_elevation_end_rising: 5
    dynamic_lighting_sun_elevation_start_falling: 5
    night_lights_sun_elevation: -4
    night_lights_sun_elevation_rising: -1.5
    ambient_light_options: ambient_light_option_enabled

Blacky :smiley:

1 Like

That looks like what I’m looking for. Thanks.

Lights fail to get back on, if Off-Dim has startet and the trigger is flipped to ON while it’s happening?!?
I’m running the latest 6.5 version of the BP, and I was puzzled about, why the lights would not go back on, sometimes when I re-enter the area.
It’s seems that, my LIFX downlights does - often - not accept a ‘fade up’ or ‘flip on’ command, if they are engaged in a current ‘fade down’ event.

Has anyone else seen this, and if so, with other brands of bulbs as well?

Could it be, that the bulbs is simply missing the command? I was just trying to test it, and it seems a bit random, sometimes 2/3 bulbs do re-light up. I can’t find a pattern, other than they seems to ignore the latest command if they are ‘busy’.
Funny thing is, triggering other scenes from other sources (like buttons), seems to work just fine…
Any ides?

@marook

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:

Sure, here it is:

alias: Lys Gang BP
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.epl_gang_occupancy
    light_switch:
      entity_id: light.gang_ovenlys
    time_delay: 0
    end_scenes:
      - scene.gang_off
    dynamic_lighting_lux_sensor: sensor.epl_gang_illuminance
    include_night_lights: night_lights_enabled
    night_lights:
      entity_id: light.gang_ovenlys
    night_time_delay: 2
    night_lights_after_time: "22:00:00"
    night_lights_before_time: "08:00:00"
    night_lights_conditions:
      - time_enabled
    include_light_control:
      - use_brightness
      - use_colour_temperature
      - use_transition
    light_colour_temperature: 2600
    light_transition_on: 1
    light_transition_off: 10
    night_light_brightness: 10
    night_light_colour_temperature: 2300
    night_light_transition_off: 10
    include_night_light_control:
      - use_transition
      - use_brightness
      - use_colour_temperature
      - if_lights_are_on_adjust_when_crossing_over
    ambient_light_sensor: sensor.epl_gang_illuminance
    ambient_light_options: ambient_light_option_enabled

@marook

Thanks for your YAML.

I have noticed you have a scene ‘scene.gang_off’ in ‘Scenes - Scripts To Turn OFF’. Not sure why this is there because you are using a light entity in ‘Lights - Switches - Scenes - Scripts’. Could you please remove your scene ‘scene.gang_off’ in ‘Scenes - Scripts To Turn OFF’ and see if that helps you. All the rest looks okay.

Let us know how you go.

Blacky :smiley:

1 Like

Hey!

Firstly thank you for doing this! It’s been perfect. I am however suffering a small issue. I can get the lights to turn on when the lux is below the value, but when it detects the lux being above 80, the lights do not switch off automatically like they did. Not 100% sure what I have done wrong. I can see the trace saying it’s gone above 80 but I am a bit of a noob so not sure whats stopping it switching them off.

latform: numeric_state
id: t10
entity_id: sensor.lightsensor_illuminance
above: 80
alias: Automated light - Lux
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - schedule.lights
    end_scenes:
      - scene.night_night
    ambient_light_sensor: sensor.lightsensor_illuminance
    ambient_light_value: 30
    include_device_tracker: zone_people_enabled
    zone: zone.home
    people:
      - person.tom
    light_switch:
      entity_id: scene.automatic_lights_on
    dynamic_lighting_lux_sensor: sensor.lightsensor_illuminance
    include_ambient: ambient_enabled

Hi Blacky,
What kind of entity state is needed to work in the Night Lights?
Can the Night Lights - Entity State be a Motion Sensor?

@Mint514

Hi Tom, and welcome to the community :wave:

Thanks for providing your YAML as it helps me help you :+1:

Because you are using scenes we will need to create a toggle helper and enter it into ‘Scenes & Scripts - Toggle Helper’. Once you do this it will work.

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 enter it into the blueprint here.

Let us know how you go.

Blacky :smiley:

@Fred54

You normally use an entity that will be turned ON and OFF and they hold the state. A motion sensor is not really recommended. You would normally use a motion sensor in the ‘Trigger Sensor’ and that will work in night lights as well. Some examples for the ‘Night Lights - Entity State’ would be.

  • Phone on focus - do not disturb. You turn it ON when you go to bed.
  • Security system - night mode armed
  • Toggle helper - could be ‘Sleep Mode’ or ‘Children Sleeping’ etc.
  • Bed sensor
  • Switch you turn ON next to the bed.

Hope this helps you

Blacky :smiley:

Hello Blacky, I have a problem! I want to activate the night lights with the do not interrupt mode on my cell phone. The problem is that when I activate it, the sensor does not show “on” but “priority_only”.

Do you have any idea how to solve it?

Thanks!

Hi all! What a fantastic blueprint. I’m a noob but it seemed straightforward until I realized it didn’t quite work last night. I have a motion sensor at the back door of my house. When it detects motion, I want it to turn on 3 devices in the rear - my landscape lighting, my rear door light, and my rear sconces. Only at night. Then to turn them off 15 minutes later if no motion is detected.

The two lights are enbrighten z-wave light switches that otherwise work fine. The landscape lighting is triggerd by one of the two plugs on a ministone outdoor smart plug.

It ran last night when it detected motion but oddly, only the landscape lighting turned on. Not the rear door light or sconces. Also it did not turn the landscape lighting off 15 minutes later. Not even an hour later. I had to turn them off manually.

Mind taking a quick look to see if anything is obviously wrong? I’ll try to test it some more tonight…

Here is my YAML

alias: Rear Door Motion
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.multisensor_6_motion_detection
    light_switch:
      entity_id:
        - light.landscaping_lights_2
      device_id:
        - d2785ba3695aa1f325ed6420cf4b88b5
        - 10c763e2bf3dd93f6441e4a1be43b863
    time_delay: 15
    include_sun: sun_enabled

@cediqqu

Hi César Zenón Díaz Cueva

Welcome to the community.

Yes. If it is not working when you add this to the state you can create a binary template sensor helper to create an ON / OFF state when this entity goes to ‘priority_only’. Here is how you would do this.

Go to Settings / Devices & Services / Helpers Tab at the top / Create Helper / Template / Binary Sensor / Enter in the name you would like to call it and in “State Template” paste the code below. Click Submit and then use that binary template sensor in your night lights state.

{{ is_state('sensor.pixel_7_pro_do_not_disturb_sensor', 'priority_only')}}

Blacky :smiley:

@patientfool

Hi Gerald

Thanks for providing your YAML.

In ‘Lights - Switches - Scenes - Scripts’ you are using 2 devices. This is why it is not working as it only supports entities. You need to expand down the devices to entities and you will be all good. To do this please see this FAQ, click here

Blacky :smiley:

1 Like