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

We will move it to this blueprint post to stay on track as it relates to it.

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:

@lewisb79

Hi Lewis, sorry I have been really busy as I have 9 new blueprint releases with new features, code clean ups and testing (QA) :face_with_spiral_eyes:. I also have 2 new blueprints to release one of them relates to what you are asking.

It is a separate blueprint to this one and is only for creating the manual switch to then be used in this blueprint. I am not 100% happy with it and it may be totally different to the end result but I am happy to share it with you if you would like to test it out. If your still happy to test it I will set it up and PM you with the link.

Blacky :smiley:

Thanks for moving the discussion here! Below is the YAML code from the automation:

alias: Home Lights - Main
description: Control ground floor lighting.
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - schedule.lights_on_schedule
    light_switch:
      entity_id:
        - light.floor_lamp_1
        - light.floor_lamp_2
        - light.floor_lamp_3
    time_delay: 5
    include_light_control:
      - use_brightness
    include_sun: sun_enabled
    sun_elevation: 3
    sun_elevation_rising: -1
    include_device_tracker: zone_people_enabled
    zone: zone.home
    people:
      - person.name_1
      - person.name_2
    light_transition_on: 3
    include_night_lights: night_lights_disabled

From someone who is very new to this.
Is there a way with this blueprint to trigger the lights to full brightness when there is motion detected, but then when there is no motion to dim the lights down to say 20%?
The first part is easy but not sure how to d the lights instead of turning them off?
I tried to use a sene but couldnā€™t get it to work.
Thank you

Fairly new here as well, but from what I know, you can create two scenes - one for 100% lights and another for 20% lights. Then add the 100% scene in the ā€œLights - Switches - Scenes - Scriptsā€ section and the 20% scene in the ā€œScenes - Scripts To Turn OFFā€. Be sure to add a scene toggle helper.

The FAQ also has some really good information and instructions around using scenes & scripts.

1 Like

@Nuwanda

Thanks for your YAML. I looked at the code again and it wont trigger when you get homeā€¦ sorry my bad.

I had to think back why it was set up like this and I can recall having some concerns with a few scenarios. Example, if you are home and you turn the lights OFF manually because you are sleeping and someone comes home all the lights turn ON. :thinking: I can remember there was some reason why I just allowed motion sensor to control it. I will have to look into it again. Do you have motion sensors?

Blacky :smiley:

@AmmaGHHA

I am ahuming this is for night time. Have a look at this post click here and follow the automation example. It is a step by step guide. I think this is what you are after.

Blacky :smiley:

1 Like

Hmmmā€¦thatā€™s a fair point. Since in my specific scenario, the livingroom lights are the only ones I turn on automatically I never really considered this. I do have a door sensor that I just got which should be a perfect trigger for my case.

Edit: Just thinking about it though - if the zone trigger only checks for zone state going from 0 to 1 (or higher), it shouldnā€™t trigger the second time in your example.

1 Like

Hey Blacky,

Iā€™ve been using your blueprint for over half a year now and I love it. Great job! However, I have an use case for which I have not found a solution yet. I have a blueprint for the bed area in the bedroom (with an Aqara FP2) that dims the light using a scene when the presence entity for this area is on, and if the entity is off, the light will turn brighter again by also using a scene.
In order to ensure the light remains off at night, Iā€™ve created a night-mode entity that sets the light to 0% brightness (= off) when activated, using the Night light option. This works quite well. However, the presence sensor sometimes loses track of the person at night, causing it to activate the regular off state, which activates the bright scene for the daytime. Logically, Iā€™d like the light to remain at 0% even if the person is absent. How can I solve this? If itā€™s not currently possible, would it be an idea to allow defining an off state for the night light option in a future update?

Thanks!

Lukas

Man, I want to love this automation so much, itā€™s everything I need in a light control blueprint. But I cannot for the life of me get it to interface with my smart switches. I simply want a switch to control the lights. Reason I like this automation so much is I want my lights to change color temp based on the angle of the sun, and I also want to have an override so if I want to just have some color, it doesnā€™t default to following the angle of the sun. I think thatā€™s possible with this blueprint?

@Nuwanda

It all depend on what you have but there are a lot of things to consider.

What happens if your have 4 in the zone but you are only tracking 2 of them?
What happens if 2 people come home together and it goes from 2 to 4?
What happens if 1 is home and the lights have been turned off and another person comes home triggering the lights on?
What happens ā€¦?

There is a lot of logic already in this blueprint and the idea is no one even knows :wink:. It just works :crossed_fingers:

Letā€™s look at another approach.

What if we create a template sensor that will turn ON when the zone is 0. Then use it in bypass option 2. So when the zone is 0 the lights turn OFF. Then when you get home the zone will turn to 1+ then the bypass will turn OFF and the automation will evaluate the site conditions and turn the light ON because the schedule (trigger) is ON. This will be the cleanest way and you can adjust it to suit your site conditions.

Try this and put it into bypass option 2.

Create a Template binary sensor, follow these steps:

  1. Navigate to Settings > Device & Services > Helpers tab at the top.
  2. Click the Create helper button.
  3. Select Template and then choose Template a binary sensor.

Next, provide a Name and Device class (Occupancy) of your choice. If applicable, you can link this template to an existing device so it appears under that deviceā€™s details.

In the State template field, add the code below, just make sure you are using ā€˜zone.homeā€™ and if not then change it to your zone.

{{ states('zone.home') | int == 0 }}

Add this new template sensor into the bypass option 2 and it should work :wink:

Let us know how you go.

Blacky :smiley:

1 Like

@Somedia

Hi Lukas,

Nice to hear from a long time user of the blueprint and I am glade you like it :+1:. Thanks for reaching out and your kind words.

Looks like you are so close to making it work perfectly. If I am correct the problem you have is only later in the night where the light turns ON and you would like it to remain OFF. Have you considered using the time condition (recommended for ease) or creating a Times of the Day helper or a Schedule helper and set the time that you know you are normally sleeping. If you are just using time condition in the automation to only work between start and end then you just click save. If you use a helper then you would add that helper into bypass option 2 making sure your lights stay off but can still control them manually if needed. You could even have another automation to take this time slot.

If the way you have it now works well at the start or end then when you set your times make it a in between where you know the problem happens. Like a bit of a buffer zone as time can change when you go to bed.

Let us know if this works for you.

Blacky :smiley:

1 Like

@backlash2032

I think your switch it seen as the light (same entity) if not detach your switch form your light and add your switch into the trigger. You have to edit in YAML replacing any entity you put in there with your switch entity. Then just add your light in.

If that is not the case thenā€¦

I have another blueprint in development that would make this work. I am just testing it out so it should be out soon all going well. Probably less than 30 days but not promising anything. You can however use a toggle helper as the trigger but you will have to control it through the UI not the switch on the wall.

That would be changing it to night lights (donā€™t worry about the name it is called if it is not night time).

Blacky :smiley:

Some quick testing this morning and it works well! Super clean way of doing it, and quite straightforward, appreciate the detailed instructions!

1 Like

Hey, Thanks for all the work so far.

Got a bit of a question for you. I live in Norway, so when using sun elevation settings, simply using a time based trigger wont work. As well, the sun rising and setting has a large variation between summer and winter.

So instead, to trigger it, i use a threshold sensor, and set the elevation about 5% more than what i want when starting to set, so in practical terms, i set the binary sensor, so that the sun is 20% over the horizon, using the sun integration in home assistant, which gives current elevation.

When the sun dips below 20%, the binary sensor turns on, it stays on until it goes over 20%.

So far, this has worked great for turning ON the lights, see I want my lights to turn ON when the sun goes down, and off when they come up. I am using elevation inverted, and as i said the ON works greatā€¦ itā€™s the OFF

It doesnā€™t seem to happen.

What iā€™m expecting, is that whilst the binary sensor is on, the automation is running, constantly checking the elevation and updating the lights accordingly, but what I think happens is that only when the binary sensor turns from OFF to ON does the automation run, until the lights get to 100% then it stops the automation.

So I am going to experiment with an inverse of the binary sensor, one that turns ON when the suns elevation rises above say, -10% where the llights should start turning OFF when the sun goes from -5% to 5%

Thoughts?

@danielcherubini

Hi Daniel, welcome to the community.

I would do it like this;

Step 1: For the trigger, you have several options. The goal is to have the trigger activated well before sunset and remain active well after sunrise. 2 options are;

  • Option 1 - Schedule helper: Set the time as suggested. For example, you could configure it from 4 PM to 10 AM. Once created add it into the trigger.

  • Option 2 - Toggle helper: To add a toggle helper into the trigger. Then keep your toggle helper on 24/7, and the trigger will stay active.

    1. To add a toggle helper into the trigger, first add any entity as the trigger.
    2. Then, click on the three dots in the top right corner and select ā€œEdit in YAML.ā€
    3. Replace the trigger entity with your toggle helper entity ID and save the changes.

    Create a helper go to;

    1. Navigate to Settings > Device & Services > Helpers tab at the top.
    2. Click the Create helper button.
    3. Create the schedule or toggle helper as your chose.

Step 2: Set up the sun elevation condition.

  1. Sun Elevation: In the blueprint, enable it and set up your elevation setting. I see you know what to do here.

Now it will be triggered on sun elevation and you can easily set it up in the blueprint. No need for your threshold sensor or any other sensor :wink:

Let us know how you go.

Blacky :smiley:

I can not import this blueprint automatically or manually(create file, copy raw text from gist). Any ideas why? Thanks

Invalid blueprint: extra keys not allowed @ data['blueprint']['input']['ambient_settings']['collapsed']. Got True extra keys not allowed @ data['blueprint']['input']['ambient_settings']['icon']. Got 'mdi:theme-light-dark' extra keys not allowed @ data['blueprint']['input']['ambient_settings']['input']. Got {'include_ambient': {'name': 'Use The Ambient Options (Optional)',...........

@SeRG1k17

Hi Sergey, and welcome to the community.

You are on a old version of Home assistant. You must be on Home Assistant Version 2024.6 or later. Please update if you can.

TIP: Best to do it automatically using the import blueprint button. Then it will be easy to update later.

Blacky :smiley:

1 Like

Hey, thanks for the reply, however youā€™ve missed the key part, I live in Norway, far north, like its summer right now, and the sun doesnā€™t start setting till 10pm, in winter thats more like 1pm

edit: To elaborate more on this, right now, sunset is at 10-11pm, and rise is at 1-2am
in winter thats more like, sunrise at 10-11am, and sunset at 1-2pmā€¦ see the issue?

The variation there is too much. So the issue ISNT the start, but the second part, hence using the suns elevation to enable a binary trigger similar to an on/off functionality of the schedule triggerā€¦

The issue is, even if i used your schedule helper like you suggested, the lights arenā€™t going off in the morning, just on at night.

So without digging into the yaml, iā€™m curious did you set some kind of "wait for x hours " between the sun set, to the sunrise? because if so, that wont work here.

Omg, so easy fix. Thank you. Will do it

1 Like