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

Hi Blacky,

I want to control the brightness of my kitchen lights using the lux sensor, but sometimes I want to override the brightness manually with a button for X minutes. I could use a bypass for that, but I still want to control the on/off state using the presence sensor I have. Is there a way to do this within the blueprint, or should I make a second automation for this?

Second, might it be an idea to move the FAQ and manual to a GitHub wiki instead of this forum? It’s super difficult to find what I’m looking for in the 3k comments here.

Thanks for the awesome blueprint!

1 Like

Hi @Blacky! Thank you for the great blueprint.

I have an innovelli smart light switch which sometimes is in the ā€œOnā€ state while the lights have been turned off manually in the HA app or through another automation.

How could I adjust the blueprint to trigger off an event (such as button press), so that even if the state doesn’t change the lights still react correctly?

I am considering whether to use this for my garage lights, I have lux sensors, presence and motion sensors grouped into appropriate helpers.

But here’s the kicker. My garage lights are on a relay that can also be turned on by a physical switch.

I want that physical switch to also be a "trigger* for turning on the lights for the specified time frame that is in the Smart sensor blueprint.

So I have that set for 2 minutes. If it’s dark, and occupancy is detected, turn on the lights, keep them on for 2 minutes after occupancy is no longer detected. If the lights are turned on manually, ALSO keep on for 2 minutes or indefinitely if there’s occupancy.

1 Like

Hello @Blacky,

unfortunately I get an error message with your blueprint:

I previously used your blueprint with IKEA motion detectors and lights via ZHA. This worked without any problems.

Now I have changed the entire installation to Zigbee2MQTT and also adapted or recreated the automations with your blueprints. Unfortunately, these no longer work and give the following error message in the log:

Logger: homeassistant.components.automation.test_sensor_blueprint
Source: components/automation/__init__. py:663
Integration: Automation (documentation, problems)
First occurred: 20:04:21 (5 occurrences)
Last logged: 20:22:49
Error rendering variables: UndefinedError: ā€˜dict object’ has no attribute ā€˜entity_id’

I have completely recreated the automations as a test with your blueprint, very simple, just a motion detector and a light; but always the same error, no matter which devices I use.

Do you have any ideas? What other information can I provide to narrow down the problem further? I have updated everything in Home Assistant to the latest versions.

Thank you in advance

@sebcbien

I think what your asking is when the lux is above 200 then the light should not come ON with movement but when below 200 say 199 the brightness should be 100% and then when it gets to 2 lux the brightness should be 50% (looking at your sketch)

I have enabled ambient. Below is your code.

description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - input_boolean.salon_salon_mvt_1486
    include_dynamic_lighting: enable_sun_elevation_colour_lux_brightness_inv
    dynamic_lighting_min_brightness: 50
    dynamic_lighting_min_colour_temp: 2000
    dynamic_lighting_max_colour_temp: 5000
    night_lights_conditions:
      - entity_state_enabled
    time_delay: 4.5
    dynamic_lighting_state_control_entity: input_boolean.dynamic_light_rez
    motion_bypass_lights_stop:
      - input_boolean.mode_rez_auto
      - input_boolean.modes_rez_dimmed
    dynamic_lighting_lux_sensor: sensor.cuisine_cuisine_luminosite_2236
    include_bypass:
      - bypass_enabled_stop
    light_transition_off: 10
    include_light_control:
      - use_transition
      - use_brightness
    light_transition_on: 1.5
    dynamic_lighting_state_control: enable_state_control
    include_night_lights: night_lights_enabled
    night_lights_entity_state:
      - input_boolean.nightlight
    night_lights_after_time: "21:00:00"
    night_lights_before_time: "05:00:00"
    night_lights:
      entity_id: light.salon_salon_1948
    include_night_light_control:
      - use_brightness
      - use_transition
    include_night_light_colour_control: use_rgb_colour
    night_light_colour_temperature: 2000
    night_light_brightness: 5
    night_light_rgb_colour:
      - 255
      - 143
      - 31
    light_switch:
      entity_id: light.salon_salon_1948
    light_brightness: 90
    dynamic_lighting_max_lux: 200
    dynamic_lighting_min_lux: 2
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.cuisine_cuisine_luminosite_2236
    ambient_light_high_value: 220
    ambient_light_value: 200

Blacky :grinning:

@jose1711

That could be it. When it is unavailable HA cant see brightness but when it is ON it can see it.

Blacky :grinning:

@koechi75

Nope

Blacky :grinning:

@Apron3130

Rather than using a schedule helper use a Times of the Day Sensor. Set your times to 4-9 PM. Once you create the Times of the Day Sensor helper then create a group helper and group your Motion and Times of the Day Sensor. Then use the group helper as the trigger only.

HA will not allow you to group different domains like a motion sensor and a schedule helper so this is why we need to create the Times of the Day Sensor.

Once you do this it will work.

Blacky :grinning:

@DariusM73

Dynamic Lighting only works for normal lights and it was designed for when light conditions would change like during the day with natural light. Night lights should have a consistent value as it is dark. Then the logic changes at night with the option of glow lights. There is a lot of logic that all has to work together in the one blueprint.

Glad you got it working.

Blacky :grinning:

@LarsStegman

You can manually change the brightness once the lights are ON, and they should stay that way until the automation turns them OFF.

If you’re looking to press a button that temporarily changes the brightness for a set amount of time and then reverts back, you could use the Night Lights state condition. For example, when the button is pressed, it could turn ON a toggle helper for X minutes, then automatically turn it OFF.

I have other blueprints that can handle this toggle behavior, but you could also create a simple automation that turns the toggle ON and OFF when the button is pressed.

Once the toggle helper is created, add it to Night Lights as the Entity State condition, set the desired brightness in Night Lights, and make sure to enable ā€œIf lights are ON, adjust the lights when crossing overā€ in the Night Light control options.

When I first started, I never expected my blueprints to grow the way they have.

I’ve added links to the FAQ… including references back to the main FAQ… but at the end of the day, it all takes time. Lately, most of my spare time is spent answering questions rather than developing new features.

That said, I do hear what you’re saying.

Thanks for your kind words.

Blacky :grinning:

@Ahrens7640

The blueprint is designed to work off an ON and OFF state not a any state change.

Blacky :grinning:

@tezvienna

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 :grinning:

@gregshome

The bypass will override all the settings even time options.

Blacky :grinning:

@supermopf

Hi Victor,

Thanks for reaching out and your well written bug report.

I used your YAML and just replace the entities with mine. So we have the exact same settings.

  1. When I activate the trigger the light turns ON 100%.
  2. I then activate night lights and the lights transition to 5%.
  3. Then I deactivate the trigger to start the night light time delay.
  4. During the night lights time delay I then deactivate night lights and the lights go to 100% and start the timer for normal lights.
  5. The lights turn OFF after the normal lights delay.

Works perfect :thinking: Try another test.

  1. When I activate the trigger the light turns ON 100%.
  2. I then activate night lights and the lights transition to 5%.
  3. I then deactivate night lights and the lights go to 100%.

Works perfect :thinking:

Sorry I can’t find the bug.

Note your using toggle helpers in Scenes & Scripts - Toggle Helper and Night Lights - Scenes & Scripts - Toggle Helper. You don’t need to use toggle helpers when using lights. This is only required when using scenes and scripts.

Blacky :grinning:

@Blacky Thank you for your quick reply. Here“s the code:

alias: Test Sensor Blueprint
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.bewegungsmelder_reserve_occupancy
    light_switch:
      device_id: e6121ca92bafe6d255b7c8eea23db0be

@tezvienna

You using a device in Lights - Switches - Scenes - Scripts you will need to only use entities. See this FAQ click here

Blacky :grinning:

@Blacky
Ah, thanks, it worked!

Sorry, I thought it was configured that way before, my mistake.

Best regards from Vienna!

@Blacky

Not sure if you got the point - as you suggested, I’m using the night glow and night light during day/evening, but as I learnt here dynamic light is not available. So, the ā€œflippedā€ logic basically works but useless finally, as there is not dynamic light. I also tried it with a combination of smart light and sensor light for motion - but there is no option in dynamic light to come back from motion light of 100% to 20% (ambient light level) - only using a scene, but also here no way to use dynamic light.Could you have one more view on the use case and your proposal? Br Darius

Hi Blacky,
since I updated to core 2025.4.2, my automations with your blueprint don’t work anymore, only the nightlights do. I use the dynamic lightning in my home office, which normally starts two lights. I can see that the automation is triggered, but it just doesn’t do anything. I then start the lamps manually, also start the automation manually and hope for brightness correction throughout the day, but that doesn’t work either. Funny thing, turning the lamps off does work, sort of. It brings them to a state that would be used while running (4500K and 90% brightness). Then I have one in my gaming area that should start the colorloop on my Hue lamp with a script. Again, I see that the automation has been started, but it does not. When I start the script manually, the lamp turns on and goes into colorloop mode. Since I have not changed anything in the automations or the lamps, I assume it is the latest update to 2025.4.2. Have you had similar experiences? Any suggestions what to do?
Kind Regards

Edit:

alias: Arbeitslicht
description: >-
  Regelt das Licht im Wohnzimmer wenn ich am Arbeitsplatz sitze. Es soll immer
  hell genug am Arbeitsplatz sein.
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.am_arbeiten
    light_switch:
      entity_id:
        - light.lampe_basti_arbeit
        - light.wohnzimmer_decke
    dynamic_lighting_lux_sensor: sensor.arbeit_presence_sensor_illuminance
    include_dynamic_lighting: enable_lux_controled_brightness
    dynamic_lighting_heartbeat: 0.25
    dynamic_lighting_state_control: enable_state_control
    dynamic_lighting_state_control_entity: binary_sensor.pc_an
    include_light_control: []
    dynamic_lighting_min_brightness: 0
    dynamic_lighting_max_lux: 600
    dynamic_lighting_min_lux: 500
    end_scenes:
      - scene.wohnzimmer_start
    dynamic_lighting_min_colour_temp: 4500
    dynamic_lighting_max_colour_temp: 4500
    dynamic_lighting_step_value: 2
    dynamic_lighting_dead_zone: 8
    light_colour_temperature: 4500
    include_light_colour_control: use_colour_temperature
    dynamic_lighting_boolean: input_boolean.wohnzimmer_arbeitslicht

The binary Sensor for starting the automation (for which I don’t know how to get the YAML code):


@Blacky
I just found your Sensor Light Blueprint and the features fit exactly what I want to accomplish. I have a room with 4 Philips Hue Lights and an Aqara FP2 presence/lux sensor. I want to manage the lights based on motion, ambient light level, and adjust the lighting dynamically.

The automation is triggering correctly but my lights come on at about 5% brightess with a very low color temp. regardless of the settings in the blueprint. I have tried the using the light control settings to bring the lights up in brightness and I have tried the dynamic lighting settings with several different configurations. But, to no avail, no matter the settings my lights come on at about 5% brightess with a very low color temp.

I’ve been reading through the documentation but haven’t found the answer yet. If I’ve missed something and you can point me in the right direction that would be greatly appreciated!

Thanks!
Tom G.