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

Just the option to have a follow up action would be great.

Hi @Blacky! First and foremost, a huge thank you for all the incredible effort you’ve put into creating this amazing blueprint!

I’m trying to customize the Dynamic Lighting: Time Controlled Feature for my needs. I’m using the 11 - Time Controlled - Brightness option.

I’d like the light to gradually dim from 100% to 3% over three hours, specifically between 10:00 PM and 1:00 AM.
Additionally, I want the night_time_delay to be set to 3 minutes during the night.

Here’s my YAML configuration:

alias: light test
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.ms_room_occupancy
    light_switch:
      entity_id: light.room
    time_delay: 10
    include_dynamic_lighting: enable_time_controled_brightness
    dynamic_lighting_max_brightness: 100
    dynamic_lighting_min_brightness: 3
    dynamic_lighting_time_start_evening: "22:00:00"
    dynamic_lighting_time_end_evening: "01:00:00"
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - time_enabled
    night_lights_after_time: "23:00:00"
    night_lights_before_time: "05:00:00"
    night_lights:
      entity_id: light.room
    night_time_delay: 3

Automation Results:

  1. 9:59 PM - Brightness 100% - OK
  2. 10:00 PM - Brightness 3% (expected 100%). If I change dynamic_lighting_time_end_evening to "23:59:00", the brightness is 100%.
  3. 10:30 PM - Brightness 3% (expected 83%). If I change dynamic_lighting_time_end_evening to "23:59:00", the brightness is 83%.
  4. 11:00 PM - Brightness 100% (expected 67%). The night lights mode is enabled, and Dynamic Lighting does not seem to work.
  5. 11:30 PM - Brightness 100% (expected 50%). The night lights mode is enabled, and Dynamic Lighting does not seem to work.

Questions:

  1. Based on items 2 and 3, it seems that I cannot achieve dynamic brightness adjustment across midnight (10:00 PM to 1:00 AM). Is this by design?
  2. From points 4 and 5, should Dynamic Lighting work when the night_lights mode is active?

@Vinkoy

Thank you, and your welcome.

Answers:

  1. Currently NO. I developed it to mimic the sun not to do it over a day. That said I should be able to achieve this easily but I will need time to test it live through a whole day. Keep an eye out for a new release.
  2. Dynamic lighting only works for normal lights not night lights.

Blacky :smiley:

1 Like

@Blacky , thanks so much for your quick reply and fix! I will try it once I have a bit of time and respond whether the issue was fixed for me.

Also thanks for the suggestions on the automation settings!

@Rhidus

No problem, there is another update coming with a fix if you using it over a day and a new feature so keep an eye out for it.

Blacky :smiley:

@Blacky And here comes the update: After updating the blueprint and enabling the automation, RAM usage is stable now when motion senosr is triggered (even without the toggle helper)! Thanks for your support :heart:

1 Like

Thank you for your response!

  1. Great news! I’ll keep an eye out for updates.
  2. Got it, that’s not an issue at all. I’ve solved this on my end by creating an additional automation based on your blueprint and using mutually exclusive bypasses. This way, one automation runs until 10:00 PM, and another takes over after 10:00 PM. In the second automation, I set the time delay to 3 minutes (as I wanted during the late evening hours), ensuring Dynamic Lighting works properly during the late evening and night hours.
1 Like

Thanks for this fantastic blueprint.
I’ve been playing with it and if my lights are already on, they are not triggered/adjusted to the values configured on trigger, but they are turned off at the end of the “Time Delay”. Is there a way to prevent that?

@KeKeSeB

Welcome to the community.

This is how the blueprint is designed. This allows you to make changes to your light when they are turned ON by the automation. It also helps to reduce network traffic.

If you would like it to change then you will need to create a scene or a script and input it into Lights - Switches - Scenes - Scripts and don’t use the Scenes & Scripts - Toggle Helper, leave this input empty.

Blacky :smiley:

1 Like

New update 7.8

Your lighting experience, your way – take control and customize it to perfection! :bulb::sparkles:

:new: New Feature

  • Dynamic Lighting - State Control Option
    You now have an option to enable or disable dynamic lighting based on the state of a specified entity. When the entity is in the selected activation state, dynamic lighting will function as configured. When the entity is not in the activation state, dynamic lighting will be disabled. This allows you to toggle between normal lighting and dynamic lighting based on the entity’s state.

  • Dynamic Lighting - Next Day
    With options 10, 11, 12, and 13, you can now set the time for transitioning to a new day.

:bug: Bug Fixes

  • Dynamic Lighting
    • Resolved an issue with options 10, 11, 12, and 13 that could cause excessive RAM usage and generate a critical log, depending on your settings.
    • Fixed a bug where turning OFF the bypass might not reset your lights correctly.

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:

Enjoy

Blacky :grinning:

3 Likes

Cannot save any automation. I have HA detecting presence of Aqara FP2. HA does detect presence for binary sensor binary_sensor.kitchen_occupied on the dashboards.

When I select that sensor as a trigger for this blueprint, the automation cannot be saved.
Get error: Message malformed: extra keys not allowed @ data[‘triggers’]

I chose just one entity in the subsequent dropdown. Not an area, not a device, just one light entity: light.big_kitchen_light.

kitchen_occupied is a type group in helpers with 2 entities in the group. One entity is the In Kitchen and the other is Any Area Detect. These entities show just fine on a dashboard and are working.

I do not understand why this cannot be used as a trigger.

@jrullo8

Welcome to the community.

Sorry your having troubles… You will need to update your HA if you can as I have updated the code to follow HA road map. This way you will be able to use the blueprint how HA would like it to be. Once you done that everything will work perfectly.

Blacky :smiley:

For some time now my Sensor-Light Automation has been behaving strangely.

I use the bypass function and activate the following boolean helpers via a wall switch:

  • Bypass Switch - Turn lights ON (here: bypass_bwm_diele_on)

  • Bypass Switch - Keep The Lights Current State (here: bypass_bwm_diele_keep)

    action_left_bottom_short:
      - action: light.turn_on
        target:
          entity_id:
            - light.dekoleuchten_haustuer
        data: {}
      - action: input_boolean.turn_on
        target:
          entity_id:
            - input_boolean.bypass_bwm_diele_on
            - input_boolean.bypass_bwm_diele_keep
        data: {}
    

At night, I switch the light off again using another wall switch and also deactivate the two booleans.

action_top_short:
  - action: light.turn_off
    target:
      entity_id:
        - light.dekoleuchten_haustuer
    data: {}
  - action: input_boolean.turn_off
    target:
      entity_id:
        - input_boolean.bypass_bwm_diele_on
        - input_boolean.bypass_bwm_diele_keep
    data: {}

For a few weeks now, the light has been switched off, but a motion sensor that is still active switches the light back on again immediately. I just walk through the motion sensor when I have to go to the switch.

If I then don’t switch the light off again, the light stays on for as long as configured in ‘Time Delay’.

My configuration:

alias: Bewegungsmelder Diele / Dekoleuchten
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.bwm_diele_motion
      - binary_sensor.tuerkontakt_haustuer_opening
    light_switch:
      entity_id: light.dekoleuchten_haustuer
    time_delay: 3
    motion_bypass_lights_on:
      - input_boolean.bypass_bwm_diele_on
    motion_bypass_lights_off:
      - input_boolean.bypass_bwm_diele_off
    motion_bypass_lights_stop:
      - input_boolean.bypass_bwm_diele_keep
    include_sun: sun_disabled
    sun_elevation: 0
    ambient_light_sensor: sensor.lichtsensoren
    ambient_light_value: 1300
    include_bypass:
      - bypass_enabled_turn_on
      - bypass_enabled_stop
      - bypass_enabled_turn_off
    ambient_light_options: ambient_light_option_disabled
    ambient_light_high_value: 1400
    include_ambient: ambient_enabled

