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

@SimTechLP

Hi Andy

Thanks fro explaining it in detail as it is easy to understand. I will put this on the list of suggestions.

Can I ask why you need to adjust them all the time? Are you needing to adjust the start time with the changing seasons? Your use case?

Blacky :smiley:

1 Like

@Michael_uses_HA

Hi Michael, and welcome to the community.

No, I didn’t want to do that because when HA downloads blueprint it adds a URL so you can update easily. I have pushed out a BP that has ‘collapsible sections’ if you would like to look at this new feature in HA. I have done this to see what happens and how it goes roiling out this new feature.

I really try and make sure when you update it just works. It a trust thing with the community. I also like moving fast and it is killing me holding this back. Lets see how my other blueprint goes and see if I get positive feedback.

Blueprint with ‘collapsible sections’ :vibration_mode: Appliance Notifications & Actions - Washing Machine - Clothes Dryer - Dish Washer - ETC

Blacky :smiley:

Hey Blacky!

That sounds awesome, thanks a lot! :wink:

My specific use case is - correctly as you said - to setup either Start Time or End Time or both for multiple rooms at once where it was hard to time the exact Sun angle to a specific time, as it also changes over time (changing seasons, etc.)

Usage of one or more centralized helpers would be really beneficial there :wink:

~ Andy :smiley:

@SimTechLP

  1. Is it because you can,t use the sun elevation?

    Or do you want

  2. To turn it ON when it gets dark but turn it OFF a X time?*

If you would like the second one then you can try this. It will turn it ON when it gets dark but turn it OFF a X time. There ar t ways to do this

  • With sun
  • With ambient

Follow these steps.

  1. First you set time up. The trick is to have the time start before it get dark throughout the year. Lets set time up to start at 4pm and say our X time is 11pm that we would like it OFF so our end time is 11pm.
  2. Next we choose the sun or ambient.
    • Sun: Set the falling elevation to a when the sun elevation is at a point you would like the light to come ON ‘-1.5’. The rising is not relevant because the time will turn it OFF at 11pm.
    • Ambient: Set the ‘Low Lux Value’ level to a value you would like the light ON. Then set ‘High Lux Value’ high so it wont turn the light OFF.

Some of my automation I would like to come ON every night at sunset ND TURN off AT 11PM, so I use the sun elevation and set falling to -2 deg and use a schedule helper as the trigger and set it for 5pm to 11pm. Now the sun turns it ON because the trigger is ON before the sun sets and then the trigger turns it OFF at 11.

Blacky :smiley:

Hello, Blacky,
I apologize in advance for my inability to fully understand your blueprint - I am a HA beginner, I have no programming experience. But I feel that your blueprint is very powerful, and I would like to use it for my automations. I have tried to read and understand most of your tutorials and FAQs, however I would very much appreciate a solved (simple) example:

Problem: Turn on night light at 04:45 - 05:15, but only if civil twilight is still in progress, or earlier (i.e. if the sun is <=-6 degrees).

I tried to modify your blueprint as follows:

alias: XXXXX
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    light_switch:
      area_id: loznice
      entity_id: light.smart_lighting
    include_night_lights: night_lights_enabled
    night_lights:
      area_id: loznice
      entity_id: light.smart_lighting
    include_night_light_control:
      - use_brightness
    night_lights_conditions:
      - sun_enabled
    night_lights_after_time: "04:45:00"
    night_lights_before_time: "05:15:00"
    night_lights_sun_elevation_rising: -6
    motion_trigger:
      - schedule.svetla_odjezd_schedule
    end_scenes: []

I didn’t know how to construct a proper “motion trigger”, I know it’s a mandatory item, so I constructed a “universal schedule” in configuration.yaml (but I don’t know if this is the correct procedure):

schedule:
  svetla_odjezd_schedule:
    name: "Světla odjezd rozvrh"
    monday:
      - from: "00:00:00"
        to: "24:00:00"
    tuesday:
      - from: "00:00:00"
        to: "24:00:00"
    wednesday:
      - from: "00:00:00"
        to: "24:00:00"
    thursday:
      - from: "00:00:00"
        to: "24:00:00"
    friday:
      - from: "00:00:00"
        to: "24:00:00"
    saturday:
      - from: "00:00:00"
        to: "24:00:00"
    sunday:
      - from: "00:00:00"
        to: "24:00:00"

If I now run the automation from the “Edit/Run” menu, the light defined in the automation will turn on. However, I am not able to test the triggering conditions.
I tried to use the “Developer Tools” menu in the HA UI to test, i.e. temporarily set the conditions:

