# Turn multiple lights on with different colors for holidays / special days

Just in case someone else can benefit, I’m posting my solution to turn 3 lights on with different colors by light and for each holiday. If there are better ways to achieve the same, I’m happy to learn. I (just an amateur) had to combine quite a few different community posts and googling to get the setup working.

In short:

1. Create a sensor for each holiday, with:
• state = date of the holiday
• attributes = rgb code for each light’s sensor entity_id (as a comma separated string)
• For those wanting to include Easter, here’s another post where I got the calculation
``````# Holidays
- trigger:
- platform: time_pattern
# This will update every night, as there is no need to update more than once per day
hours: 1
minutes: 0
- sensor:
- name: "Easter"
icon: mdi:egg-easter
device_class: date
state: >
{% set Y = now().year %}
{% set G = Y % 19 + 1 %}
{% set C = (Y / 100) | int + 1 %}
{% set X = (3*C / 4) |int - 12 %}
{% set Z = ((8*C + 5) / 25) |int - 5 %}
{% set D = (5*Y / 4)|int - X - 10 %}
{% set E = (11*G + 20 + Z - X ) % 30 %}
{% set E = E+1 if (E==25 and G>11 or E==24) else E %}
{% set N = 44 - E %}
{% set N = N+30 if N<21 else N %}
{% set N = N + 7 - (( D + N ) % 7) %}
{% set M = 4    if N>31 else 3 %}
{% set N = N-31 if N>31 else N %}
{{ '%04d-%02d-%02d'%(Y,M,N) }}
attributes:
oprit_1: 255,255,0
oprit_2: 255,255,0
oprit_3: 255,255,0
- name: "Christmas Eve"
icon: mdi:pine-tree
device_class: date
state: "{{ now().year ~ '-12-24' }}"
attributes:
oprit_1: 255,0,0
oprit_2: 255,255,255
oprit_3: 0,255,0
- name: "Christmas Day"
icon: mdi:pine-tree
device_class: date
state: "{{ now().year ~ '-12-25' }}"
attributes:
oprit_1: 255,0,0
oprit_2: 255,255,255
oprit_3: 0,255,0
``````
1. Create a sensor to determine if ‘today’ is one of those holidays
• use a template to determine the holiday sensor entity_id
``````    - name: "Holiday"
icon: >
{% if is_state('sensor.holiday','Easter') %}
mdi:egg-easter
{% elif is_state('sensor.holiday','Christmas Eve') %}
mdi:pine-tree
{% elif is_state('sensor.holiday','Christmas Day') %}
mdi:pine-tree
{% else %}
mdi:party-popper
{% endif %}
state: >
{% if is_state('sensor.easter',now().date()|string) %}
Easter
{% elif is_state('sensor.christmas_eve',now().date()|string) %}
Christmas Eve
{% elif is_state('sensor.christmas_day',now().date()|string) %}
Christmas Day
{% endif %}
attributes:
holiday_entity_id: >
{{ 'sensor.' ~ (states('sensor.holiday')|regex_replace(find='[^\w\*]', replace='_', ignorecase=False)).lower() }}
``````
1. Create a script to turn lights on with the desired color per light
``````alias: Lights - Oprit - Turn on Color
sequence:
- service: light.turn_on
target:
entity_id: light.oprit_1
data:
rgb_color: >-
{{ state_attr(state_attr('sensor.holiday','holiday_entity_id'),'oprit_1').split(',') }}
- service: light.turn_on
target:
entity_id: light.oprit_2
data:
rgb_color: >-
{{ state_attr(state_attr('sensor.holiday','holiday_entity_id'),'oprit_2').split(',') }}
- service: light.turn_on
target:
entity_id: light.oprit_3
data:
rgb_color: >-
{{ state_attr(state_attr('sensor.holiday','holiday_entity_id'),'oprit_3').split(',') }}
mode: single
icon: mdi:wall-sconce-outline
``````
1. Create an automation that triggers the script, when desired

This may help, a script I use that works out if today is a ‘special day’: Special Day