šŸ’” Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights

@lmarcelocc

Some motion sensor can have this option in there settings. If not, to make it work you can create a template binary sensor using your motion sensor and put a delay in of 5 sec. I have template examples in the FAQ but here is the link to them, click here

The example you would use it REF - TS-2. Once you create this template binary sensor you would use it as your trigger and not your actual motion sensor.

Hope this helps you.

Blacky :smiley:

1 Like

@Blacky

Hi,

Thanks for the proposed solution. Although I know how to do it as a separate automation, I wanted to implement this feature as an addition to your marvelous blueprint. :blush:

It has all of the other features needed, but Iā€™m missing this one.

So either to add additional condition that will override currently inactive lights during the day via switch or by checking string value of a provided helper.

This is what Iā€™m trying to do. Form of a blueprint feature request :slight_smile:

And yes, you got it right. During the night it shouldnā€™t change behaviour.

Many thanks for support.

Hey again! That was a bit long but now i 100% know what this issue is caused by zigbee2mqtt new version which got updated few days before 2024.4 release. Zigbee2mqtt 1.36.1 have this issue with my Sonoff zigbee stick. And issue disappearing after i restore 1.35.3

@dr_digital

Okay, looking at your example above (the image) and your postā€¦ looks like bypass 2 is what you are looking for. This will disable the automation based on your helper and turn the lights OFF. The bypass is quite powerful in what it can do, it digs deep analyzing what it happening when the bypass turns OFF.

I understand you know how to do this but for the others reading I will provide an example.

If we create a template sensor helper that has some conditions that are, it must be day time + cloudy or raining and if not turn the helper ON else turn it OFF. In the code below I have added unavailable and partlycloudy in the example but you can remove them. Then when bypass is ON the lights will turn OFF if the conditions are met + the automation will be disabled. When the bypass turns OFF as the conditions are not met it will check the site conditions and preform the correct action. I have not tested this code just typed it out but it should work. We would enter this code into the ā€˜State templateā€™ of the template sensor helper.

EDIT I have updated the code.

{% set weather_state = states('weather.forecast_home') %}
{% if is_state('sun.sun', 'above_horizon') and weather_state not in ['partlycloudy', 'cloudy', 'rainy', 'unavailable'] %}
    on
{% else %}
    off
{% endif %}

Is this something that would work for you?

Blacky :smiley:

@Sk1vvy

Thanks for the update. I am glade you found it as these bugs can drive you crazy. Nice one :+1:

Blacky :smiley:

Hi. I am having issues when using this automation with IKEA Styrbar remote control for manual override. I connected this switch though ZHA but it does not create binary output. Instead, this switch generates zha_event with unique cluster_id and end_point_id.
Below is an automation written by Malte to control lights using this remote switch.
ZHA - IKEA four button remote (Styrbar) for lights (E2001, E2002) - Blueprints Exchange - Home Assistant Community (home-assistant.io)
Are there any possible way to use this switch for manual override control? Your input is much appreciated. Thank you.

@erichousetkc

Welcome to the community

What I would do is have the switch (IKEA Styrbar remote) toggle a ā€œToggle Helperā€ ON and OFF when you press the switch. I would then use the ā€œToggle Helperā€ in the bypass as they have an ON / OFF state.

To create a toggle helper go to settings > devices and services > click on helpers tab at the top > click create helper and select toggle.

Let us know how you go.

Blacky :smiley:

Iā€™m new to HA and a friend of mine helped me get started with your blueprint. Itā€™s really awesome. However there is one thing I could not figure out:

We have some color Hue lights and is there a way to set the color for those with your blueprint? The only thing Iā€™ve seen is to set the ā€œtemperatureā€.

@Blacky
Can the Night Lights - Entity State be a Motion Sensor?
Coming up the stairs, a motion sensor triggers the light in the hall (this is a Sensor Light BP) that leads to the bed and bathroom. The bathroom has a motion sensor too.
Using the Night option of the bathroom Sensor Light BP, I want the bathroom light to switch on when motion is detected by the hall (landing?) motion sensor, but only during the Night Time hours setting.
I tried to use the hall motion sensor as a Night Lights - Entity State for the bathroom but this does not work. Any suggestion how to get it working?

Hi Blacky,

Just been diagnosed with Covid!! :sneezing_face: :woozy_face: :face_with_spiral_eyes: :face_with_head_bandage: :face_with_thermometer: :roll_eyes:

I can read your words but canā€™t make out the sentencesā€¦

When Iā€™m better Iā€™ll have a better chance of understanding your reply aboveā€¦

Best Regards,

Bobā€¦ :face_with_spiral_eyes: :face_with_spiral_eyes:

Hi Blacky. Can you just point me in the right direction. Have motion sensor dimmable smart bulbs, I use night light feature for quieter light after 9pm and the bypass when a day/night helper binary toggle switches to night.

Soā€¦question is, I just bought a lux sensor from these Screek, love their esp32 5v radar sensors for motion. This one for lux is new, just released:

Anyway, Iā€™m already using the bypass for the day/night toggle. How would I also bypass the light turning on if the lux level is below a certain level?

Thanks

@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?