Simple light on and off automation

Hey guys.

I have issues with a simple automation.

I have a motion sensor in my bathroom and a lamp.
In general I plan to create 2 automations.

  1. light to go on when motion is detected
  2. Light to go off after it’s been on for 10 minutes OR light to go off after no motion for 10 minutes.

Right now I tried the first automation but I failed successfully.

The light is turning on after motion is detected but after 20 seconds it goes off.
It seems like the light is connected to the state of the motion sensor. But I thought the motion just trigger the light and no more.

Many thanks in advance.

Check the Automations section here: