Most of us use a stoptimer (preferably the stoptimer varidelay, as it is the best one) for this.
Example:
If motion=active, stop the OFF timer and turn ON the light.
If motion=inactive, start the OFF timer.
For the part on the right, some people check the current on/off status before sending the command, and some just send the on/off command regardless. Your choice.
On newer flows I don't usually check any more, but I do put in a rate limiter set to something like 1 msg/s to prevent unintended high frequency commands being sent to the hub (which has happened to me a few times in really weird circumstances, so now I prevent that).
Something more like:
And then other times I like to use two switch nodes instead of one to make the layout prettier. No functional difference, though:
Or, if you are a 'node conservationist' you could also use just one command node by setting the msg.command somewhere:
The 3 pictures immediately above all do the exact same thing.
And if you do a lot of motion lighting, you could wrap the whole middle part of the last picture into a subflow.
Which ends up looking nice and tidy like this:

With a subflow of something like this (OFF TIMER time set by an environment variable called "time_delay") that you can re-use anywhere you need motion lighting:




