silly question, do you have a blueprint for Sunset?
can you please add more offset, i have mine at +3 right now and i would like to turn on lights aprox 1hour earlier, it was pretty ādarkā when they came on tonight.
Hi great work!!! Is it possible to add a condition like home of not??
+1 for adding a condition
+1 for off at Sunset. I usually have a night-mode trigger to turn outside lights off but I would like to make sure they donāt run all day if that doesnāt happen for some reason. Is there a similar Blueprint that includes this?
I added this tonight and had to wait for it to trigger my lights. Unfortunately it only triggered one of my 2 selected lights. Their both sonoff lights, one is a bulb located on the ceiling and the other is a RGB led strip locate under the tv cabinet.
I tried removing and adding the entity again but this didnāt work unfortunately.
I tested a bit more and i think it has to do with the brightness value. I tried making a normal automation, and the led strip didnāt want to turn on when i set the brightness to 50%. When i removed the brightness value it turned on when activating. It is a bit strange since the led strip is dimable.
Hi, thanks for creating this blueprint.
I works great, but it there also a blueprint for switch light off at sunrise? Iām using your blueprint to turn on some lights in the garden. No i also want them turn off automatically.
In trying to setup a complimentary blueprint/automation to turn my lights off at sunrise, I discovered that the rising
state variable of sun is also convenient to use to prevent these automations from occurring both in the morning and evening when the sun is at its elevation offset. I had originally tried to use after: sunset
similar to what the your blueprint does with after:sunrise
, but saw this note in the sun conditions documentation:
Note that if only
before
key is used, the condition will betrue
from midnight until sunrise/sunset. If onlyafter
key is used, the condition will betrue
from sunset/sunrise until midnight.
So, my condition was not true anymore after midnight. I ended up using this condition, which is true from midnight to noon and false from noon to midnight:
condition:
- condition: template
value_template: '{{state_attr("sun.sun", "rising") == true}}'
~Dan
How can I add a condition to this blueprint? I only want it to execute if we are home.
What is miss that i can choose which colour the light goes on.
to make this work for sunrise would i just change these:
below: !input elevation_shift
to
above: !input elevation_shift
and
after: sunrise
to
after: sunset
my attempt at reversing this to work at sunrise
EDITā¦ Iām thinking about what i want here.
turning lights off at sunrise should only be done if they are turned on automatic, why? becuase if they are turned on by a human lets say 10 minutes before sunrise, you might end up having a hot morning shower in darkness, spec in winter time
for turning the lights on at sunset, i would say its safe to only do so if they are off, if they are on they might be set to a higher brightness and you might be cooking the dinner, and if the automation is set to turn on at 10% and you have it set to 70% you loose a lot of light
Hi, thanks for coming up with a blueprint that hopefully will be configurable so that we may all use it to our likings. On that note, and maybe this has been asked before: is it possible to NOT mess with the lighting settings when turning them on? I would like them to go back to the way they were (itās not nice to adjust them all manually and then see that work go to waste with one percentage for all). Just putting a checkbox next to it that asks ārestore latest state?ā and disables the brightness when on would be nice.
This seems to work fine but would it be possible to also set the color temp? I have Ikea TrƄdfri bulbs and they are very yellow when turned on.
Hi, @CyanAutomation,
I find it cleaner to have the Condition like
# Add a Condition to ensure that this specific Elevation happens during Sunset
condition:
- condition: template
value_template: '{{ state_attr("sun.sun", "rising") == false }}'
(I copied this out of my own Automation, and hope the Syntax is the same for your Blueprint)
Hello, maybe it will help someone. People have been asking for color management.
Do not judge strictly, I just started to understand HA. And many thanks to the author, his work was the starting point!
blueprint:
name: Scheduled Light Automation
description: Turn on the following lights at time
domain: automation
input:
target_light:
name: Lights
description: This is the light (or lights) that will be activated at sunset
selector:
target:
entity:
domain: light
target_trigger:
name: trigger type
description: Choose trigger
default: "time"
selector:
select:
options:
- "time"
- "sunset"
trigger_time:
name: Manual time
description: Time to trigger
default: "18:00:00"
selector:
time:
elevation_shift:
name: Elevation Shift
description:
Using an elevation offset (height of sun relative to the horizon)
to shift the sunset trigger, either earlier or later. Positive values bring
the automation start time forward, whilst negative values delay the start
time. To approximate Golden Hour - set the Elevation Offset to 1.
default: 0.0
selector:
number:
mode: slider
unit_of_measurement: "Ā°"
min: -10.0
max: 10.0
step: 1.0
boolean_IsOnlyOn:
name: is only turned on light
description: Do if you want to turn on only already turned on light
default: false
selector:
boolean:
target_color_mode:
name: color mode
description: Choose the one that your device supports
default: "only_brightness"
selector:
select:
options:
- "only_brightness"
- "color_temp"
- "rgb"
target_brightness:
name: Brightness
description: Brightness of the light(s) when they're activated
default: 50
selector:
number:
mode: slider
unit_of_measurement: "%"
min: 5.0
max: 100.0
step: 5.0
target_color_temp:
name: color temperature
description: kelvin of the light(s) when they're activated
default: 4000.0
selector:
number:
mode: slider
unit_of_measurement: "K"
min: 1700.0
max: 6500.0
step: 100.0
target_rgb:
name: rgb color
description: example 255,0,0
default: "255,183,123"
selector:
text:
target_person:
name: Person
description: Person/Device that will be tracked.
default: "none"
selector:
entity:
domain: person
target_device:
name: Device
description: Device needs to run the official Home Assistant app.
default: "none"
selector:
device:
integration: mobile_app
target_zone:
name: Zone
default: "zone.home"
selector:
entity:
domain: zone
mode: single
variables:
target_light: !input "target_light"
boolean_IsOnlyOn: !input "boolean_IsOnlyOn"
target_color_mode: !input "target_color_mode"
target_brightness: !input "target_brightness"
target_color_temp: !input "target_color_temp"
target_rgb: !input "target_rgb"
target_person: !input "target_person"
target_zone: !input "target_zone"
target_device: !input "target_device"
trigger_variables:
target_trigger: !input "target_trigger"
trigger_time: !input "trigger_time"
elevation_shift: !input "elevation_shift"
trigger:
- platform: template
value_template: >
{% if target_trigger == "time" %}
{{ as_timestamp(now())|timestamp_custom('%H:%M') == trigger_time[:-3] }}
{% elif target_trigger == "sunset" %}
{{ states('sun.sun') == 'above_horizon'
and state_attr("sun.sun", "rising") == false
and state_attr('sun.sun', 'elevation') <= elevation_shift|int }}
{% endif %}
condition:
- condition: template
value_template: >
{% set state_person = (target_person == 'none' or is_state(target_person, target_zone.split('.')[1])) %}
{########################################################################################}
{% set state_device = true %}
{% set trackable_device = device_entities(target_device)|select('match', 'device_tracker.*')|list %}
{% if trackable_device|length > 0 %}
{% set state_device = is_state(trackable_device[0], target_zone.split('.')[1]) %}
{% endif %}
{########################################################################################}
{% set state_light = true %}
{% if boolean_IsOnlyOn %}
{% set result_area_id, result_entity_id, result_device_id = false, false, false %}
{% if target_light['area_id'] is defined %}
{% set result_area_id = expand(states.light)
|selectattr('state', 'eq', 'on')
|selectattr('entity_id', 'in', area_entities(target_light['area_id']))
|map(attribute='entity_id')
|list
|length > 0
%}
{% elif target_light['entity_id'] is defined %}
{% set result_entity_id = is_state(target_light['entity_id'], 'on') %}
{% elif target_light['device_id'] is defined %}
{% set result_device_id = is_state(device_entities(target_light['device_id'])[0], 'on') %}
{% endif %}
{% set isAtLeastOneLightIsOn = result_area_id or result_entity_id or result_device_id %}
{% set state_light = isAtLeastOneLightIsOn %}
{% endif %}
{########################################################################################}
{{ true if state_person and state_device and state_light else false }}
action:
- service: light.turn_on
target: "{{ target_light }}"
data: >
{% if target_color_mode == "only_brightness" %}
{{ {'brightness_pct':target_brightness|int} }}
{% elif target_color_mode == "color_temp" %}
{{ {'brightness_pct':target_brightness|int, 'kelvin':target_color_temp|int} }}
{% elif target_color_mode == "rgb" %}
{{ {'brightness_pct':target_brightness|int, 'rgb_color':[target_rgb.split(',')[0], target_rgb.split(',')[1], target_rgb.split(',')[2]]} }}
{% endif %}
I would also love some way it including devices entering zones in this!
Could you explain your request. Turn on before sunset if the device is in the zone, right?
Could be awesome to have a timer or time implemented to turn off.
E.G
Turn on at sun elevation WITH the option for elevation as you have now. Turn off at a certain time a day or after X amount of hours.
Thanks
Hi, nice blueprint but I need the opposite, i.e. turn on at sunrise and off at sunset, both with an option for an elevation shift. Is this possible?