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

@ingmarstein

Yeah, it can be confusing as there are so many options… I am here to help if you need it. I think you will be all good now.

Enjoy

Blacky :grinning:

I’ve checked Your code end i’ve tried this before, but it’s not the plan of automation. I understood the function which You implemented, but for my purposes is not works as i want., because depend on state of ā€œdoorsā€ lights bypass steering the action. But I just look for a function to do not allow to turn off light if at the end of automation door state is OFF/ON. Sure , i can create two separate automations, for Turn ON and OFF with enabled correct bypass.

@Grey

I thought that when I read your YAML but I didn’t ask because we all do it in our own way.

Maybe you can explain what you are trying to do again because from your last explanation this would work.

This statement ā€œIf the door sensor is OFF (Closed) or ON (Open)ā€. You can’t have both.

  1. Do you want to keep the light ON when the door is open?
  2. Do you want to keep the light ON when the door is closed?

Questions:

  1. You have a bathroom door contact sensor?
  2. Do you have a motion sensor in the bathroom? This binary_sensor.motion_sensor_hall_occupancy would indicate it is in the hall way.
  3. Are you trying to keep the light ON when someone is in the bathroom and the door is closed?

Maybe try to give a scenario of what you would like to happen. Example: Walk into bathroom light turns ON, close the door and have a shower behind a shower screen where the motion sensor can’t detect me. Because of this the light turns OFF. I am trying to find a way using my door sensor to keep the light ON.

Blacky :grinning:

Walk into bathroom , lights ON for a 1 minute but if i have plan to stay longer for a shower the light are not turning off . Shower doors have a contact sensor .

Amazing automatization, thanks!!!.

Is there any easy way to use a timer as bypass entity?. I have tried to do it directly but it is not working. I suppose that is because the actions used in the timer doesn’t triggers the blueprint because doesn’t matches the switch/binary actions.

What I wanted to do is to use the sun elevation to enable the automation only at night (easy). The automation will be triggered by a movement detector which works perfectly (easy), but I also want to turn on the lights for a period of time when the automation time starts, ignoring the detector state.
Just now I have an automation that triggers at sunset to start the timers, then another automation turns the lights on while the timers are running and a third automation triggers at movement detection but just when the timers are not running. This is a bit tedious and that is why I want to replace it.
I have tried to fit this into your blueprint but I have seen that I can do the following:

  • Turn on the lights at movement detection
  • Enable it only at night using a time schedule or the sun elevation
  • Turn on the light using a scheduler helper.
  • Override/bypass the state by using an entity (I suppose that a binary sensor or a switch)

But the way to archieve what I want seems to be using a bunch of extra automations and helpers like for example turn a binary helper when the timer is running or similar, and that is what I want to avoid because it is almost what I have right now.

Best regards.

@Grey

That is a hard set up because I would assume the shower door is always closed.

  1. Do you have a door to the bathroom?
  2. If you have a door on the bathroom. Do you close the door when showering?
  3. Do you have an exhaust fan the HA can see?

Blacky :grinning:

@Danixu

Turn on the lights at movement detection

  • Use a motion sensor.

Enable it only at night using a time schedule or the sun elevation

  • Time: You have time option. If you need all diffrent times then use a shedule helper and add it into the State Control Option.
  • Use sun elevation.

Turn on the light using a scheduler helper.

  • If you would like it to stay ON with this schedule helper create one and add it to bypass option 1.

Override/bypass the state by using an entity (I suppose that a binary sensor or a switch)

  • You can use any entity that has an ON / OFF state. Note: If you use a binary sensor (or anything you can’t manually turn ON or OFF) then you can’t use the auto OFF feature.

I not sure what you are trying to do or if you are explaining you have your own automations but you should be able to do this all in one blueprint automation.

Trigger is motion, turn light ON, use the time delay in the blueprint (is this what your timer is for? If so you don’t need one, just use the time delay). Then if you would like the light to be ON between X and Y then use the bypass option 1 with a schedule helper.

The timer running thing… this is what is confusing me. A timer state when running is active not ON. If you need to make a timer ON / OFF then you would create a template binary sensor helper and you would use this code replacing the ID with your timer.

This is not including paused state of the timer

