šŸ”† Smart Light - Entity - Sun Elevation - Ambient & Time Triggers

Hello @Blacky - very smart things you do!
Please do you have a clue how to use this blueprint to turn light xx minutes before sunset and let them ON for XX minutes (after OFF) and again ON XX minutes before sunrise? Thank you.

@Blacky need help. i canā€™t understand why night light doesnā€™t start

alias: Smart Light
description: ""
use_blueprint:
  path: Blackshome/smart-light.yaml
  input:
    night_lights_conditions:
      - time_enabled
    night_lights:
      entity_id: light.0xa81710b966bd0000
    include_night_light_control:
      - use_brightness
    night_light_brightness: 15
    include_night_light_colour_control: use_rgb_colour
    night_light_rgb_colour:
      - 255
      - 0
      - 0
    include_night_lights: night_lights_enabled
    include_sun:
      - sun_falling
      - sun_rising
    light_switch:
      entity_id: scene.evening_mode
    end_scenes:
      - scene.morning_mode
    sun_elevation_rising: -10
    sun_elevation: -1.5
    night_lights_before_time: "06:30:00"
    night_lights_after_time: "00:00:00"

@Jiran

Thanks for your kind words.

I am assuming your asking to;

  1. Turn the light ON at sunset then OFF at say 11pm.
  2. Turn the light ON at say 5am then OFF at sunrise.

If this is correct then just use sun elevation and time triggers.

  1. Set up sun elevation for ON and OFF. There is a link in the blueprint on how to set this up.
  2. Set up time for ON (5am) and OFF (11pm).
    • As long as the 5am turns your light ON before your sun rising turns it OFF
    • As long as the 11pm is after your sun falling setting were the light turn ON.

Blacky :smiley:

@dimacoupe

Thanks for your YAML.

There is one thing I am not sure of and that is your scenes. Scene ā€˜evening mode" should have your lights ON and scene "morning modeā€™ should have your lights OFF.

That said you will need to add;

  1. A toggle helper in lights Scenes & Scripts - Toggle Helper
  2. In Night Light Control select this option If lights are ON, adjust the lights when crossing over.

Once you have done that it all should work.

To create a Toggle Helper, follow these steps:

  1. Navigate to Settings > Device & Services > Helpers tab at the top.
  2. Click the Create helper button.
  3. Select Toggle and then enter a name and a icon if you like and click Create.

Blacky :smiley:

@Blacky

thanks for answering

evening mode turn on ā€œevening lightā€ and roller shades close.
morning mode open roller shades only.

in night lights i used other light like night light.

interested that, night light not ON but OFF(turned on in manual mode) by time. and today it started ā€œevening modeā€ by ā€œbefore timeā€ and off night light.

@dimacoupe

Maybe use this blueprint to control your lights and use just light entities not scenes. Then have a look at this blueprint for your shades click here, it seams to have a lot of support.

Blacky :smiley:

You have created a script with extensive capabilities. I just use them. Interestingly, I have no problems with curtains, everything works perfectly :slight_smile:

1 Like

Hello, @Blacky thank you for anśwer but I have bad news. None of your blueprints doesnĀ“t work on my installation :Ćŗ Really donĀ“t know what could be wrong. I tried it for motion sensor (Philips HUE with light sensor) to turn ON specified light (in fact sonoff switch) under certain light conditions (10 Lux) and turn the same switch off after 30 seconds if no motion detected. It turns the switch ON properly but never turn OFF. Where should I start?

@Jiran

If you are using a motion sensor then use my Sensor Light blueprint.

If you would like to turn ON and OFF a light on a trigger option provided in this blueprint then you use this blueprint. Example, I use this blueprint to turn lamps ON at sunset and then OFF at 11:30pm. That is really what this blueprint is designed to do. Other examples are;

  1. Turn ON at X time and OFF at X time.
  2. Turn ON when LUX low and OFF when LUX is high.
  3. Turn ON when sun sets and OFF when sun rises.
  4. Turn ON at a state change to ON and OFF on a state change to OFFā€¦ but this is not for a motion sensor.

You can mix an match what you would like to do. As I doā€¦ I turn ON when sun sets and OFF at X time.

So you are asking to turn a light ON when motion is detected if your LUX sensor is below 10 and then when the motion sensor clears then in 30 seconds you would like the light OFF then use my Sensor Light blueprint. Your motion sensor is the trigger, add your light in and use Ambient. Try using the Sensor Light blueprint and if you have any questions on the sensor light blueprint post a question under that post and maybe post your YAML settings of the automation so I can help you further.

What is your YAML Settings? 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:

Itā€™s a bit mixed up. Actually, I am dealing with two automations. You wrote me a nice tutorial for the first one, and itā€™s about turning on the lights based on sunrise and sunset and the time.
The latter is built on a sensor that detects movement and lighting value. If the ambient light value is lower than 10Lux and at the same time movement is detected, then the automation should turn on the switch and leave it on for 30 seconds after the last movement is detected. Any further movement should stop the countdown. If no further movement is detected for 30 seconds, the switch will turn off. And I canā€™t set itā€¦

@Jiran

Use this blueprint :bulb: Sensor Light - Click Here. This is the one you need for motion sensor. In the blueprint in triggers add your motion sensor as the trigger, then in Lights add your light/s in Lights - Switches - Scenes - Scripts as entities (green selection) and set the Time Delay to 0.5ā€¦ click save and your done.

Blacky :smiley:

And how about a light sensor?

In the sensor light blueprint use Ambient, enter in your sensor and adjust your settings.

Blacky :smiley:

This is it! It works. I knew you are a genius :slight_smile:

Hi,

Thanks for putting these together; Iā€™m using your fan blueprint already and it works great.

I looked at this and your other lighting blueprints and Iā€™m not sure if it works with my use case: I want to have some lights turn on when I open my garage door to the yard - but only if itā€™s dark - otherwise pointless to have those lights come on.

I looked at the night light option but itā€™s not clear to me if that would be the conditional.

Any thoughts?

Thanks.

@Jiran

Your welcome, glad you got it working.

Enjoy

Blacky :smiley:

@eternalcaves

You will need to use my :bulb: Sensor Light blueprint. Set up the trigger, your lights and use the Ambient condition, enter in your sensor and adjust your settings. No need for night light.

Tip: If you like to take it to the next level your could set up a template sensor that has auto OFF so when you open / close the door the light will be ON for X amount of time and then turn OFF so the light isnā€™t always ON when the door is open, then you also use a motion sensor in the garage that will turn the light back ON or keep it ON if you are in the garage. You then use the template sensor and your motion sensor in a sensor group in the trigger. Link to the Ho To for the template sensor click here.

Blacky :smiley:

Hello Blacky,

Iā€™m using the Smart Light blueprint to turn the outdoor lights on and off based on the sun position, with brightness set to 25%.

The same lights should also be triggered by a motion sensor. When motion is detected, brightness should go up to 75% for a duration of 2 minutes. For this, Iā€™m using the Sensor Light blueprint.

After that, the lights should return to 25% brightness.

Each blueprint works individually, but when I activate both, the lights turn off completely after 2 minutes.

I need some help with this. Thanks in advance!

@FRIMatze

Welcome to the community.

This is something on my list to do in the sensor light blueprint.

Until then because you already have 2 automations set up, in the sensor light blueprint automation create a scene with your lights at 25%ā€¦ then add that scene into Scenes - Scripts To Turn OFF. Try that and and see if that works. If you see a light flicker when it goes from 100% to 25% then you may need to create another scene with your lights at 100% and add it into Lights - Switches - Scenes - Scripts (no light entities only the scene). If you do that then create a toggle helper and add it into Scenes & Scripts - Toggle Helper.

To create a scene go to settings > automation & scenes > scenes tab at top, then and add scene. Add your light entities in, then click on them and set them how you would like them and save the scene.

Let us know if that works for you as I havenā€™t tested it.

Blacky :smiley:

FAQ - Smart Light Blueprint V Sensor Light Blueprint

1. What are the primary differences between the Sensor Light and Smart Light Blueprints?

  • Sensor Light Blueprint is specifically designed for dynamic triggers like binary sensors (e.g., motion sensors, presence sensors, etc.). It includes a wide range of conditions such as sun elevation, ambient light, time-based options, and device tracking to control when the automation will activate. This makes it ideal for areas where lighting should respond to real-time, unpredictable triggers, such as motion or presence sensors that can change state at any moment.

  • Smart Light Blueprint is built for fixed triggers such as entity states, sun elevation, ambient light, and time-based options to turn lights on or off. Apart from the entity state trigger, all other triggers in this blueprint are based on fixed schedules instead of dynamic conditions. This means they activate lights based on predictable, scheduled events like sunrise/sunset, ambient light thresholds, or specific times. Itā€™s best suited for scheduled, consistent lighting needs and is not designed for use with motion sensors or other dynamic triggers.

2. Trigger Type:

  • Sensor Light Blueprint is designed for dynamic triggers, which are typically binary sensors like motion sensors or presence sensors. These sensors can change state at any moment, making the lighting responsive to real-time events.

  • Smart Light Blueprint is intended for fixed triggers, such as entity states (on/off), sun elevation, ambient light levels, and specific times. These triggers are usually more predictable and occur on a fixed schedule.

3. Which blueprint is better for motion-sensor-based lighting?

  • Sensor Light Blueprint is optimized for motion sensors and other binary triggers, allowing detailed control over activation, time delays, and continuous lighting when sensors are re-triggered.

4. What are the different condition options available in each blueprint?

  • Sensor Light Blueprint offers a variety of conditions to control when the automation is allowed to run, including:

    • Sun Elevation: Based on the sunā€™s position in the sky.
    • Ambient Light: Based on light levels in the environment.
    • Time-Based Options: Allows you to define specific time periods on given days for activation.
    • Device Tracking: Uses presence detection to ensure automation only runs when someone is home.
  • Smart Light Blueprint, on the other hand, only has Weekdays as a condition to control when the automation is allowed to run, allowing you to specify the day of the week. As you can see, the conditions in the Sensor Light Blueprint (such as sun elevation, ambient light, and time) are essentially used as triggers in the Smart Light Blueprint.

5. How does each blueprint handle dynamic lighting?

  • Both blueprints support Dynamic Lighting, where brightness and color temperature can be automatically adjusted based on lux levels or sun position.

  • The Sensor Light Blueprint also allows fine-tuning of Dynamic Lighting based on sun elevation and lux, as these are added conditions that can further control how lighting behaves.

6. What is the difference in the manual override or bypass options?

  • Both blueprints have manual override/bypass options that work the same way. They allow you to manually control the lights and prevent automatic activation when needed. In both blueprints, you can bypass the automation rules and gain full control over the lights, ensuring they donā€™t automatically turn on or off based on the triggers or conditions set in the blueprint.

7. How do the blueprints handle Night Lights?

  • Both blueprints include a Night Lights Mode, which can be automatically enabled based on entity state, a given time period, or sun elevation. This ensures that the lighting behaves appropriately for nighttime use, offering a softer and more comfortable lighting experience.

In Closing:

  • The Sensor Light Blueprint is best suited for environments where lighting needs to react to real-time, dynamic changes, such as motion or presence detection. Itā€™s ideal for scenarios where you need flexibility and immediate response to unpredictable events.

    Example: Walk into a room and the light turns ON. When you leave, the light will turn OFF with a delay. Open a door and the light turns ON, with the light turning OFF with a delay when the door is closed.

  • The Smart Light Blueprint, on the other hand, is designed for more predictable, scheduled lighting setups. Itā€™s perfect for automations based on fixed events like specific times of the day, sun elevation, or ambient light levels, without the need for dynamic triggers. This blueprint offers a more consistent, scheduled lighting experience, where triggers occur based on fixed schedules rather than changing conditions.

    Example: Turn the light ON when the sun sets and turn it OFF at a set time, such as 11pm. Open a door and the light turns ON, close the door and the light turns OFF (no delay).

Enjoy

Blacky :grinning:

Back to FAQ: Click Here

2 Likes