Motion activated floodlight

Hi,

I have a setup with 3 Ubiquiti Cameras integrated into Home Assistant using the integration and a Shelly that turns on a floodlight then waits 30 seconds and turns it off the Shelly which turns off the floodlight.

Here is the current setup:

I have a few issues with this setup such as it will send a turn off request every time there is motion so sometimes the light will flicker.

I'm looking for help on building something where there is a countdown that is reset when there is motion, if that is possible or if it's the best way to do this.

Thanks in advance!

The trigger node can be set to extend it's timeout upon reception of additional messages

I test it and I think it works.

These are my settings which I think work.

Changed to general category.