{{ states('timer.your_timer_here') == 'active' }}

This includes paused state

{{ states('timer.your_timer_here') in ['active', 'paused'] }}

Once you have this template binary sensor helper you can use it in the bypass. Now when your timer is active (running) the binary sensor will be ON. Then add it to the bypass option you would like to do when the timer is ON. But not sure why your using a timer…

Hope this helps you.

EDIT: Just a quick thought… are you looking at the sensor light blueprint or the smart light blueprint. You need this sensor light blueprint.

Blacky :grinning:

1 Like
  1. Yes but most of the time are open, that why i want to have automation which depends on contact sensor from shower doors.
  2. Yes
  3. No

@Blacky,
Love your blueprint. Is there a specific section that I should configure if I want the motion logic to be bypassed if a specific light is on in that room? I have multiple scenes that run based on the time of day and would like the motion to only fire and turn on the scene if a specific light is not on.

@Blacky Since couple of weeks my automation is not running properly. Lights are turning themselves off just under 2 minute doesn’t matter how much time delay I set. And other problem is they are not turning back on even there is a movement (as I am using philips hue motion sensor).
Thank you for your help.
Regards,
HSM

@Blacky here is the yaml code of my automation.


alias: Kitchen-Dining-Sensor Based Trigger
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.hue_motion_sensor_2_motion
    light_switch:
      entity_id:
        - light.dining
        - light.kitchen
    time_delay: 4.5
    include_light_control:
      - use_brightness
      - use_transition
    light_transition_on: 3.5
    light_transition_off: 6
    include_light_colour_control: use_colour_temperature
    light_colour_temperature: 4700
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.hue_motion_sensor_2_illuminance
    ambient_light_options: ambient_light_option_enabled
    ambient_light_high_value: 190
    ambient_light_value: 10
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - time_enabled
    night_lights_after_time: "22:15:00"
    night_lights_before_time: "06:50:00"
    night_lights:
      entity_id:
        - light.dining
        - light.kitchen
    night_time_delay: 1
    include_night_light_control:
      - use_brightness
      - use_transition
      - if_lights_are_on_adjust_when_crossing_over
    night_light_transition_on: 3
    night_light_transition_off: 4
    include_night_light_colour_control: use_colour_temperature
    night_light_colour_temperature: 2800
    dynamic_lighting_min_lux: 30
    end_scenes: []

@Blacky I am having some issues getting the dynamic lighting to work right. I’m not sure if maybe I’m misunderstanding how it works.

What I’m trying to achieve is to have the lights in my office adjust as the day goes on. I start before the sun comes up so when I walk into the room it should be 100% brightness and as the sun comes up and brightens up the room it should gradually dim and eventually shut off and as the sun sets, it’ll turn on and brighten again. The automation will work for the first few minutes and the lights will dim/brighten as I open/close my shades for testing but then stops.

alias: New automation
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.presence_sensor_fp2_cf9e_presence_sensor_1
    light_switch:
      entity_id: light.mike_s_office
    include_dynamic_lighting: enable_lux_controled_brightness
    dynamic_lighting_lux_sensor: sensor.presence_sensor_fp2_cf9e_light_sensor_light_level
    dynamic_lighting_boolean: input_boolean.dynamic_lighting_helper
    time_delay: 1
    dynamic_lighting_heartbeat: 1
    dynamic_lighting_max_lux: 150
    dynamic_lighting_step_value: 10

@Grey

In that case then you will need to leave the shower doors open for the automation to run in normal mode. When the doors are closed then the light will be ON.

One thing you will need to do is invert the door sensor so when it is close (OFF) it will be ON so the bypass works.

Create a template binary sensor helper and use the code below to invert it. Then use this template binary sensor in the bypass. Replace binary_sensor.your_shower_door_sensor_here with your actual shower door sensor ID.

  1. Go to Settings > Devices & Services > Helpers.
  2. Click ā€œ+ Create Helperā€ and choose Template > Binary sensor.
  3. Set a Name for your new binary sensor (shower Doors Inverted).
  4. In the State template field, paste the code below.
    Replace binary_sensor.your_shower_door_sensor_here with the actual entity ID of the shower door contact sensor.
  5. Set the Device class if you like.
  6. Optionally, select a Device to link this sensor to (shower doors). Leave it blank if not needed.
{{ is_state('binary_sensor.your_shower_door_sensor_here', 'off') }}

