Christmas light

if a little in advance, I would create an automation that works over the Christmas period. this automation should turn on 2 switches switch.plug_158d00010dd879 and switch.plug_158d00013e76ab, the automation should start from December 8th until January 8th and turn on at sunset and turn off at midnight. is an example possible with yaml or node red? thank you

You will need to change the triggers from lux to sunset/midnight and change the disable / enable dates. As well as the switch entity ids.

#################################################################
## Xmas Tree Light Automation
#################################################################

- id: xmas_lights_on
  alias: 'Xmas Lights On'
  trigger:
    platform: numeric_state
    entity_id: sensor.outside_light_level
    below: 660
  action:
    service: switch.turn_on
    entity_id: switch.xmas_tree_lights

- id: xmas_lights_off
  alias: 'Xmas Lights Off'
  trigger:
  - platform: time
    at: '02:00:00'
  - platform: state
    entity_id: binary_sensor.dark_outside
    to: 'off'
  condition:
    condition: state
    entity_id: switch.xmas_tree_lights # only if the lights are on
    state: 'on'
  action:
    service: switch.turn_off
    entity_id: switch.xmas_tree_lights

- id: xmas_lights_enable  # enable xmas lights auto on/off automation on December 1st at midday.
  alias: 'Xmas Lights enable'
  initial_state: true
  trigger:
    platform: time
    at: '12:05:05'
  condition:
    condition: template
    value_template: '{{ now().month == 12 and now().day == 1 }}'
  action:
  - service: homeassistant.turn_on
    entity_id: automation.xmas_lights_on
  - service: homeassistant.turn_on
    entity_id: automation.xmas_lights_off

- id: xmas_lights_disable  # disable xmas lights auto on/off automation on January 6th at midday.
  alias: 'Xmas Lights disable'
  initial_state: true
  trigger:
    platform: time
    at: '12:00:05'
  condition:
    condition: template
    value_template: '{{ now().month == 1 and now().day == 6 }}'
  action:
  - service: homeassistant.turn_off
    entity_id: automation.xmas_lights_on
  - service: homeassistant.turn_off
    entity_id: automation.xmas_lights_off
3 Likes

thank you. this is great