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

Hello Blacky,
I’ve updated the Blueprints and switch to use new :high_brightness: Smart Light. I used the template, and the date/time is correct for my location. I’ve see how it goes for the next couple days.

One additional question can you mix Time ON/OFF with Sun Elevation. Example,

include_sun:
      - sun_falling  
sun_elevation: -5

include_time:
     - time_off
before_time: "07:00:00"

Mark

1 Like

Hey guys, I noticed that when I set a Night Glow light that is not included in Night Light or Lights, the bypass option that turns off all lights does not turn of the Night Glow light.

I tried to use a scene to force to turn off the light and I’ve added it to to the “Scenes - Scripts To Turn Off” field but the problem now occurs when turning off the bypass entity. The automation does not turn on again the Night Glow light (Night Light entity helper was on when I run this test).

I don’t know if I’m doing something wrong or if that behavior is expected or is a known issue.

As a workaround I’ve added the light to the Night Light entities but the idea is to turn on that light only when Night Glow is on, otherwise should be off.

If you find a better solution, I’d appreciate your help.

I hope this is an easy one …
I would like the automation to run only if someone is at home, otherwise switching lights on don’t make much sense. :wink:
I have a sensor that indicates whether a person is at home (not speaking about the cat :wink: ): binary_sensor.someone_at_home

I would like to use that sensor to decide whether the sensor light automations are active.
as soon as there is no one at home anymore, the already started automations should finish (mainly switching off lights after the configured delay).
and then the automations should “sleep” until someone is at home again. Basically I would like to stop the automation to run triggered by the cat :wink:

I think I should use ‘Bypass Switch - Keep The Lights Current State’ - am I right?

Or do I need to group the binary_sensor.someone_at_home with the motion sensor used in the automation?

Does this include a timer helper for tracking the remaining time and also does the timer resets automatically if there is motion detected?

It seems like a great blueprint with tons of options but I can’t see the option to use a timer helper.

Please let me know.

Thanks!

Hallo Blacky,
Zwischen Sonnenuntergang und -Aufgang soll der Bewegungsmelder das Aussenlicht fĂźr ein paar Minuten einschalten. geht!
Zwischen Sonnenuntergang und 21 Uhr und 7 Uhr und Sonnenaufgang soll Dauerlicht sein. geht leider nicht.
Was mĂźsste ich einstellen? Vielen Dank

Sorry now in English
Hello Blacky,
Between sunset and sunrise the motion detector should switch on the outside light for a few minutes. It works!
Between sunset and 9 p.m. and 7 a.m. and sunrise the light should be continuous. Unfortunately it doesn’t work.
What should I set? Many thanks
Vorhand

@matiasnl23

Welcome to the community.

Thanks for bringing this to our attention. This is a bug, and it should work as expected. I’ll work on a fix… stay tuned for an update!

Blacky :smiley:

1 Like

@nicknol

You could just use Device Tracker option.

If you want to use your sensor, it must be in the ON state when no one is home. If it’s not, you’ll need to invert it. Then, use it in Bypass Option 2 to ensure your lights turn OFF. In the Bypass - Time Delay, set a delay so that when your sensor triggers the bypass to turn OFF the lights, it waits for the specified time before doing so.

Blacky :smiley:

@amardeepsinghnagpal

No but there is a delay.

Yes

Blacky :smiley:

@Vorhand

All good for me ether way.

The best way to do this is to create a Template Binary Sensor for your continuous condition and then group it with your motion sensor.

In the trigger section of the blueprint, you’ll find a link explaining how to group your motion sensor and the template sensor. Once you’ve grouped them, use only the group as the trigger.

Creating a Template Binary Sensor:

  1. Navigate to Settings > Devices & Services > Helpers.
  2. Click Create helper.
  3. Select Template → Template a binary sensor.

Next:

  • Name the sensor.
  • Choose a Device class (optional).
  • (Optional) Link the sensor to an existing device for better organization.

State Template Code:

Paste the following into the State template field:

{{ (state_attr('sun.sun', 'elevation') < -1.5 and now().hour < 21) 
   or (now().hour >= 7 and state_attr('sun.sun', 'elevation') < -4.0) }}

Note: The -1.5 and -4.0 sun elevation values determine when the sensor is active. Adjust them to fit your needs.

Blacky :smiley:

In German for you.

"FĂźr mich ist beides in Ordnung.

