Please help with global variable assigned to update_interval

On my code I am using several global variables and they work fine. However, when I am trying to use a global variable on the code below it doesn’t like it.

   - id: seconds_to_turn
     type: float
     restore_value: yes
     initial_value: '2'

  - platform: ultrasonic
    name:  Obtacle Clearance
    id: ultrasonic_sensor1
    trigger_pin: GPIO05
    echo_pin: GPIO018
      seconds: !lambda 'return id(seconds_to_turn);'
      filter_out: nan
    timeout: 9m

"Doesn’t like it " is not an error message.

Try removing the quotes around your lambda.

The quotes are required. It’s just that you can’t use a lambda there. Unless an option specifically states you can use a lambda, then you can’t.