🔆 Smart Light - Entity - Sun Elevation - Ambient & Time Triggers

No worries. Enjoy your vacation!

Edit: FYI - I have changed the ‘lights off’ event to turn the lights off at a fixed time until there is a solution.

1 Like

Thanks mate,
i’ll keep fiddling.

enjoy your time.

@greenembrace

Thanks Daniel, I fix it when I get back form holidays.

Blacky :smiley:

Hi,

Thank you very much for all your Blueprints. It makes complex automations so easy and cleanly presented.

I just imported the Smart Light blueprint in order to turn ON and OFF outdoor lights.

I have set up to turn lights ON on sun elevation falling and turn them OFF at 22h30.

Normally, it all works fine.

However, last night I was doing some late night tweaking in Home Assistant and restarted Home Assistant at around 00h00. To my surprise, the outdoor lights turned ON.
I see there is a trigger on Home Assistant starting in the automation debug trace. I guess the automation validates sun elevation falling condition is valid and just turns the light ON, no matter what time it is at the moment of Home Assistant restart.

Is this normal behavior?
I just want to make sure I’m not missing anything.

@psyko_chewbacca

Thanks for the info, I going to have a look at this in the next day or 2. I will also investigate this. You may see an update out soon.

Blacky :smiley:

New update 2.3

Smart Lighting: Your Lights, Your Way - Take Control and Customize it to Perfection! :bulb: :sparkles:

:bug: Bug Fixes

  • Fixed bug when using sun elevation falling, light would not turn OFF.
  • Fixed bug in bypass when turning bypass OFF and using sun condition light would not turn OFF.
  • Fixed many bugs in home assistant restart.

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:

Enjoy

Blacky :grinning:

Thank you for all the work it is really impressive.
I am currently using it to turn on the TV light strip after sunset. Trigger is TV state on.
Is there any way to trigger it if the TV was already turned on before sunset or the set hour?

@Kaiohshin

Welcome to the community.

I am not sure how you are doing this. If the TV is the trigger it will turn the light ON whenever the TV is turned ON regardless of the sunset.

If you’re asking whether this blueprint will turn ON the TV light strip if the TV was already ON before sunset, then this isn’t the right solution.

Instead, you’ll need to use my :bulb: Sensor Light Blueprint. With that setup, you can use the TV as the trigger and set the sun elevation condition. I specifically chose sun elevation over sunset or sunrise with time for certain reasons, which I explain in the FAQ section of the Sensor Light blueprint.

Using my :bulb: Sensor Light Blueprint this is what will happen: If the sun elevation condition is met and you turn ON the TV, the TV light strip will turn ON. However, if the TV is turned ON before the sun elevation condition is met, the light strip won’t turn ON immediately. But as the sun sets and the elevation crosses your set point, the TV light strip will turn ON.

Hope this helps you.

Blacky :smiley:

1 Like

Hi. I need som help. I’m having a hard time getting this automation to work. The trigger is a bool that is turned on when someone arrives back home, and turns off when no one is home. This does not seem to trigger anything. The lights are turned off. I use the dynamic lightning, and the lux is between the limits. Still no lights go on. Clearly I am doing something wrong, I am just unable to see it :see_no_evil:

The yaml is:

alias: _Smart Lights - Stue
description: ""
use_blueprint:
  path: Blackshome/smart-light.yaml
  input:
    include_sun: []
    include_ambient: []
    ambient_light_value: 0
    ambient_light_value_off: 0
    light_switch:
      entity_id:
        - light.kobberlampe
        - light.kartell
        - light.gul
        - light.leselys
    include_light_control: []
    light_brightness: 1
    include_dynamic_lighting: enable_lux_controled_brightness
    dynamic_lighting_max_lux: 150
    dynamic_lighting_min_lux: 10
    dynamic_lighting_max_brightness: 70
    dynamic_lighting_min_brightness: 2
    dynamic_lighting_min_colour_temp: 2000
    dynamic_lighting_lux_sensor: sensor.sensor_spisestue_belysningsstyrke ##This is a HUE sensor
    include_bypass: []
    bypass_lights_on: []
    bypass_lights_off: []
    dynamic_lighting_heartbeat: 0.25
    dynamic_lighting_step_value: 10
    include_entity_state:
      - entity_on
      - entity_off
    include_light_colour_control: disable_colour_control
    dynamic_lighting_dead_zone: 5
    dynamic_lighting_max_colour_temp: 4500
    include_time: []
    dynamic_lighting_sun_elevation_end_rising: 35.52
    dynamic_lighting_sun_elevation_start_falling: 35.52
    bypass_lights_stop: []
    entity_input: input_boolean.hus_aktivt ##the bool triggering ON/OFF
    light_transition_on: 2
    dynamic_lighting_sun_elevation_end_falling: 0
    dynamic_lighting_sun_elevation_start_rising: 1
    dynamic_lighting_boolean: input_boolean.dynamic_lighting_helper
    after_time: "00:00:00"
    bypass_time_delay: 0

