Shutdown Light

I’ve got the following script, but it doesn’t seem to work, anybody a idea?

input_number:
  auto_light_hour:
    initial: 6
    min: 0
    max: 23
    step: 1
  auto_light_minute:
    initial: 15
    min: 0
    max: 55
    step: 5

sensor:	
  - platform: time_date
    display_options:
      - 'time'
      - 'date'
  - platform: template
    sensors:
      auto_light_hour:
        value_template: '{{ states.input_number.auto_light_hour.state | int }}'
      auto_light_minute:
        value_template: '{{ states.input_number.auto_light_minute.state | int }}'
      auto_light_time:
        value_template: >-
          {{ states.sensor.auto_light_hour.state }}:
          {%- if states.sensor.auto_light_minute.state|length == 1 -%}
            0
          {%- endif -%}
            {{ states.sensor.auto_light_minute.state }}
      auto_light_time_long:
        value_template: >-
          {% if states.sensor.auto_light_hour.state|length == 1 -%}
            0
          {%- endif -%}
            {{ states.sensor.auto_light_hour.state }}:
          {%- if states.sensor.auto_light_minute.state|length == 1 -%}
            0
          {%- endif -%}
            {{ states.sensor.auto_light_minute.state }}   
			
automation:
  - alias: 'Shutdown Light'
  trigger:
    platform: template
    value_template: '{{ states.sensor.time.state == states.sensor.auto_light_time_long.state }}'
  action: 
    service: homeassistant.turn_off
    entity_id: light.slaapkamerlamp