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

hmm is it possible the automation doesn’t work if one of the lights is unavailable?

@Blacky Hey, I’m not really sure I understand the concept of “Bypass Switch - Keep The Lights Current State.”
I created a boolean and added it to the correct section, but when I activate it, the trigger still works as if it was never paused. Then, when I try to turn off the bypass, it turns on the light.
Does anyone know what’s wrong?

I have a feature request, hope this is the right place for it.

I’d like a bypass for both maximum and minimum. When the bypass for maximum is on, it will set the lights to Dynamic Lighting maximum (brightness and temperature) or the next time the lights turn on (if the bypass is still on).

@linuxfreak

I tested it here again and it works perfectly.

Please check all your settings.

I had Ambient Light - Low Lux Value = 5 and Ambient Light - High Lux Value = 20 for testing.

Motion ON, ambient at 12.5 then drop to 5.2, light still OFF, then drop to 4.5 light ON, raise to 12.5 light still ON then raise to 22.5 light OFF.

Blacky :smiley:

@MR-c607

Welcome to the community.

There is a new thing coming to dynamic lighting. I thought it would be out in the last update but I ran out of time. Check in every now and again for the next release.

Blacky :smiley:

@tman98

See Required = *, so you need normal lights.

If you are wanting a glow and then trigger when someone walks by only with sun condition then look at :high_brightness: Smart Light blueprint. Set your sun trigger, then set the lights to your glow %. Then enable night lights and use Enable entity state option as the condition. Enter in your motion sensor. Add your light in again to night lights. In Night Light Control select If lights are ON, adjust the lights when crossing over and Use cross over time delay from night lights to normal lights + brightness to what you would like.

If you got any more questions on the smart light blueprint then ask in that post.

Blacky :smiley:

@herbert1910

Yes you can. Crete a toggle helper and add this into the trigger (copy, paste the entity ID in and save). This will now act like a trigger but you just turn it ON. If it is OFF then the automation will be disabled. Then set up your ambient as required. It will now trigger on ambient.

Blacky :smiley:

@Creatier

No everything is working here perfectly and I am on the latest. Some people that use Z2M have reported a change in the sensor ID in the update. This is the post that fixes it and have a look around this post as they also talk about it. Click Here

Not sure if this helps you but if not then let us know and maybe provide your YAML of your automation settings.

Blacky :smiley:

@victoroos

I quickly tested it with switch domains and it still worked.

Blacky :smiley:

@yvan2001

Welcome to the community.

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:

@ajma

Thanks for you suggestion I will add it to the suggestion list.

Blacky :smiley:

1 Like
alias: veranda light motion
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.sensor_veranda_motion_occupancy
    light_switch:
      entity_id:
        - light.veranda_light
    time_delay: 5
    include_light_control:
      - use_brightness
      - use_transition
    light_transition_off: 2
    light_transition_on: 0
    include_sun: sun_enabled
    include_dynamic_lighting: enable_sun_elevation_brightness
    motion_bypass_lights_stop:
      - input_boolean.sensor_light_bypass
    include_bypass:
      - bypass_enabled_stop
    bypass_time_delay: 0.25
    motion_bypass_lights_on: []
    motion_bypass_lights_off: []
    include_bypass_auto_off:
      - bypass_auto_off_enabled_stop
    bypass_auto_off_delay: 1

Thank you for your answer.
Do you mean creating a helper that goes on via automation when the brightness falls below a certain value?

@yvan2001

Thanks for your YAML.

In dynamic lighting you will need to enter in a toggle helper into Dynamic Lighting - Toggle Helper as you have your brightness set to 0.

When you turn ON your Bypass it will turn OFF in 1 min so you may think it is not working because it only last 1 min. This is the Bypass Auto OFF - Time Delay setting you have.

Blacky :smiley:

@herbert1910

No, create a toggle helper and use it as the trigger. While you can’t select the toggle helper directly, you can copy and paste its entity ID into the trigger input field. Once the helper is configured, turning it ON will activate the automation. The ambient settings will then manage the automation, automatically switching the lights ON and OFF as needed.

Hope this make scene.

Blacky :smiley:

Hi Blacky! Thanks for the amazing blueprint and the support you provide here.

I recently enabled my first automation from this blueprint. I now noticed that it seems to consume a lot of RAM causing HA to become unresponsive. It seems there is a related infinite recursion / stackover flow. In more detail, I observed the following:

First, I had configured the automation without toggle helper (1 motion sensor, one light entity, dynamic lighting mode 13). When the motion sensor was triggered frequently, RAM usage went from 25% up to around 80-90%.

In the screenshot above, I restarted HA at 19:15, but RAM usage went up again afterwards.

In the log, I discovered critical log messages such as this:

Logger: homeassistant.helpers.script
Source: helpers/script.py:1015
First ocurrence: 20:02:12 (1 ocurrences)
Last logged: 20:02:12

Until condition [{'value_template': Template<template=({{ ((dynamic_lighting_boolean == []) and (expand(light_entities) | selectattr('state', '==', 'off') | list | count > 0)) or ((dynamic_lighting_boolean != []) and (is_state(dynamic_lighting_boolean, 'off'))) }}) renders=42132>, 'condition': 'template'}] in script `Flur Sensor Light: Choose at step 1: default: Parallel actions for dynamic lighting and normal lights: parallel 1: Choose at step 15: 13 - Dynamic Lighting - Time Controlled - Brightness` terminated because it looped 10000 times

This is the infinite recursion / stackoverflow I mentioned above. More observations on that later.

Then, I disabled the automation. The RAM did not go up. When I enabled it again and triggered the motion sensor, RAM usage raised again, and the errors occurred again.

Due to a recommendation from a friend, I then added a toggle helper. (Previously, I figured I do not need a toggle helper because I did not trigger my own scenes or scripts.) This changed the behavior to the following:

One “cluster” of triggering the motion sensor still causes RAM usage to raise, but only up to around 45%. Interestingly, at exactly the point where the rise stops, I see the stackoverflow message.
Later, I triggered the motion sensor again, which added another 25% until it encountered the error again.

So, from my outside perspective I suppose the following happens:

  • There is an underlying infinite recursion (apparently related to dynamic lighting guessing from the error message), which quickly takes up a lot of RAM while the recursions pile up.
  • Without toggle helper, multiple instances of the automation overlap, so the RAM usage quickly gets pretty high.
  • With toggle helper, only one instance of the automation runs at a time. When the instance is killed due to the high number of recursions, the RAM usage rise stops. However, it seems that the resources are not properly freed (might be a Python thing?). So the next instance of the automation adds another step until it crashes again.

On a side note, it seems that the RAM that was covered one is not freed quickly. Restarting HA brought the RAM back down to ~25%. But it seemed the system only forcefully freed RAM when the usage was very high (~90%). However, but I did not observe that for more than half an hour, so it might be different after more time.

tl;dr: It seems that in my setup, the automation enters an infinite recursion, which consumes a lot of RAM until it hits a stack overflow.

Dear Blacky, do you have any ideas on that topic? Sorry for the long post, but I hope it was possible to follow along.

For completeness, I am using version 7.6 of the blueprint. Here is the YAML of my automation:

Click to expand
alias: Flur Sensor Light
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.flur_bewegungsmelder_bewegung
    light_switch:
      entity_id:
        - light.flur_licht_leuchte
    time_delay: 1
    include_light_control:
      - use_transition
      - use_colour_temperature
      - use_brightness
    light_transition_off: 5
    light_transition_on: 0.5
    light_colour_temperature: 3400
    include_night_lights: night_lights_enabled
    night_lights:
      entity_id:
        - light.flur_licht_leuchte
    night_time_delay: 0
    include_night_light_control:
      - use_brightness
      - use_colour_temperature
      - use_transition
    night_light_colour_temperature: 1900
    night_light_brightness: 1
    night_light_transition_off: 10
    night_lights_conditions:
      - time_enabled
    night_lights_before_time: "05:30:00"
    include_light_colour_control: use_colour_temperature
    include_night_light_colour_control: use_colour_temperature
    include_dynamic_lighting: enable_time_controled_colour_brightness
    dynamic_lighting_max_colour_temp: 3400
    dynamic_lighting_min_colour_temp: 2500
    dynamic_lighting_time_start_morning: "05:30:00"
    dynamic_lighting_time_end_morning: "06:30:00"
    dynamic_lighting_time_end_evening: "00:00:00"
    dynamic_lighting_heartbeat: 5
    dynamic_lighting_time_start_evening: "19:00:00"
    night_lights_after_time: "23:00:00"
    dynamic_lighting_min_brightness: 99
    boolean_scenes_scripts: input_boolean.flur_sensor_light_toggle_helper

I appreciate any help! I would really love to get the blueprint to work stably in my setup, since so many work and love already went into it! Let me know if I can provide more info or test anything specific.

Best, Rhidus

2 Likes

@Rhidus

Thank you for your detailed post and thorough testing… it was incredibly helpful in identifying the issue quickly. I truly appreciate your effort!

The problem stemmed from a bug in the condition logic that caused an unintended loop. :pensive:

This has now been fixed, and the updated blueprint should resolve the issue. :raised_hands: Please update the blueprint, test it, and let us know if the problem is resolved.

Once again, thank you for reporting this bug and helping improve the blueprint! :blush:

I have also updated your YAML but I am not sure if this is what you are after as some of your setting may be from testing.

  1. Because in dynamic lighting your brightness is from 100% to 99% and you are using option 13 I changed it to option 10 and your 100 % brightness will be handled in light control.
  2. Removed your toggle helper as it is not needed.
  3. In dynamic lighting changed the Dynamic Lighting - Time Evening - End Point to be 11pm so you will finally reach your Dynamic Lighting - Min Colour Temperature.
  4. In Night Light Control I selected If lights are ON, adjust the lights when crossing over. This way they will change when the time crosses over from normal light to night lights and vice versa.
Click to expand
alias: A Sensor Light - Forum
description: ""
use_blueprint:
  path: craig/new-option-sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.flur_bewegungsmelder_bewegung
    light_switch:
      entity_id:
        - light.flur_licht_leuchte
    time_delay: 1
    include_light_control:
      - use_transition
      - use_colour_temperature
      - use_brightness
    light_transition_off: 5
    light_transition_on: 0.5
    light_colour_temperature: 3400
    include_night_lights: night_lights_enabled
    night_lights:
      entity_id:
        - light.flur_licht_leuchte
    night_time_delay: 0
    include_night_light_control:
      - use_brightness
      - use_colour_temperature
      - use_transition
      - if_lights_are_on_adjust_when_crossing_over
    night_light_colour_temperature: 1900
    night_light_brightness: 1
    night_light_transition_off: 10
    night_lights_conditions:
      - time_enabled
    night_lights_before_time: "05:30:00"
    include_light_colour_control: use_colour_temperature
    include_night_light_colour_control: use_colour_temperature
    include_dynamic_lighting: enable_time_controled_colour
    dynamic_lighting_max_colour_temp: 3400
    dynamic_lighting_min_colour_temp: 2500
    dynamic_lighting_time_start_morning: "05:30:00"
    dynamic_lighting_time_end_morning: "06:30:00"
    dynamic_lighting_time_end_evening: "23:00:00"
    dynamic_lighting_heartbeat: 5
    dynamic_lighting_time_start_evening: "19:00:00"
    night_lights_after_time: "23:00:00"
    dynamic_lighting_min_brightness: 99

Blacky :smiley:

1 Like

But then the entire automation is deactivated.
I actually meant that the light should come on when the LUX value of a sensor goes below a certain value. so use the LUX sensor as a TRIGGER.

@herbert1910

When you turn ON the toggle helper the automation will be active. It will then trigger on the lux sensor but it has to cross over.

If you are having problems 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.

Make sure you add your helper in so I can edit your YAML.

Blacky :smiley:

Blacky

New update 7.7

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

:bug: Bug Fixes

  • Dynamic Lighting - A bug affecting dynamic lighting options 10, 11, 12, and 13 has been fixed. Previously, re-triggering the automation caused a loop that consumed excessive RAM and issued a critical log. This issue was caused by a single condition leading to an unintended loop. :pensive:

    The updated blueprint resolves this problem. :raised_hands: Please update your blueprint promptly to apply the fix.

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:

1 Like