Help with Lights on at sunset and off at sunrise using below horizon?

I went through quite a few other forum post about lights on and off. I mostly saw actual times being defined. I couldnt find anything with my use case. I was wondering if someone could explain why my automation isnt working?

- id: Exterior - Lights Off / On
  alias: Exterior - Lights Off / On
  description: Exterior - Lights Off / On
  trigger:
  platform: state
  entity_id: sun.sun
  action:
  entity_id: switch.front_landscape_lights  
  service: homeassistant.turn_{{ 'on' if trigger.to_state.state == 'below_horizon'
    else 'off' }}

Well your indentation is all wrong and you need to quote single line templates. Also it is wise to quote strings with special characters like “/” and “-”, though not strictly necessary in this case.

- id: "Exterior - Lights Off / On"
  alias: "Exterior - Lights Off / On"
  description: "Exterior - Lights Off / On"
  trigger:
    platform: state
    entity_id: sun.sun
  action:
    service: "homeassistant.turn_{{ 'on' if trigger.to_state.state == 'below_horizon'
    else 'off' }}"
    target:
      entity_id: switch.front_landscape_lights