How to add timer to my first automation

New migrant from HE question on how to add timer to my first automation. I made simple automation to turn on my kitchen lights using a motion sensor. Works fine but how can I add timer to turn them off after a specific time. I am not a coder just a simple person.
Any help appreciated.

It can be achieved without using a timer entity and simply relying on a State Trigger’s ability to detect how long a motion sensor’s state value remains unchanged.

In the following example, the light is turned on when motion is detected. The light is turned off when no motion is detected for at least 2 minutes.

I found the code for my automation and there are two statements at the trigger statement that has a “for” statement as follows:
hours: 0
minutes: 0
seconds: 0
Can I change the time from 0 to the time to keep the trigger active?

Yes, you can change it by editing the automation’s YAML code.

If you are using the Automation Editor in Visual mode, it allows you to set the duration of a State Trigger’s for option via the UI.

Thank you!