Home assistant motion timer

So this is what ive got so far, the motion works and triggers the alert, just need to find a way to turn it off as soon as its triggered…anyone got some simple code? it goes from a curl post request to binary sensor on mqtt platform, is there another way of doing it where it will automatically detect the state once motion is no long detected?

Thanks for you help!