Can you help me find out what I’ve done wrong here? Or has something been changed here? Thank you.

Or to put it another way: automation is somehow re-triggered.

Do you need a trace?

@Herr.Vorragend

Thanks for all the information… it makes it easy to understand.

When the bypass is turned OFF (any bypass, as long as all are OFF), the automation enters auto mode. If the motion sensor (any trigger) is ON, the automation will keep the lights ON as expected. In auto mode, the lights should remain ON if a trigger is active.

If the lights turn OFF and then back ON instantly, this is likely caused by your switch action turning the light OFF, followed by this automation turning it back ON. You can allow the automation to manage this seamlessly. Refer to the YAML adjustment example below.

Your YAML click here
action_top_short:
  - action: input_boolean.turn_off
    target:
      entity_id:
        - input_boolean.bypass_bwm_diele_on
        - input_boolean.bypass_bwm_diele_keep
    data: {}

If you want the light to turn OFF and remain OFF, even if the motion sensor is active, you can use Bypass Option 2 with the Bypass Auto OFF Option. This setup ensures the motion sensor has time to clear before the bypass turns OFF automatically. If the motion sensor is clear when the bypass turns OFF, the lights will remain OFF. Below is the YAML configuration for this setup.

Your YAML click here
alias: Bewegungsmelder Diele / Dekoleuchten
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.bwm_diele_motion
      - binary_sensor.tuerkontakt_haustuer_opening
    light_switch:
      entity_id: light.dekoleuchten_haustuer
    time_delay: 3
    motion_bypass_lights_on:
      - input_boolean.bypass_bwm_diele_on
    motion_bypass_lights_off:
      - input_boolean.bypass_bwm_diele_off
    motion_bypass_lights_stop:
      - input_boolean.bypass_bwm_diele_keep
    include_sun: sun_disabled
    sun_elevation: 0
    ambient_light_sensor: sensor.lichtsensoren
    ambient_light_value: 1300
    include_bypass:
      - bypass_enabled_turn_on
      - bypass_enabled_stop
      - bypass_enabled_turn_off
    ambient_light_options: ambient_light_option_disabled
    ambient_light_high_value: 1400
    include_ambient: ambient_enabled
    bypass_time_delay: 0.25
    include_bypass_auto_off:
      - bypass_auto_off_enabled_off
    bypass_auto_off_delay: 1

And your OFF switch would look like this

Your YAML click here
action_top_short:
  - action: input_boolean.turn_on
    target:
      entity_id:
        - input_boolean.bypass_bwm_diele_off
  - action: input_boolean.turn_off
    target:
      entity_id:
        - input_boolean.bypass_bwm_diele_on
        - input_boolean.bypass_bwm_diele_keep
    data: {}
So this is how I would do the whole setup but I am not sure why your turning 2 bypasses ON and then turning 2 OFF at the same time.

First I would group the 2 triggers, then;

action_left_bottom_short:
  - action: input_boolean.turn_on
    target:
      entity_id:
        - input_boolean.bypass_bwm_diele_on
    data: {}
action_top_short:
  - action: input_boolean.turn_on
    target:
      entity_id:
        - input_boolean.bypass_bwm_diele_off
  - action: input_boolean.turn_off
    target:
      entity_id:
        - input_boolean.bypass_bwm_diele_on
    data: {}

I have set the Bypass Auto OFF Option to 1 minute, but you may need to adjust this duration to match the time it takes for your motion sensor to clear. If the timing is too short, the bypass may turn OFF before the motion sensor clears, causing the light to turn back ON.

alias: Bewegungsmelder Diele / Dekoleuchten
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.bwm_diele_motion
      - binary_sensor.tuerkontakt_haustuer_opening
    light_switch:
      entity_id: light.dekoleuchten_haustuer
    time_delay: 3
    motion_bypass_lights_on:
      - input_boolean.bypass_bwm_diele_on
    motion_bypass_lights_off:
      - input_boolean.bypass_bwm_diele_off
    motion_bypass_lights_stop:
      - input_boolean.bypass_bwm_diele_keep
    include_sun: sun_disabled
    sun_elevation: 0
    ambient_light_sensor: sensor.lichtsensoren
    ambient_light_value: 1300
    include_bypass:
      - bypass_enabled_turn_on
      - bypass_enabled_stop
      - bypass_enabled_turn_off
    ambient_light_options: ambient_light_option_disabled
    ambient_light_high_value: 1400
    include_ambient: ambient_enabled
    include_bypass_auto_off:
      - bypass_auto_off_enabled_off
    bypass_auto_off_delay: 1

Hope this helps you.

Blacky :smiley:

1 Like

Hi, i write here because i am searching for a solution to my Z2M 2.0 Update and Blueprints. Long in the past i find this Blueprint an used it in ver2.x for my Bathroom automation. A Philips Hue motion sensor was triggering all the Automations.

Now i updated, like many others, the Z2M Version an within these the MajorUpdate effects these Bleuprints. My Problem is to understand, how can i use these Blueprint with the new eintities of Z2M ?

I mean without the legacy Mode in Z2M.
Actual my Motionsensor is not triggering the automations.

Thanks for all

Echo’ing what everyone has said, thanks @Blacky for the awesome blueprint. As a newbie to HA this was the first use-case for my setup, and it’s fantastic.

I’ve setup a scene along with a motion sensor trigger, with appropriate lux level parameters set. All works well.

I can’t seem to get my head around getting the scene to switch off when the light lux goes above a certain threshold, without motion also being detected at the same time.

Or put another way, if lux goes about X, turn off the scene (if it’s on - I’ve already got a helper toggle per the docs).

Happy to post the YAML but I think it’s my lack of mental model about how the triggers work.

Appreciate any pointers from anyone!

Question on ‘Time Delay’
I read the FAQ and the description of the features, twice but didnt see the answer to this… If the automation is re-triggered, will it restart the Time Delay?

Thus, if the time delay is set to 5 minutes, and the motion sensor gets retriggered at 3 minutes, does the automation “restart” the countdown for the Time Delay or will the first triggering still turn the light off after 5 minutes?

In my old automation system, we had to manually ‘clear’ the delayed action… so every automation I just added a line to clear it.

I use motion lighting in different rooms, in different way…

  1. Must be Manually turned on, then want to keep the light on until N minutes after motion is no longer detected. (this is for most of my rooms)
  2. When motion is sensed, the light turns on and stays on until N minutes after motion is no longer detected.

These are the ‘core’ of the automations I need… of course, there are variations on some of these based on Time of Day, Lux, etc, in addition to the above descriptions.

thanks for the clarification on how the Time Day works.

Thanks for pointing me in the right direction, updated to latest and will go pursue your lead. Thanks for the great blueprint and support!!
C

1 Like

Hey. Could please add another condition
Ive got cats and i dont want that they turn on the ligjts while i am at bed. So my current Automation (self made and not very advanced) uses the state of alarmo. So when alarmo is Set to Night the lights dont turn on :smiley:

Thanks in advance

@jmmmm4

Thanks for your kind words and welcome to the community.

If you are using scenes then you will need to do a few things.

  1. Add a toggle helper into Scenes & Scripts - Toggle Helper, critical for what your doing.
  2. Add a scene with all your lights OFF in Scenes - Scripts To Turn OFF
  3. In ambient section make sure you have selected NO - My Ambient Light Sensor is not affected by the Lights then use your Ambient Light - High Lux Value and set the value you would like your lights to turn OFF.

Then test it and it should work.

Blacky :smiley: