Automation Problem

I’m sorry if this is an obvious fix, but I just can’t figure out why this automation isn’t working

alias: Home Outside Lights
trigger:
- entity_id: device_tracker.iphone_j_iphone_j
  from: 'not_home'
  platform: state
  to: 'home'
condition:
  after: sunset
  before: sunrise
  condition: sun
action:
  entity_id: switch.ge_14292_inwall_smart_toggle_switch_switch
  service: switch.turn_on

Deleted the contradicting lines before/after. Just use after:

Alternatively:

condition:
  - condition: state
    entity_id: sun.sun
    state: below_horizon