sensor.time_date = 04:46, 2024-05-06
sensor.sun_solar_rising = True 
sensor.sun_solar_elevation = -6.1

but I am not able to propagate these conditions to the blueprint, and thus test the correctness of all conditions and variables. In fact, I don’t want to wait until July 27, when civil twilight starts at 04:44 for my geolocation :-).

So I would like to ask you for the following advice:

  1. Did I use your blueprint at least approximately correctly? Is there any significant logical error in the modification?
  2. What is the most efficient way to test the modifications in HA environment?

Thank you very much for your (holy) patience and for your reply.

@vaclavIII

Okay lets go through it step by step. Looking at your YAML and what you said I think this is what you are after.

Turn Light ON @ 20% brightness at 04:45 and OFF at 05:15.
If the sun elevation is below -6 deg then the light can come ON. If it is above -6 deg then light is OFF.

You purchase motion sensors normally but you can make your own using ESPHome but if you are unsure best to purchase one. You made a schedule and you can use it but I will show you an easy way on how to create a schedule Helper. You are in luck as the new HA 2024.6.2 just came out and HA fixed schedule helpers.

Create a schedule Helper

  1. Go to Settings / Devices & Services / click on the “Helpers” tab at the top / create helper and select schedule. You can also use “Time of Day” helper if it is the same time every day and you can set your time to ON 04:45 and OFF at 05:15.

  2. Enter in your name and then select the time you would like. It is in 30min blocks and I have asked if HA will make it so we can select more precise times but we are waiting. Here is the feature request so you can vote, Click Here

  3. Click create.

I have cleaned up your YAML for this. Copy / Paste it replacing your YAML

alias: XXXXX
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    light_switch:
      entity_id: light.smart_lighting
    motion_trigger:
      - schedule.svetla_odjezd_schedule
    include_light_control:
      - use_brightness
    light_brightness: 20
    include_sun: sun_enabled
    sun_elevation_rising: -6

Once done follow this.

  1. If you made a schedule helper then swap out the trigger.
  2. For testing lets create a toggle helper.
    • Go to Settings / Devices & Services / click on the “Helpers” tab at the top / create helper and select toggle.
    • Enter a name and click create.
  3. Add the toggle helper to your automation swapping out any entity you put in the trigger by editing in YAML and replace any trigger entity ID with the toggle helper entity ID.
  4. Add the toggle helper to a dashboard. You can now toggle the automation ON and OFF for testing.
  5. In ‘Lights - Switches - Scenes - Scripts’ you entered in a area. I removed it from your YAML. You can only have entities. See this FAQ on what you can do and how to fix it, click here..
  6. You were using night lights but if you only have one time you would like the light to come ON then just use the default. I fixed the YAML.
  7. If you are testing if the light comes ON and the sun is not below -6 deg then disable the sun condition that I enabled.

Hope this helps you

Blacky :smiley:

Thank you so much for the quick reply and guidance - that’s what I need, insight into the logic of things, I think I can deduce the rest.
Schedule - yes, I just updated HA - I struggled a lot before I understood that the schedule was not fully functional in the earlier version (hence my attempt at a imperfect definition in configuration.yaml). I’ll try your whole tutorial, I’ll write briefly if I succeeded. Thanks again very much!

1 Like

Yeah yeah… there’s beauty in simplicity. I was looking for too much complexity in your blueprint. It’s working fine now. But now to wait until July 27 to see how the “Sun 6 degrees below the horizon” condition behaves. Or after all, is there a way to debug the HA scripts and feed them temporary conditions? I’ve tried setting it up in the “Developer Tools” menu, and I can see that the state change has indeed occurred (the dashboard tile shows that HA understands the state change in “sun.elevation”), but I don’t know how to run automation with these newly set conditions. Is it possible at all?
I’m looking forward to working with your other blueprints, next up is “Link On/Off State of Multiple Devices” and “Switch - Turn ON & OFF Entities” - the lights turned on by the previous automation have multiple switches, namely a mechanical switch/wifi switch combination. I’d still like to solve the situation “turn on outdoor lights if it’s dusk or dark and someone is coming home” - I think you remembered that in your blueprint too.
Thanks again so much for the inspiration!

1 Like

New Challenge:
My lights in the hallway only support brightness and RGB, but not color temperature. Throughout the day I would like to use dynamic light (brightness) with white color. In the night I would like to use a colored light, maybe with dynamic light too (brightness).

As of now I am using the light entity for day, but for the night I am using a scene (to get the different color working). How to switch from colored light to white light in the morning?

I got an Aqara FP2 and thought I’d give this one a shot- SO MANY OPTIONS!

I currently have the lights in my TV Room set to turn on before sunset and turn off at 10:30. However, I’d like to keep the lights on if anyone is in the room and turn off whatever time they leave before sunrise- not that anyone stays up that late. Would also like them to turn on in case no one is in the room at 10:30 but, say, walks in at 11.

This is an incredible blueprint. Thank you!

I’ve read though the thread to try and help, but am still struggling a bit with the concept of bypass logic.

Scenario Turn on the kitchen light if there’s motion in the kitchen after sunset and then switch off after 5 mins, unless the kitchen light is already on, then do nothing. (because someone switched it on for another reason and they don’t want it to go off after 5 min)

I can figure out how to have an second/external binary sensor as the bypass toggle, but not the device being manipulated as it’s own source of bypass.

Hi @Blacky. Awesome work with your blueprints! Keep up the good work!

I got a feature request and question. For a new feature i would love to have an option to use my own sensor to control the color temperature. This sensor has just the kelvin values and i would love to use that then the build in logic.

And is there a way to combine multiple lights with different dim levels in 1 automation? For example my livingroom has 3 spots that have a max dim level of 40%. 3 hue play bars with a max of 35% and some ledstrips that us 50 to 60%

I would create a helper for this scenario. Then update the helper’s status, whenever the light is turned on by that switch.

@RemCom

Thanks for your kind words.

:thinking: How would this work? Could you just have it so when the light is ON you control it outside of this automation?

Yes by using a scene. You can use a script but a scene would be the easiest way.

Blacky :smiley:

@chris400

If you would still like to use dynamic lighting during the day then keep you light entity and then create a scene with the white light and enter in that to. Make sure you use the scene helpers.

Blacky :smiley:

1 Like

@ajaffarali

Without seeing your YAML I am assuming you have a schedule or something that turns lights ON before sunset and turn OFF at 10:30. In order to turn it ON / OFF outside this you will need a motion sensor. Then make a group to include your schedule and motion sensor and use that only as the trigger.

I really need your YAML to help though. See if that help and if you need more help 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:

Thx for your reply!

I am a bit confused though. I thought dynamic lighting won’t work bc of your note “NOTE - You can only use entities. Areas, devices and labels are not supported.”. So I should use both the light entity and the scene in there?

@beerygaz

Hi Gavin, thanks for reaching out.

First step would be to set it up with your motion sensor with your time delay of 5 min and you sun condition.

Bypass

When the automation turns the light ON in Home Assistant, the light switch status shows as ON, which prevents us from using the same switch to control a different action due to the conflict this creates. To avoid this, we use a separate, independent entity such as a switch (or a toggle helper) in bypass option 1. When this independent switch is turned ON, it activates the bypass that turns the light ON. The light will remain ON until the independent switch is turned OFF. You can also set a bypass auto OFF if you like so if you forget to turn the switch OFF it will do it for you. Once the independent switch is turned OFF, the system will evaluate the site conditions and control the light. To test it out, create a toggle helper and use it in bypass option 1. When you toggle this helper ON and OFF, you will see how it works. You can then make any modifications if you are happy with the outcome.

let us know how you go and if you have any questions please ask.

Blacky :smiley:

@chris400

Dynamic lighting will only work with a light entity that supports the feature you are trying to do.

What I thinking but I could be wrong is that because your light is RGB then the BP hasn’t got that option and the only way to adjust the RGB is in a scene.

Because you are using night lights and have a different RGB for night than day you would like the RGB to adjust back to white.

To do this we can put a scene in “Lights - Switches - Scenes - Scripts”. A scene is a entity not an " Area, device or label". So if we call the scene to turn the light to white and then still have the light entity in “Lights - Switches - Scenes - Scripts” it will control the brightness for you in DL.

When you put the helper in it will only call the scene once setting the light to white so dynamic lighting will do the rest once the light goes back to white.

I could be getting it wrong maybe not understanding it correctly of what you are doing.

Blacky :smiley:

1 Like

@Blacky

I’m not using this to control on off behaviour. My own node red flow calculate the color temperature differently then i currently have control over this process in the blueprint. so its more a sensor where i provide the color temperature so that the blueprint can use this value.

I think my question was missing some information. I use the dynamic Brightness control. So i have a few lights that need to be controlled between there lowest setting and max let say 40% and a few lights that are need tio be controlled between min and 50%. I dont think i can do this now with the use of scenes.

Background info of all these questions is i loven to switch to automations and not have all the logic in node red. And i love your automation because its almost the same as i made in node-red. with some specific to me quirks :stuck_out_tongue: