My first automation not working

Trying to do my first automation to turn on light when motion detected at the ring door bell. This is what I have:
Trigger
Type State
Entity binary_sensor.front_door2_motion

condition type
Sun
before sunrise
before off set
after sunset

action
type device
device porch light

any ides why it is not working?

Shouldn’t the action be something like…

Call service
Switch turn on
entity ID - porch light

At the moment you don’t seem to be saying what action you want the porch light to perform.

For future reference, though, it’s easier to see what’s going on if you post the code (in this case from automations.yaml). Use the preformatted text option - </> in the toolbar - so that people can see the indentations.

I copied the code and hear it i:

platform: state
entity_id: binary_sensor.front_door_motion

condition: sun
before: sunrise
after: sunset

type: turn_on
device_id: bf0b997d081711eba1ed2b3bbf88b81e
entity_id: switch.porch_light
domain: switch

This is what I mean about indentations:

- id: '1593198645483'
  alias: Yard Light on
  description: Turns on yard light when motion detected while night mode is on
  trigger:
  - device_id: e825f7d38e994046a74c28a59f34f08f
    domain: binary_sensor
    entity_id: binary_sensor.hue_outdoor_motion_sensor_1_motion
    platform: device
    type: motion
  condition:
  - condition: state
    entity_id: input_boolean.night_mode
    state: 'on'
  action:
  - brightness_pct: 100
    device_id: 88b8d307b0c247c2b2fb8ec22616381a
    domain: light
    entity_id: light.hue_outdoor_wall_1
    type: turn_on

yaml is very sensitive to the spaces at the beginning of the lines - it’s difficult for other people to comment usefully if they can’t see them.

There are no indentations show when I open them

p in :

I should edit with the UI to begin with.

Hear it is from th GUI: