How make automation in Hass.io

How make automation in Hass.io

If light is on turn off after 5 minutes between 18:00- 05:10 or
turn off light after 5 minutes

if i change hass.io generate automation, then face a configuration error or automation not will be available in automation’s list.

here is Hass.io automation.
- action:
- data:
entity_id: light.kitchen
service: light.turn_on
alias: Turn on hallway light after motion detected
condition:
- after: ‘23:30’
before: 07:00
condition: time
id: ‘1514488400344’
trigger:
- entity_id: binary_sensor.fibaro_system_fgms001_motion_sensor_sensor
from: ‘off’
platform: state
to: ‘on’

My automation works like that:

after 35 minutes when light is on that turns it of from 22 to 02

- alias: Magala tuled 35 minutit
  trigger:
    platform: state
    entity_id: light.ii_korrus_magamistuba_soolalamp
    to: 'on'
    for:
      minutes: 35
  condition:
   - condition: time
     after: '21:30:00'
     before: '02:00:00'
  action:
    service: light.turn_off
entity_id: light.ii_korrus_magamistuba_soolalamp