227 lines
4.8 KiB
Plaintext
227 lines
4.8 KiB
Plaintext
blueprint:
|
|
name: Outdoor Light - Sunset, Dim, Night Off, Morning On
|
|
description: >
|
|
Turns outdoor lights on when it gets dark, optionally dims them at a
|
|
configured time, turns them off at a configured night time, optionally
|
|
turns them back on in the morning if it is still dark, and finally
|
|
turns them off again when daylight returns.
|
|
|
|
domain: automation
|
|
|
|
input:
|
|
|
|
light_target:
|
|
name: Light(s)
|
|
selector:
|
|
target:
|
|
entity:
|
|
domain: light
|
|
|
|
enable_entity:
|
|
name: Enable Entity (optional)
|
|
description: >
|
|
Automation only runs while this entity is ON.
|
|
default:
|
|
selector:
|
|
entity:
|
|
|
|
evening_elevation:
|
|
name: Evening elevation
|
|
description: Turn lights on below this sun elevation.
|
|
default: -4
|
|
selector:
|
|
number:
|
|
min: -12
|
|
max: 5
|
|
step: 0.5
|
|
mode: slider
|
|
unit_of_measurement: "°"
|
|
|
|
morning_elevation:
|
|
name: Morning elevation
|
|
description: Turn lights off above this sun elevation.
|
|
default: -4
|
|
selector:
|
|
number:
|
|
min: -12
|
|
max: 5
|
|
step: 0.5
|
|
mode: slider
|
|
unit_of_measurement: "°"
|
|
|
|
dim_enabled:
|
|
name: Enable Dimming
|
|
description: >
|
|
Dim the lights to a configured brightness at a configured time.
|
|
default: false
|
|
selector:
|
|
boolean:
|
|
|
|
dim_time:
|
|
name: Dim Time
|
|
description: Time when the lights should be dimmed.
|
|
default: "22:00:00"
|
|
selector:
|
|
time:
|
|
|
|
dim_brightness:
|
|
name: Dim Brightness
|
|
description: Brightness percentage to use at the dim time.
|
|
default: 20
|
|
selector:
|
|
number:
|
|
min: 1
|
|
max: 100
|
|
step: 1
|
|
mode: slider
|
|
unit_of_measurement: "%"
|
|
|
|
night_off_enabled:
|
|
name: Enable Night Off
|
|
default: true
|
|
selector:
|
|
boolean:
|
|
|
|
night_off_time:
|
|
name: Night Off Time
|
|
default: "23:00:00"
|
|
selector:
|
|
time:
|
|
|
|
morning_on_enabled:
|
|
name: Enable Morning On
|
|
default: true
|
|
selector:
|
|
boolean:
|
|
|
|
morning_on_time:
|
|
name: Morning On Time
|
|
default: "05:30:00"
|
|
selector:
|
|
time:
|
|
|
|
variables:
|
|
enable_entity: !input enable_entity
|
|
night_off_enabled: !input night_off_enabled
|
|
morning_on_enabled: !input morning_on_enabled
|
|
dim_enabled: !input dim_enabled
|
|
dim_brightness: !input dim_brightness
|
|
|
|
trigger:
|
|
|
|
- id: evening
|
|
platform: numeric_state
|
|
entity_id: sun.sun
|
|
attribute: elevation
|
|
below: !input evening_elevation
|
|
|
|
- id: morning
|
|
platform: numeric_state
|
|
entity_id: sun.sun
|
|
attribute: elevation
|
|
above: !input morning_elevation
|
|
|
|
- id: dim
|
|
platform: time
|
|
at: !input dim_time
|
|
|
|
- id: night_off
|
|
platform: time
|
|
at: !input night_off_time
|
|
|
|
- id: morning_on
|
|
platform: time
|
|
at: !input morning_on_time
|
|
|
|
condition:
|
|
- condition: template
|
|
value_template: >
|
|
{% if enable_entity is none %}
|
|
true
|
|
{% elif enable_entity == '' %}
|
|
true
|
|
{% else %}
|
|
{{ is_state(enable_entity, 'on') }}
|
|
{% endif %}
|
|
|
|
action:
|
|
- choose:
|
|
|
|
#
|
|
# Evening
|
|
#
|
|
- conditions:
|
|
- condition: trigger
|
|
id: evening
|
|
|
|
sequence:
|
|
- service: light.turn_on
|
|
target: !input light_target
|
|
data:
|
|
brightness_pct: 100
|
|
|
|
#
|
|
# Dim
|
|
#
|
|
- conditions:
|
|
- condition: trigger
|
|
id: dim
|
|
|
|
- condition: template
|
|
value_template: "{{ dim_enabled }}"
|
|
|
|
- condition: state
|
|
entity_id: !input light_target
|
|
state: "on"
|
|
|
|
sequence:
|
|
- service: light.turn_on
|
|
target: !input light_target
|
|
data:
|
|
brightness_pct: "{{ dim_brightness }}"
|
|
|
|
#
|
|
# Morning
|
|
#
|
|
- conditions:
|
|
- condition: trigger
|
|
id: morning
|
|
|
|
sequence:
|
|
- service: light.turn_off
|
|
target: !input light_target
|
|
|
|
#
|
|
# Night Off
|
|
#
|
|
- conditions:
|
|
- condition: trigger
|
|
id: night_off
|
|
|
|
- condition: template
|
|
value_template: "{{ night_off_enabled }}"
|
|
|
|
sequence:
|
|
- service: light.turn_off
|
|
target: !input light_target
|
|
|
|
#
|
|
# Morning On
|
|
#
|
|
- conditions:
|
|
- condition: trigger
|
|
id: morning_on
|
|
|
|
- condition: template
|
|
value_template: "{{ morning_on_enabled }}"
|
|
|
|
- condition: numeric_state
|
|
entity_id: sun.sun
|
|
attribute: elevation
|
|
below: !input morning_elevation
|
|
|
|
sequence:
|
|
- service: light.turn_on
|
|
target: !input light_target
|
|
data:
|
|
brightness_pct: 100 |