For others that had the same issue as I did, here’s my working YAML config under automation:
#Automations
automation:
- alias: "1: Hall light on for 30 secs if TV turned off after dark"
# name: tv_hallway_light_on
trigger:
- platform: state
entity_id: media_player.sony_bravia_tv
to: 'off'
condition:
- condition: state
entity_id: sun.sun
state: "below_horizon"
action:
- service: light.turn_on
entity_id: light.main_light
- delay: 00:00:30
- service: light.turn_off
entity_id: light.main_light