You have a few error in this automation.
Did you make this using the GUI? because it should have formatted this correctly, but it isn’t.
If you are using a text editor for yaml, you are better off using Studio Code Server Add-On, it helps heaps!
I am not sure what that last “condition” is, I assume it is a default (but i think the trigger.id is going to fail).
But try this:
- alias: 'Scheduled Exterior'
trigger:
- platform: numeric_state
entity_id: sun.sun
attribute: elevation
below: 1.8
- platform: numeric_state
entity_id: sun.sun
attribute: elevation
above: -3.1
- platform: time
id: 'off'
at: 00:00
- platform: homeassistant
event: start
action:
- variables:
e: "{{ state_attr('sun.sun', 'elevation') | float }}"
- choose:
- conditions:
- "{{ e <= 1.8 }}"
- "{{ is_state('light.exterior', 'off') }}"
- "{{ is_state('light.exteriorspecial, 'off) }}"
sequence:
- service: light.turn_on
target:
entity_id:
light.exterior
light.exteriorspecial
- conditions:
- "{{ e >= -3.1 }}"
- "{{ is_state('light.exterior', 'on') }}"
sequence:
- service: light.turn_off
target:
entity_id: light.exterior
default:
- service: {{ 'light.turn_' + trigger.id }}
target:
entity_id: light.exteriorspecial
mode: single