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

Soonā€¦? :slightly_smiling_face:

@iona

Yep that is where it all started. It is all done and ready to go just waiting for everyone to update their HA so we donā€™t break their automatons. It will probably be out next month. I am updating a lot of my blueprints.

Thanks for your patience.

Blacky :smiley:

2 Likes

Thank you very much, glad to be here :wink:

Thanks for the good suggestion by the way! Sorry if my explanation was not specific enough, I will try to re-phrase it :smiley:

Letā€™s say I have 5 automations for 5 different rooms. They all have the setting ā€œEnable the time optionsā€ set to ā€œONā€. And ā€œStart Timeā€ is set to 20:00:00 and ā€œEnd Timeā€ is set to 5:00:00 for example.
Would it be a good idea to (instead of putting in the 20:00:00 as integer values into the time field for all 5 automations one by one) rather be also able to use an input_datetime.lights-on-time helper as an alternative to the 20:00:00 field?

With that it would only require one change of the set time within the input_datetime.lights-on-time helper to adjust the ā€œAutomation controls lightsā€ and ā€œAutomation ignores motion sensorsā€ time values at once.

In theory that could maybe look somewhat like this, I have created a small mockup that hopefully explains it better: :smiley:

Greetings,
Andy :slight_smile:

Hi Blacky,
for those who have already updated their system, is there a way to get the latest version of the Blueprint?

Thanks for your amazing blueprints
Michael_uses_HA

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