# Holiday Package # ----------------------------------------------------------------------------- # 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: - "{{ is_state('binary_sensor.is_christmas_season', '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: - "{{ is_state('binary_sensor.is_christmas_season', '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: - "{{ is_state('binary_sensor.is_christmas_season', '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: - "{{ is_state('binary_sensor.is_christmas_season', '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