180 lines
5.4 KiB
YAML
180 lines
5.4 KiB
YAML
# Holiday Package
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Holiday State Helpers
|
|
input_boolean:
|
|
holiday_override_lights_night:
|
|
name: Always Turn On Holiday Lights at Night
|
|
holiday_override_lights_morning:
|
|
name: Always Turn On Holiday Lights in the Morning
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Holiday Sensors
|
|
template:
|
|
- binary_sensor:
|
|
# Christmas Season is the day after Thanksgiving through New Years Eve
|
|
- name: Is Christmas Season
|
|
state: >
|
|
{% set xmas_start = as_datetime('%.4d-11-%.2d'|format(now().year, 22 + (3 - as_datetime(now().year|string + '-11-01').weekday()) % 7 + 1))|as_local %}
|
|
{% set xmas_end = as_datetime('%.4d-01-01'|format(now().year + 1))|as_local %}
|
|
{% set today = today_at('00:00') %}
|
|
{{ xmas_start <= today and today < xmas_end }}
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Holiday Groups
|
|
group:
|
|
holiday_outdoor_lights:
|
|
name: Holiday Outdoor Lights
|
|
entities:
|
|
- switch.christmas_lights_roof
|
|
- switch.christmas_lights_shrubs
|
|
- switch.christmas_lights_front
|
|
|
|
holiday_arch_lights:
|
|
name: Holiday Archway Lights
|
|
entities:
|
|
- light.arches_east
|
|
- light.arches_west
|
|
|
|
holiday_indoor_lights:
|
|
name: Holiday Indoor Lights
|
|
entities:
|
|
- switch.christmas_tree
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Holiday Automations
|
|
automation:
|
|
- alias: Holiday - Turn On Christmas Lights at Sunset
|
|
trigger:
|
|
- platform: sun
|
|
event: sunset
|
|
condition:
|
|
- alias: Christmas Season or Light Override Enabled
|
|
condition: or
|
|
conditions:
|
|
- "{{ is_state('binary_sensor.is_christmas_season', 'on') }}"
|
|
- "{{ is_state('input_boolean.holiday_override_lights_night', 'on') }}"
|
|
action:
|
|
- service: switch.turn_on
|
|
target:
|
|
entity_id:
|
|
- switch.christmas_lights_roof
|
|
- switch.christmas_lights_shrubs
|
|
- switch.christmas_lights_front
|
|
|
|
- alias: Holiday - Turn On Archway Lights at Sunset
|
|
trigger:
|
|
- platform: sun
|
|
event: sunset
|
|
condition:
|
|
- alias: Christmas Season or Light Override Enabled
|
|
condition: or
|
|
conditions:
|
|
- "{{ is_state('binary_sensor.is_christmas_season', 'on') }}"
|
|
- "{{ is_state('input_boolean.holiday_override_lights_night', 'on') }}"
|
|
action:
|
|
- service: light.turn_on
|
|
data:
|
|
brightness_pct: 100
|
|
target:
|
|
entity_id:
|
|
- light.arches_east
|
|
- light.arches_west
|
|
|
|
- alias: Holiday - Turn On Christmas Lights in Morning
|
|
trigger:
|
|
- platform: time
|
|
at: '04:30:00'
|
|
condition:
|
|
- alias: Christmas Season or Light Override Enabled
|
|
condition: or
|
|
conditions:
|
|
- "{{ is_state('binary_sensor.is_christmas_season', 'on') }}"
|
|
- "{{ is_state('input_boolean.holiday_override_lights_morning', 'on') }}"
|
|
action:
|
|
- service: switch.turn_on
|
|
target:
|
|
entity_id:
|
|
- switch.christmas_lights_roof
|
|
- switch.christmas_lights_shrubs
|
|
- switch.christmas_lights_front
|
|
|
|
- alias: Holiday - Turn On Archway Lights in Morning
|
|
trigger:
|
|
- platform: time
|
|
at: '04:30:00'
|
|
condition:
|
|
- alias: Christmas Season or Light Override Enabled
|
|
condition: or
|
|
conditions:
|
|
- "{{ is_state('binary_sensor.is_christmas_season', 'on') }}"
|
|
- "{{ is_state('input_boolean.holiday_override_lights_morning', 'on') }}"
|
|
action:
|
|
- service: light.turn_on
|
|
data:
|
|
brightness_pct: 100
|
|
target:
|
|
entity_id:
|
|
- light.arches_east
|
|
- light.arches_west
|
|
|
|
- alias: Holiday - Turn Off Christmas Lights at Midnight
|
|
trigger:
|
|
- platform: time
|
|
at: '00:00:00'
|
|
action:
|
|
- service: switch.turn_off
|
|
target:
|
|
entity_id:
|
|
- switch.christmas_lights_roof
|
|
- switch.christmas_lights_shrubs
|
|
- switch.christmas_lights_front
|
|
|
|
- alias: Holiday - Turn Off Archway Lights at Midnight
|
|
trigger:
|
|
- platform: time
|
|
at: '00:00:00'
|
|
action:
|
|
- service: light.turn_off
|
|
target:
|
|
entity_id:
|
|
- light.arches_east
|
|
- light.arches_west
|
|
|
|
- alias: Holiday - Turn Off Christmas Lights at Sunrise
|
|
trigger:
|
|
- platform: sun
|
|
event: sunrise
|
|
offset: '-00:30:00'
|
|
action:
|
|
- service: switch.turn_off
|
|
target:
|
|
entity_id:
|
|
- switch.christmas_lights_roof
|
|
- switch.christmas_lights_shrubs
|
|
- switch.christmas_lights_front
|
|
|
|
- alias: Holiday - Turn Off Archway Lights at Sunrise
|
|
trigger:
|
|
- platform: sun
|
|
event: sunrise
|
|
offset: '-00:30:00'
|
|
action:
|
|
- service: light.turn_off
|
|
target:
|
|
entity_id:
|
|
- light.arches_east
|
|
- light.arches_west
|
|
|
|
- alias: Holiday - Turn Off Overrides when Christmas Season Starts
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.is_christmas_season
|
|
to: 'on'
|
|
action:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.holiday_override_lights_night
|
|
- input_boolean.holiday_override_lights_morning
|