Blacky :grinning:

@christopher.hellweg

You can use the light in the bypass as it will have a ON / OFF state. In the pass you could just copy and paste the entity ID into the input but HA broke everything in the last release so you will have to add a entity into the bypass, then edit the automation in YAML, then replace the entity with the light you would like to use.

Blacky :grinning:

@hsm

Thanks for the info and you YAML below. I have had a look at it and everything looks good. The only thing that will prevent the lights from turning ON is you ambient settings. You LUX must be under 10 lx.

There are a few things you can do.

  1. Disable the ambient option and see if it works correctly.
  2. Look to see if another automation is turning the light OFF. It could be out of HA and in Philips. Look tin the history to see what turned it OFF.
  3. Look at you motion sensor when testing the automation to see if it is ON and stays ON.

Blacky :grinning:

@mcheung

Welcome to the community.

I just tested it here and it all seams to be working correctly.

Your min lux of 40 and your max lux of 150 and only leaves 110. This is tight. Have you thought about using Ambient option?

Blacky :grinning:

@Blacky thanks! This is my first time setting up HA so I’m learning as I go.

I do have one with the Ambient option. Correct me if I’m mistaken but that only turns the light on/off based on the lux value. I’m trying to get the brightness to adjust throughout the day based on the lux value.

I had the max lux set lower for testing. Dynamic lighting doesn’t quite seem to be working right for me and I’m not sure why. It does change the brightness of my lights for a few minutes but eventually stops. I tested again this morning with max lux of 250 but it didn’t completely shut off the lights when lux hit 400 either.

Hey,

newbie here and this was probably raised a lot of times, I am just not very much into HA yet - so sorry in advance. This blueprint looks great and can probably do what I want, thanks for your work!

I setup Sensor Light and have the following issues:

  • Motion activated lights run as they should but override a light setting that is already ON. I would like to only have the automation run if light is OFF, so that when I use a physical switch the light stays on. Only if the lights are off, they should be motion activated and also turn off again when there is no more motion.
  • Also, when a light is turned on by motion and I change it manually afterwards, I want it to stay that way and not re-set to its motion activated state (for example when dimming light at night that was turned on by this blueprint)

Any idea how to start? Thanks!

@mcheung

Yes, that is correct but I was looking at you lux range and could see the point. If it was just for testing and you increase it later then yeah ok.

I tested it here again and watched it turn the light OFF and watched it turn the light back ON.

What should happen. When your presence sensor detects motion the light and the input_boolean.dynamic_lighting_helper should turn ON when the lux is below your max. As the lux increase and goes above your max the light brightness will change. Once above your max lux you light will turn OFF but your input_boolean.dynamic_lighting_helper will stay ON.

Blacky :grinning:

@massocin

In most homes, a wall switch and a light are not two separate entities in Home Assistant — they are one single entity.
When you press the physical wall switch, Home Assistant sees that as the light turning ON.

If the switch and the light were separate entities, things would be easier.
For example, the automation could turn the light ON while the switch stays OFF, and you could use the switch state as a bypass to stop the automation.

But because the switch is the light, we need a different approach.

Instead of checking what is ON, we check who turned it ON.

That’s where the :stop_button: Manual Control Status Tracker blueprint comes in.

Here’s how it works:

  • In the Manual Control Status Tracker blueprint, you add a toggle helper that tracks how the light is controlled.
  • If the light is turned ON by an automation, the toggle helper stays OFF
  • If the light is turned ON manually (wall switch or UI), the toggle helper turns ON

That toggle helper is then used as a bypass:

  • When the toggle helper is ON, the automation is paused
  • The automation only resumes once the toggle helper is turned OFF again

This allows manual control to temporarily override automation, without needing separate switch and light entities.

Note:
If the light is ON because of an automation and you want to manually pause the automation, you must turn the light OFF and then back ON. This allows the system to register the action as a manual control.

If the light is turned ON by the automation and you manually change the brightness or colour then the light will stay that way until the light is turned OFF. When the automation turns the light back ON, it will apply the settings you selected in the blueprint.

Blacky :grinning: