Using a sensor in time condition

Hello,

I know there are a few topics out there about that, but I’m unable to solve my automation. With this automation I set the seconds my ceilinglight should shut off after a specific timeframe:

- alias: 'floor_motionsensor_shutoff_mqtt_send'
  trigger:
    platform: state
    entity_id: input_slider.floor_motionsensor_shutoff                    

  action:
    - service: mqtt.publish
      data_template:
        topic: 'hass/motion/floor_motionsensor_shutoff'
        payload_template: '{{ states.input_slider.floor_motionsensor_shutoff.state | int }}'
        retain: 'true'

With that automation I want to shut off my ceilinglight by the motion sensor after that mentioned timeframe, but I don’t know how I can use my sensor:

- alias: light_floor_turn_off_floorled_by_motion
  trigger:
    platform: state
    entity_id: binary_sensor.motion_sensor_158d000128d291
    to: 'off'
    for:
      seconds: !secret floor_motionsensor_shutoff
  action:
    - service: light.turn_off
      entity_id: light.gateway_light_286c0788b78a

Currently as you can see it’s a hardcoded secret. Any hints are really appreciated!