Script delay from sensor value

Hey folks

I have a sensor with an id of timer1 which is a numerical value

I want use this value as the delay in seconds in a script.

Can I do this and can anyone point me an explanation on how I can do this?

Thanks

Automations and Templates — ESPHome

Use the sensor value in a lambda, making sure it’s in milliseconds.

on_...:
  then:
    - delay: !lambda "return (id(timer1).state) * 1000;"