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

This is whats happens with my lights when using this scriptā€¦ The lights keep turning off.

My threshold is set to 200 and as you can see it drops more than once under that threshold and a couple of minutes later is peaks above it.

So iā€™ve created a manual filter sensor that monitors the average for 3 minutes, the most of the drops will be filtered out.

  name: "Lux sensor"
  entity_id: sensor.bh1750_illuminance
  filters:
    - filter: time_simple_moving_average
      window_size: "00:03"
    - filter: time_throttle
      window_size: "00:03" 

This gives me the opportunity to get my own average sensor that i can use for this blueprint.

@EvertJob

Not really following you here but I donā€™t think it will do what your asking.

Blacky :grinning:

First of all, hello to everyone and Iā€™m really grateful to Blacky for taking the time to dedicate to all these great automations.
Until now, Iā€™ve been using Fibaro HC3 and finally switched to HA.
Iā€™m out of the stone age.
I use automation to automate lighting and I have a few questions.

  1. How can I arrange for my lights (switch, dimmer, RGBW) to turn on depending on the external lux sensor, that is, when the external lighting drops below a certain minimum, the lights in the house turn on (ON/OFF only) and also turn off after a certain period of time and also turn off when the external lighting is higher than the set minimum. So far, Iā€™ve managed to arrange for them to turn on, stay on for a defined time and then turn off. But this happens regardless of the external lighting (I have an external lux sensor). It would be great if I could change the duration of the lights on (delay) depending on the time of day (morning, day, evening, night).
  2. I tried to put RGBW (Fibaro) in the automation, and I have one trigger that turns on that light. I canā€™t seem to start that automation, or even when I manually start (Run) the automation, it doesnā€™t start. (Where could be the error).
    Thanks in advance for your answers.

Can I use this blueprint to have a minimium light level in a room?

What I try to achieve:
I have a room-occupaction sensor for my room and a light sensor. Now I want to have a minimum light level in the room as I donā€™t want to sit in the dark. But I also donā€™t want to have the light turn on if itā€™s not necessary - because itā€™s enough light from the sun coming into the room. So it would be cool if the light dims itself above a defined lux level.

Hope Iā€™ve been able to explain my idea.

@vedran1

It sounds like my :bulb: Sensor Light blueprint may work better for you.

It is a bit confusing because you are wanting the lights to turn on when your ambient is low and turn OFF when you ambient it high. That would be the ambient trigger.

But then you only want them ON for X time and then turn OFF and different for morning , day, evening and night but with ambient they just turn ON when the light level is low and turn OFF when the light level increases.

Blacky :grinning:

@Eimeel

It sounds like my :bulb: Sensor Light blueprint may work better for you.

In the sensor light blueprint (above link) use your room-occupaction sensor as the trigger and then use the ambient condition.

Blacky :grinning:

1 Like

@Blacky [feature request]. Please considering allowing the trigger to be any State Entity type/valueā€¦ like using Input_Selector.

I use your BPs for about half of my automations, they are fantastic, thank you. I hope that you will expand this BP, and a few others, to allow for triggers that are not just on/off entity values. again, thank you!

@Blacky please forgive me that I did not read all of the 327 messages here but I have a problem. I recently moved from FHEM to HA so maybe I think in an ā€œincorrectā€ way when using your blueprint (and thank you so much for sharing it).

What I want to do is simple: I have a lamp. I want to switch the lamp on when it is 7am and off when it gets bright. In the evening, I want to switch it on when it gets dusky and switch off at 10pm. I set trigger ambient to a lux sensor and two values, time trigger to the two times. It worked perfectly in winter.

Now my problem: in summer, it is already bright when the 7am trigger fires. I guess it will switch off with the next trigger from the lux sensor, but I expected these two options to be combined, but they obviously are not. I maybe think FHEM DOIF.

Any hint? Maybe I think too complicated and it is easy.

Best Regards,
Carsten.

@Ltek

Thanks for your inputā€¦ I will put it on the list of suggestions.

Blacky :grinning:

@carsten12

Maybe you can try using my :bulb: Sensor Light blueprint.

You would then create a schedule helper, ON at 7am and say OFF at 10am, then also ON at 3pm and OFF at 10pm. Use this as the trigger.

Then use the Ambient condition and set your lux values.

Now if it is 7am and it is to bright it will not come ON but if your lux is below your Low Lux Value the light will come ON. Once it goes above your High Lux Value the light will turn OFF.

In the evening the trigger will be ON at 3pm but if your lux value is above your Low Lux Value the light will remain OFF. When the lux level drops below your Low Lux Value as it gets dark your light will turn ON and then at 10pm your light will turn OFF.

You could also use the Sun Elevation but if your using your LUX value it should work well.

One option you must use when using the Ambient Condition is to make sure you select NO - My Ambient Light Sensor is not affected by the Lights so the High Lux Value will turn your lights OFF. However if your LUX reading is effected by your light then maybe consider just using the sun elevation condition and not your Ambient Condition. If you keen to use the Ambient Condition then it is good to have a outside lux sensor that reads the lux values and is not effected by any lights in your house. You then can use that lux sensor for all your automations.

Hope this helps you.

Blacky :grinning:

Having some trouble getting this to work. I have three lights in my office, which I have also grouped into one group that I am using as an on/off trigger. I trigger the lights with Alexa. All I want to happen, is when the lights are triggered on, I want to have the blueprint monitor the brightness and color temp based on sun elevation. The script is showing a trace being activated, but it doesnā€™t look like itā€™s actually running through any of the options in the trace. What am I doing wrong? This is what I have:

alias: Office lights
description: ""
use_blueprint:
  path: Blackshome/smart-light.yaml
  input:
    include_entity_state:
      - entity_on
    entity_input: light.office_lights
    include_light_control:
      - use_brightness
    light_transition_on: 0
    light_transition_off: 0
    include_light_colour_control: use_colour_temperature
    light_colour_temperature: 3000
    include_dynamic_lighting: enable_sun_elevation_colour_brightness
    dynamic_lighting_boolean: input_boolean.office_lights
    dynamic_lighting_state_control_entity: light.office_lights

@aeromax

Welcome to the community.

You need to enter in your office lights into the Lights section in Lights - Switches - Scenes - Scripts.

Then it will work for you.

Blacky :grinning:

Ah I got it. I also had something set to devices instead of entities and that was returning an error. It works now! Thank you.

1 Like

For Dynamic Lighting, do these settings only apply to the entities that are in the Lights section? My question relates to both Smart Light and also Sensor Light. I have lights in the room that are not turned on by this automation, but when they are turned on I want them to adjust and match the lights that are already being controlled by Dynamic Lighting.

@bradgclark

Dynamic Lighting only works for the light entities entered into the Lights section. This is for both Smart Light and also Sensor Light blueprints.

Dynamic Lighting will NOT work in night lights.

Blacky :grinning:

I set this up for the first time, it kind of works. Through some tinkering I found that however I set it up is causing it to endlessly trigger and actually freeze my entire smart home system. My goal is to set it up during the day to get dimmer down to 20% when the most sun light is out and as a night light in the kitchen.

alias: Kitchen Light Control
description: ""
use_blueprint:
  path: Blackshome/smart-light.yaml
  input:
    include_sun:
      - sun_falling
    light_switch:
      entity_id: light.kitchen_light
    include_light_control:
      - use_brightness
      - use_transition
    include_light_colour_control: use_colour_temperature
    light_colour_temperature: 6500
    include_dynamic_lighting: enable_sun_elevation_colour_brightness
    dynamic_lighting_max_colour_temp: 6500
    include_bypass: []
    bypass_auto_off_delay: 20
    include_bypass_auto_off: []
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - sun_enabled
    include_night_light_control:
      - use_brightness
      - use_transition
      - use_delay
    include_night_light_colour_control: use_colour_temperature
    night_light_colour_temperature: 3000
    light_transition_on: 3.5
    light_transition_off: 3
    dynamic_lighting_min_brightness: 30
    dynamic_lighting_min_colour_temp: 2000
    light_brightness: 20
    night_light_transition_on: 3
    night_light_transition_off: 3
    night_lights:
      entity_id: light.kitchen_light

Hey @Blacky,

First of all: what an amazing work you did on this and your other Blueprints. It wonderfull how much options they provide and how much support you offer to anyone who has an question. Great work!

Now, I do have a small question myself. Ifā€™ve got the situation where I want to turn my living room lights on based on two variables: the current state of my home occupancy which is based on device trackers (states Home and Away) and the elevation of the sun. I would like both of these variables to be used as triggers (so trigger when I get home or when the sun falls) but also conditionally at the same time (trigger only when I get home and the sun is below a certian point, or tirgger when the sun falls and Iā€™m also home).
From that point I donā€™t need to do anything super fancy; just turn on a Hue scene and thatā€™s all.

I canā€™t find anything that points me in the correct direction on the possitilities of this function with your Blueprint. Could you maybe give me a hand on this matter?

Cheers,
Remco :smiley:

@nikaiwolf

Welcome to the community.

For a light to come ON at sunset and OFF at sunrise at 20% this is your YAML.

alias: A Smart Light Forum
description: ""
use_blueprint:
  path: Blackshome/smart-light.yaml
  input:
    include_sun:
      - sun_falling
      - sun_rising
    light_switch:
      entity_id: light.kitchen_light
    include_light_control:
      - use_brightness
      - use_transition
    include_light_colour_control: use_colour_temperature
    light_colour_temperature: 6500
    light_transition_on: 3.5
    light_transition_off: 3

You donā€™t need Dynamic lighting and night lights.

Blacky :grinning:

I havenā€™t tried this and it all in my head :thinking: maybe try this.

Step 1: Create a Template Binary Sensor

Before we begin, ensure your device tracker is already set up. Now, follow these steps to create a Template Binary Sensor to track when no one is home:

  1. Go to Settings > Devices & Services > Helpers (top tab).
  2. Click Create Helper.
  3. Select Template, then choose Template Binary Sensor.
  4. Provide a Name and select a Device Class (optional).
  5. (Optional) Link this sensor to an existing device for better organization.
  6. In the State template field, enter one of the following codes:

State Templates
You will have to choose the one that suits you the best.

  • All devices away
{{ states.device_tracker | selectattr('state', 'eq', 'home') | list | count == 0 }}
  • All persons away
{{ state_attr('zone.home', 'persons') | list | length == 0 }}
  • All specified persons away
{{ state_attr('zone.home', 'persons') | list | select('in', ['person.one_here', 'person.two_here']) | list | count == 0 }}

Step 2: Configure the bypass

Enable bypass option 2 Bypass Switch - Turn lights OFF and enter in your new Template Binary Sensor into the bypass.

When you arrive home, the bypass will turn OFF. If the sun is below your set elevation (sun falling), the light will turn ON; otherwise, it will remain OFF. Once home, the light will turn ON when the sun drops below your set elevation. When you leave while the light is ON, it will turn OFF.

Let us know if this works.

Blacky :grinning:

Thanks @Blacky. Iā€™m just going to stick with the Adaptive Lighting Integration then. I would love to move this functionality into Sensor Light, but I need to be able to adjust non-triggered lights as well.

How do I go about a feature request? Is it possible to add the Timer option to Sensor Light and Smart Light that is in Manual Light? I prefer to use the Timer helpers because I can see how much time is left before the lights turn off in my dashboards.