How to use sensor value in call service

I am working on setting up an alarm in home assistant. I have a pre alarm time in seconds as a sensor. “pre_wake_seconds_1” So I want to turn on my lights with this value as the transition time. I am trying to use a template in a script but this doesn’t appear to work. I have:

data_template:
  transition: {{states("sensor.pre_wake_seconds_1")}}
entity_id: light.hue_color_lamp_4
service: light.turn_on

But when I do this it keeps setting the transition time to ‘[object Object]’: null

Is there a way to accomplish turning on lights with the transition time as a value from a sensor?

Single line templates must be enclosed in quotes:

transition: '{{states("sensor.pre_wake_seconds_1")}}'