Der beste Weg, dies zu tun, ist das Erstellen eines Template-Binärsensors für deine dauerhafte Bedingung und anschließend das Gruppieren mit deinem Bewegungssensor.

Im Trigger-Abschnitt des Blueprints findest du einen Link, der erklärt, wie du deinen Bewegungssensor und den Template-Sensor gruppierst. Sobald sie gruppiert sind, verwende nur die Gruppe als Trigger.

Erstellen eines Template-Binärsensors:

  1. Navigiere zu Einstellungen > Geräte & Dienste > Helfer.
  2. Klicke auf Helfer erstellen.
  3. Wähle Template → Template-Binärsensor.

Als Nächstes:

  • Benenne den Sensor.
  • Wähle eine Geräteklasse (optional).
  • (Optional) VerknĂźpfe den Sensor mit einem vorhandenen Gerät fĂźr eine bessere Übersicht.

State-Template-Code:

FĂźge den folgenden Code in das State-Template-Feld ein:

{{ (state_attr('sun.sun', 'elevation') < -1.5 and now().hour < 21) 
   or (now().hour >= 7 and state_attr('sun.sun', 'elevation') < -4.0) }}

Hinweis: Die Werte -1.5 und -4.0 fĂźr die Sonnenelevation bestimmen, wann der Sensor aktiv ist. Passe sie nach deinen BedĂźrfnissen an.

Blacky :smiley:

1 Like

@Blacky
thanks a million for the pointer to Bypass Option 2 - will try it soon :slight_smile:

Hi, I’m having some trouble with this automation and the add-on, when I return from watching on PC, “LED Scrivania” turns off instead of on

Here’s the sensor light config:

id: '1737988951608'
alias: Lights
description: ''
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.ep_lite_5cb900_occupancy
    light_switch:
      entity_id:
        - scene.home
    end_scenes:
      - scene.tutto_spento_camera
    time_delay: 1
    include_night_glow: night_glow_enabled
    night_glow_lights:
      entity_id:
        - scene.camera_night_glow
    motion_bypass_lights_stop:
      - input_boolean.disable_sensor_tv_lights
      - input_boolean.disable_sensor_pc_lights
    include_bypass:
      - bypass_enabled_stop
    include_light_control:
      - use_transition
    include_dynamic_lighting: disable_dynamic_lighting
    include_device_tracker: zone_enabled
    zone: zone.home
    boolean_scenes_scripts: input_boolean.lights_helper
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - time_enabled
    night_lights_before_time: '08:00:00'
    night_lights:
      entity_id:
        - light.led_scrivania
    night_time_delay: 1
    include_night_light_control:
      - use_brightness
      - use_transition
      - if_lights_are_on_adjust_when_crossing_over
    night_light_brightness: 20
    include_night_light_colour_control: use_rgb_colour
    night_light_colour_temperature: 3000
    night_light_rgb_colour:
      - 255
      - 186
      - 137

Here’s the addon config:

id: '1737385054349'
alias: Lights - PC
description: ''
use_blueprint:
  path: Blackshome/sensor-light-add-on.yaml
  input:
    trigger_entities:
      - media_player.filippo_pc_plex
    trigger_on_state:
      - playing
    trigger_off_state:
      - unavailable
    include_start_turn_off: enable_start_turn_off
    off_light_switch:
      entity_id:
        - light.led_scrivania
        - light.led_letto
        - light.yeelight_lampada_scrivania
        - light.lampadario_camera
        - light.comodino_dx
        - light.comodino_sx
        - light.nanoleaf
    off_include_light_control:
      - use_transition
    intermission_include_light_control:
      - use_transition
      - use_brightness
    include_intermission: intermission_enable
    intermission_light_switch:
      entity_id:
        - light.led_scrivania
    intermission_include_light_colour_control: use_rgb_colour
    include_end_turn_on: enable_end_turn_on_snapshot
    end_snapshot_name: pc_lights
    end_snapshot_helper: input_boolean.snapshot_pc_lights
    end_include_light_control:
      - use_transition
    time_delay: 0
    light_switch:
      entity_id: scene.empty_scene
    end_light_switch:
      entity_id:
        - light.led_scrivania
        - light.led_letto
        - light.yeelight_lampada_scrivania
        - light.lampadario_camera
        - light.comodino_dx
        - light.comodino_sx
        - light.nanoleaf
    intermission_light_rgb_colour:
      - 0
      - 0
      - 255
    intermission_light_brightness: 100
    include_automation_link: enable_automation_link
    automation_link:
      - input_boolean.disable_sensor_pc_lights

I am running Ikea bulbs with this automation (like many others I suppose) but also have the issue that quite often some lights won’t turn off after the automation. Not sure why that is happening, but I found out that this might be a rather common issue with the ikea bulbs. Hopefully we can somehow integrate a fix for all those of us running ikea lights or help us with the current workarounds:

The currently best workaround is either to create template sensors and helpers for every light and create an additional automation that turns off these lights according to the state of these helpers. The other method described is to send the turn off signal twice.

As the latter option is much less work and maintanance, it would be great to have an option to add a custom action that triggers together with turning on and off a light. The you could just run the turn off signal as a custom action again.

As you then could also run other stuff together with the lights without a lot of fuss, I imagine this would be a neat feature for other people as well. Any chance of making this happen?

@Blacky I’m having a problem with my bathroom toilet light using the night lights. For some reason the toilet light dimming level is not being set to 10. It’s stuck full blast at 100% per the HA dashboard. Any ideas why the brightness is not being properly set? It’s a Inovelli White series thread/matter dimmer.

alias: Master Bathroom Toilet Lights
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.eve_motion_occupancy_mb_toilet
    light_switch:
      entity_id: light.inovelli_master_bathroom_toilet_lights
    include_light_control:
      - use_brightness
    include_night_lights: night_lights_disabled
    night_lights_conditions:
      - time_enabled
    night_lights_after_time: "22:00:00"
    night_lights_before_time: "06:00:00"
    include_bypass:
      - bypass_enabled_turn_off
    motion_bypass_lights_off:
      - binary_sensor.presence_fp2_master_bedroom_bed
    night_lights:
      entity_id: light.inovelli_master_bathroom_toilet_lights
    include_night_light_control:
      - use_brightness
      - use_transition
    night_light_transition_on: 1
    night_light_transition_off: 3
    night_time_delay: 3
    night_light_brightness: 10

@PilaScat

There are a few things to check, but you should find the answer somewhere in your settings:

  1. Snapshot Behavior: A snapshot is created before running the add-on. This means the current state is included in the snapshot. Is the light OFF at this time?
  2. Scene Inclusion: In the sensor light, you have a scene called home. Is the light included in that scene?
  3. Night Glow Behavior: In the sensor light blueprint, you have night lights with glow lights. Are the glow lights turning ON while LED Scrivania is not? Is this happening between 12 AM and 8 AM when night lights are active?

Hopefully, this helps you track it down. It’s likely happening because something in your settings is triggering it.

I’m also releasing an update for the sensor light blueprint, which includes several bypass bug fixes. I have done all the code changes for the update. Now, I just need to do a final check to ensure everything is correct before releasing it. This update might resolve the issue, so if you can’t find the cause now, you may want to wait for the update to see if it fixes it.

Blacky :smiley:

@QuiBono

Adding a custom action sounds simple, but getting the logic right can be tricky. One approach you could try is using the Scenes & Scripts - Toggle Helper. Then, create another automation that turns the IKEA bulbs OFF when this helper changes from ON to OFF. This could serve as a secondary signal to turn them OFF reliably.

However, the issue seems to be with the IKEA bulbs themselves. I’d recommend reaching out to IKEA and explaining that you’re using Home Assistant to control the lights, along with a description of the issue. Hopefully, they can help resolve the communication error.

Blacky :smiley:

@DuckDuck25

Please make sure night lights are enabled for them to work. See below.

Blacky :smiley:

Came here to say thanks for this blueprint - it works very nicely, and this comment answered the question that I was wondering about - being able to start the automation at sunset, and then stop it at midnight. Used this template with just the evening part, and it works lovely! Thanks!

@CarrieSweetpea

Hi Caroline, thanks for your kind words and it is nice to see you spent the time to read the comments. It is really nice to get these ones :smiling_face_with_three_hearts:

Enjoy

Blacky :smiley:

New update 7.9

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

:bug: Bug Fixes

Bypass

  • Turn OFF action: When using Night Glow, the bypass would not turn off the Glow lights when using option 2.

  • Crossover when bypass is ON: Addressed multiple scenarios where, if the bypass was turned ON and a crossover occurred, the correct action would now be performed when all bypasses were turned OFF.

Global Conditions

  • Fixed an issue where Night Glow lights would not turn OFF based on sun, ambient, or time conditions.

:toolbox: Maintenance

  • Some code clean up in Device Tracker.

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: