Input date time format

I have the following rule setup

  trigger:
    platform: template
    value_template: '{{ states.sensor.time.state == states.input_datetime.bedroom_alarm.state }}'

And seems it doesn’t get triggered. Wonder if it is because
states.input_datetime.bedroom_alarm.state returns HH:MM:SS 1:00:00
and
states.sensor.time.state returns HH:MM 1:00

I had the same issue and fixed it like this

trigger:
    platform: template
    value_template: '{{ states.sensor.time.state == states.input_datetime.bedroom_alarm.state[0:5] }}'

so only the HH:MM from states.input_datetime.bedroom_alarm.state will be used.
Not sure though if this is the best solution.