@vegard

I have tested your YAML here replacing the trigger, LUX sensor, Light and helper and all works. Just make sure your light will turn ON a 2% brightness. Also just check that your sensor.sensor_spisestue_belysningsstyrke is the LUX sensor of the hue.

Blacky :smiley:

Thanks for the quick reply. I am fairly certain that this sensor gives the lux:
image

And tried the dynamic_lighting_min_brightness: 2 anywhere from 0% to 10% without any changes. The only time I get this automation to trigger now, is by restarting HA, then it triggers on the boolean I guess. Well, well… guess I have to sit in the dark (pun intended) a little while longer :smiley:

@vegard

Can you try this. Disable dynamic lighting and in light control enable Use Brightness and set the brightness to 50%. What I am trying is to see if the boolean will turn the light ON at 50% without dynamic lighting and your LUX sensor. Below is your YAML with the adjustments.

alias: _Smart Lights - Stue
description: ""
use_blueprint:
  path: Blackshome/smart-light.yaml
  input:
    include_sun: []
    include_ambient: []
    ambient_light_value: 0
    ambient_light_value_off: 0
    light_switch:
      entity_id:
        - light.kobberlampe
        - light.kartell
        - light.gul
        - light.leselys
    include_light_control:
      - use_brightness
    light_brightness: 50
    include_dynamic_lighting: disable_dynamic_lighting
    dynamic_lighting_max_lux: 150
    dynamic_lighting_min_lux: 10
    dynamic_lighting_max_brightness: 70
    dynamic_lighting_min_brightness: 2
    dynamic_lighting_min_colour_temp: 2000
    dynamic_lighting_lux_sensor: sensor.sensor_spisestue_belysningsstyrke ##This is a HUE sensor
    include_bypass: []
    bypass_lights_on: []
    bypass_lights_off: []
    dynamic_lighting_heartbeat: 0.25
    dynamic_lighting_step_value: 10
    include_entity_state:
      - entity_on
      - entity_off
    include_light_colour_control: disable_colour_control
    dynamic_lighting_dead_zone: 5
    dynamic_lighting_max_colour_temp: 4500
    include_time: []
    dynamic_lighting_sun_elevation_end_rising: 35.52
    dynamic_lighting_sun_elevation_start_falling: 35.52
    bypass_lights_stop: []
    entity_input: input_boolean.hus_aktivt ##the bool triggering ON/OFF
    light_transition_on: 2
    dynamic_lighting_sun_elevation_end_falling: 0
    dynamic_lighting_sun_elevation_start_rising: 1
    dynamic_lighting_boolean: input_boolean.dynamic_lighting_helper
    after_time: "00:00:00"
    bypass_time_delay: 0

Blacky :smiley:

I can confirm that this worked. Toggled the boolean and the lights turned on to 50%.
What does this say you think?

Okay that is good. It tells me that your boolean, lights and brightness works.

I have added the sun elevation as your LUX sensor. Hope you have this entity in HA if not can you use a temperature sensor rather than the lux sensor. Just copy the entity ID of your temp sensor and paste it in the Dynamic Lighting - Ambient Light Sensor.

I also removed your helper and I am trying to testing your LUX sensor.

alias: _Smart Lights - Stue
description: ""
use_blueprint:
  path: Blackshome/smart-light.yaml
  input:
    include_sun: []
    include_ambient: []
    ambient_light_value: 0
    ambient_light_value_off: 0
    light_switch:
      entity_id:
        - light.kobberlampe
        - light.kartell
        - light.gul
        - light.leselys
    include_light_control:
      - use_brightness
    light_brightness: 50
    include_dynamic_lighting: enable_lux_controled_brightness
    dynamic_lighting_max_lux: 150
    dynamic_lighting_min_lux: 10
    dynamic_lighting_max_brightness: 70
    dynamic_lighting_min_brightness: 20
    dynamic_lighting_min_colour_temp: 2000
    dynamic_lighting_lux_sensor: sensor.sun_solar_elevation
    include_bypass: []
    bypass_lights_on: []
    bypass_lights_off: []
    dynamic_lighting_heartbeat: 0.25
    dynamic_lighting_step_value: 10
    include_entity_state:
      - entity_on
      - entity_off
    include_light_colour_control: disable_colour_control
    dynamic_lighting_dead_zone: 5
    dynamic_lighting_max_colour_temp: 4500
    include_time: []
    dynamic_lighting_sun_elevation_end_rising: 35.52
    dynamic_lighting_sun_elevation_start_falling: 35.52
    bypass_lights_stop: []
    entity_input: input_boolean.hus_aktivt ##the bool triggering ON/OFF
    light_transition_on: 2
    dynamic_lighting_sun_elevation_end_falling: 0
    dynamic_lighting_sun_elevation_start_rising: 1
    after_time: "00:00:00"
    bypass_time_delay: 0

EDIT: I updated your YAML again and change the min brightness to 20% for now just to make sure the light will come on.

Sorry for the late reply to this. I created a sensor for the elevation, and this seems to work now with dynamic set to option 8 :slight_smile:

@vegard

All good… glad you got it working. If you need mare help just let us know.

Blacky :smiley:

Great work on this blueprint it catches almost all of my scenarios, thanks.
For my lights OFF I now use a random delay added to my switch-off time, is something like that possible?

delay: 00:{{(range(5,26)|random)}}

@GH2user

Currently they are not supported.

Blacky :smiley:

Hello @Blacky and thanks for your comprehensive work!
I’m trying to create my automation but it does not adjust the brightness as I expect.
Can you spot what I did wrong?


use_blueprint:
path: Blackshome/smart-light.yaml
input:
include_ambient:
- ambient_high
ambient_light_sensor: sensor.sensore_illuminamento_illuminance_lux
ambient_light_value: 10
ambient_light_value_off: 120
light_switch:
entity_id: light.0xa4c138f365476158
include_light_control:
- use_brightness
- use_transition
light_transition_off: 2
light_brightness: 15
include_dynamic_lighting: enable_lux_controled_brightness_inv
dynamic_lighting_lux_sensor: sensor.sensore_illuminamento_illuminance_lux
dynamic_lighting_min_lux: 10
dynamic_lighting_min_brightness: 5
bypass_lights_on:
bypass_lights_off:
include_weekdays: weekday_enabled
dynamic_lighting_max_lux: 900
weekday_options:
- mon
- tue
- wed
- thu
- fri

@samumar

Your welcome.

Yep. I can see you are using Trigger - Ambient. The high you selected is to turn it OFF… the low is to turn it ON and you have not selected any trigger to turn ON (run) the automation. So you will need to decide what you would like to use.

I look at your dynamic lighting and you have a setting for 900 lux so I adjusted your YAML to turn ON (run) the automation using Trigger - Ambient low and the setting of 900 lux. I then set the high to 1000 lux and this is were it will turn OFF (stop) the automation. It may not be what you would like but it is just to give you a working example so change it as needed. What will happen is when the lux drops below 900 lux your light will turn ON and dynamic lighting will work. When the lux goes above 1000 lux the light will turn OFF. You may decide to use another trigger other than Trigger - Ambient so just change it to your liking. Below is your YAML. A tip is to use the “</>” in the menu of this text editor and then paste your YAML in there… it keeps the correct format. Try the below YAML in your automation.

use_blueprint:
  path: Blackshome/smart-light.yaml
  input:
    include_ambient:
      - ambient_high
      - ambient_low
    ambient_light_sensor: sensor.sensore_illuminamento_illuminance_lux
    ambient_light_value: 900
    ambient_light_value_off: 1000
    light_switch:
      entity_id: light.0xa4c138f365476158
    include_light_control:
      - use_brightness
      - use_transition
    light_transition_off: 2
    light_brightness: 15
    include_dynamic_lighting: enable_lux_controled_brightness_inv
    dynamic_lighting_lux_sensor: sensor.sensore_illuminamento_illuminance_lux
    dynamic_lighting_min_lux: 10
    dynamic_lighting_min_brightness: 5
    bypass_lights_on: []
    bypass_lights_off: []
    include_weekdays: weekday_enabled
    dynamic_lighting_max_lux: 900
    weekday_options:
      - mon
      - tue
      - wed
      - thu
      - fri

Blacky :smiley: