If statement in automation

I want to build an automation that is essentially and if else statement. It looks like this can be done with a template but being new to HA I am not understanding how the templates work and am having a hard time following the documentation.

Here is my situation. I have a a group that turns on switches that control some outside Christmas lights. I also have a group that controls outside Christmas figurine blowups. Since I am in the north where we get snow I cover the blow ups up when snow or freezing rain is in the forecast. So i have created an input boolean switch that i can toggle when the blow ups are uncovered. This way if I do not get to uncovering them or i keep them covered due to a storm they are not running if the boolean switch is off.

Here is a run down of what i am looking for with the entity names.

Trigger will be 30 mins prior to sunset
if input_boolean.blowups_good = on
than
switch.turn_on group.xmas_lights and delay 30 seconds (Due to wifi switches being turned on by group.xmas_lights) group.xmas_blowups
else
switch.turn_on group.xmas_lights

Update:
I have been able to figure out the template however I am having a problem with the delay and having it turn on two groups. As long as i have one entity ID in the true part of the statement all works fine but as soon as I add a second ID i get an error along with only adding the delay line with one ID i get an error. I am guess I just dont have the correct syntax.

  • alias: Test If Else Statement for Christmas Lights
    trigger:
    • platform: state
      entity_id: switch.philsoffice_switch
      to: ‘on’
      action:
      service: switch.turn_on
      data_template :
      entity_id: >
      {%- if is_state(“input_boolean.blowups_good”, “on”) -%}
      group.xmas_lights
      delay: 00:00:30
      group.xmas_blowups
      {%- else -%}
      group.xmas_lights
      {%- endif -%}