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

@Blacky
I have a problem.
The light automation worked fine for several weeks and suddenly it stopped working.
I have tried several things: I upgraded to version 7.1 and rebuilt the automation with fewer features enabled.
Iā€™ve found that dynamic lighting breaks the automation.
If I enable it with option 1 ā€œLux Controlled Brightnessā€ it does not work anymore.
I checked the light sensor and it reports a value between 0 and 2 lux because it is dark. But if I happen to set the presence sensor to occupied the toggle assistant goes to true but the light switch is not enabled. Maybe this is related to a Home Assistant update?
I have 2024.8.1

Thanks for your help!

@stebl27

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:

If I use a non lux based dynamic option seems to work. Only using the lux ones donā€™t turn in the lights here is my yaml with latest version


alias: Master bedroom lamps
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.0x0017880104b788af_occupancy
    light_switch:
      entity_id: light.masterbedroomlamps
    time_delay: 5
    light_brightness: 50
    light_colour_temperature: 2000
    include_light_control: []
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.0x0017880104b788af_illuminance_lux
    ambient_light_options: ambient_light_option_disabled
    ambient_light_value: 0
    ambient_light_high_value: 70
    include_dynamic_lighting: enable_sun_elevation_colour_lux_brightness_inv
    dynamic_lighting_lux_sensor: sensor.0x0017880104b788af_illuminance_lux
    dynamic_lighting_min_lux: 0
    dynamic_lighting_max_lux: 70
    dynamic_lighting_max_brightness: 60
    dynamic_lighting_min_brightness: 1
    include_bypass:
      - bypass_enabled_turn_off
    motion_bypass_lights_stop: []
    dynamic_lighting_boolean: input_boolean.master_bedroom_lamp_toggle
    motion_bypass_lights_off:
      - input_boolean.masterbedroom_light_override
    include_sun: sun_disabled

@rs_007

Each light manufacture is different and you may find that your lights will only come ON above a higher value like >8%. You will have to test out your lights and find the minimum operating value.

Also disable your ambient.

Blacky :smiley:

@Blacky Thank you very much for creating this really great blueprint. My use case is not to use motion sensors to activate the automation, but instead to use a binary sensor as a trigger.
This binary sensor is presented as a virtual switch in apple homekit.

Basically, my use case is to have a ā€œbuttonā€ in homekit to turn on dynamic lighting, but also have the option for my family to use manual control of the lights in apple homekit. For example, turn-on, turn-off, adjust brightness etc. If you want to switch back to dynamic lights, just trigger the dynamic sensor again via the toggle in apple homekit.

This seems to work well if the lights are not turned off or on in apple homekit. If they are, the automation seems to break and the lights will not turn on or automatically update their LUX value etc.
To clarify, this is the use case I am looking for.

  1. Ability to ā€œturn on dynamic lightsā€ via a switch, which will turn on the lights and automatically update the lux values, brightness etc via the automation.

  2. if turning off the switch, the light will also turn off and pause the automation.

  3. Ability to manually control the lights via third party applications such as apple homekit. If the lights are manually changed, do not allow the blueprint to change the lights until the trigger mode switch is turned off, then on again.

I have had a look at the bypass options, but I believe I would need another toggle switch exposed to homekit to do this which does make it more complex for my family to understand. Is there any easy way to configure the blueprint to do this?

@davquinney

Have a look at this blueprint :high_brightness: Smart Light - Entity - Sun Elevation - Ambient & Time Triggers then use the state trigger with your switch in homekit. The switch must have an ON / OFF state.

Blacky :smiley:

allright! Will take a look at this other blueprint. From a quick scan of it, seems to meet my requirements pretty well. Thanks for all your contributions!

Thank you, when I get home from work tonight Iā€™ll have a look.

Hi @Blacky! Still learning how to use your great blueprints, thank you for making them!

I want my lights on a different level after sunset than before. I was thinking about adding a scene that your BP fires and make it such:
If day_helper is on, set lights as such
Else set lights as such.

Now thatā€™s pretty easy, but I want to take advantage of the dynamic light control. I donā€™t suppose this way the lights would get the control from your BP.

I can, of course, make two automations, one for day and one for night, and add the day_helper as a trigger. However I have about 8 lights (including the decorative led strips) in my living room, and these would require 8 different automations, so if I have to make two for each, it would be a lot of automationsā€¦.my OCD is triggered by only thinking about this :sweat_smile:

Do you maybe have a better idea? Thanks

@Blacky
Thanks for your fast response. It seems @rs_007 has the same problem. But in my case Iā€™m sure that it isnā€™t related to the lamp because it worked some days ago without problems.
Here my Yaml:


alias: Sensor Light
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.presence_sensor_arbeitszimmer_presence
    light_switch:
      entity_id: light.kinderzimmer_licht
    time_delay: 0
    include_dynamic_lighting: enable_lux_controled_brightness
    dynamic_lighting_boolean: input_boolean.dynamic_lighting_toggle_helper_arbeitszimmer
    dynamic_lighting_lux_sensor: sensor.presence_sensor_arbeitszimmer_illuminance_lux
    include_bypass: []
    motion_bypass_lights_stop: []
    include_ambient: ambient_disabled
    ambient_light_options: ambient_light_option_disabled

With this options, if there are 0-3 lux and presence sensor reports occupied, no light turns on. If I change the settings from lux controlled to sun controlled it works.
Sometimes I see an exception in the trace that a readonly dictionary contains no lux attribute. But this exception is only sometimes and if the exception does not occur it does not work either.

@rbhun

Your welcome.

Dynamic lighting will only work with light entities and not scenes. Dynamic lighting only works for normal lights not night lights. Lights collapsible section is what I call Normal lights.

If you would like dynamic lighting during the day then you would add your lights in normal lights.

Then if you would like different lights after sunset then you would add those lights into night lights and choose the Night Lights Conditions for sun by Enable sun elevation option. Set up your elevation settings for night lights.

Now you will have different lights after sunset but they will not be dynamically controlled. You just set your Night Light Control.

Hope this is what you are after.

Blacky :smiley:

@stebl27

I have tested your YAML here and I cant fault it, works perfectly.

If it work a few days ago then it should still work.

I would look at this, sometimes in HA it report a LUX value but the actual sensor is offline (unavailable). Is this a battery one? I have 3 Shelly motion / LUX sensors that are all paper weights now.

Blacky :smiley:

Hi @Blacky,

Iā€™m using this to control a floodlight from a motion sensor in the garden. But Iā€™d like to keep the floodlight from activating if our garden lights are on (as we will probably be sitting in the garden and donā€™t want the floodlight activating on and off).

Iā€™ve put the garden lights entity Bypass 2 - turn lights off.

This works - the floodlight doesnā€™t get activated when the garden lights are on. However, when I turn the garden lights off, the floodlight is activated immediately, even if no motion is detected at the time.

Is there a way to avoid this or have I bypassed it incorrectly?

Thanks.

@lewisb79

Hi Lewis,

You will find that the motion is ON. I tested it here again and it will only turn the light ON if the trigger is ON when you turn the bypass OFF. Sometimes the lights turning OFF can trigger the motion sensor so maybe check or look at your motion state when you do it.

Blacky :smiley:

Hi, motion definitely not activate when switching the garden lights off, the floodlight comes on without fail every time. Even if the floodlight wasnā€™t on when the garden lights were turned on.

alias: Garden Floodlight Motion
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.back_garden_hue_motion_detector_occupancy
    light_switch:
      entity_id: switch.floodlight
    time_delay: 0.3
    include_sun: sun_enabled
    ambient_light_options: ambient_light_option_enabled
    ambient_light_sensor: sensor.back_garden_hue_motion_detector_illuminance_lux
    include_bypass:
      - bypass_enabled_turn_off
    motion_bypass_lights_on: []
    motion_bypass_lights_off:
      - switch.garden_lights_group
    include_ambient: ambient_enabled

@lewisb79

Thanks for your YAML. I tested it here using your YAML and it works perfectly. The motion has to be ON for the flood light to turn ON when the bypass is turned OFF. If the motion is not ON then when you turn the bypass OFF the flood light remain OFF.

Please check again as it is working here.

Blacky :smiley:

The way the bypass Auto-off is worded is currently confusing, as it doesnā€™t suggest that one needs the check a box that specifically corresponds to the bypass option previously selected. May I suggest that you update it to something like:

include_bypass_auto_off:
          name: Use The Bypass Auto OFF Option (Optional)
          description: This is used when you turn ON the bypass and want it to automatically turn OFF after a set time delay.
            You have to choose which bypass option you would like to apply the auto OFF feature to
          default: []
          selector:
            select:
              options:
                - label: Enable the auto OFF for '1 - Enable the Bypass - Turn lights ON'
                  value: "bypass_auto_off_enabled_on"
                - label: Enable the auto OFF for '2 - Enable the Bypass - Turn lights OFF'
                  value: "bypass_auto_off_enabled_off"
                - label: Enable the auto OFF for '3 - Enable the Bypass - Keep the lights current state'
                  value: "bypass_auto_off_enabled_stop"
              multiple: true

There are other sections of the configuration which require similar attention and I found myself confused by them previously, too. I believe some new way of wording those description would help to make sure a user doesnā€™t get confused here.

ill give it a shot. i think when manually selecting the lights brightness values 1% should work. these are hue light bulbs if it matters.

Hi @Blacky. Thanks for this blueprint! FYI: Somewhere between 6.x and 7.1 the Nightlight light/scene/script entities lost the ability to be a scene entity. It only tries to turn on lights and run scripts. Cheers!

Actually, I found that if I remove the scene entity and then add it again, it starts working. It must be a wrinkle in the jump between 6.x and 7.1. This happened on every instance of this blueprint. No worries. Itā€™s probably not worth investigating.