The device is new, the problems are old

The device is new, the problems are old.
By using a presence sensor, I thought I would get rid of the older problems that existed when using door opening sensors and motion sensors.
So… It is very important for me to determine the presence of a person in the room as accurately as possible, so I made the minimum acceptable value for determining presence - 1 minute. Next I control the light. I made a script: if there is no movement (and this is, as I wrote, 1 minute), then the delay is 3 minutes and the lights are turned off, even if a person is detected during these 3 minutes. This problem can be partially solved by increasing the detection time, but then the error in visual control of the presence of a person is too large. As discussed earlier, you need to come up with a way to reset the response timer upon re-detection - reopening the doors, if it is a door sensor, and so that this script must work locally - without the Internet.

For local only scene, you can use products like iHost for automations.

But for presence triggers, I would recommend more adjust the position of the sensor, as it does not require long delay for light automation. You can also alter the tolerance/freeze time of the sensor itself, which is more efficient.

for local scenes for zb devices I have zb bridge pro. The position of the presence sensor has nothing to do with it. Once again I will try to explain what the problem is. The scenario is this - IF “no movement is detected”, THEN “delay 3 minutes”, “turn off the lights”. It is necessary to make sure that if a person is detected during these 3 minutes, the timer is reset and the light does not turn off until the person’s absence is detected again. THE “TIMER RESET” FUNCTION IS NEEDED when presence is detected again

That’s more like a moderation to the current trigger?

From

WHEN zone is clear THEN delay 3 minutes - turn off lights

To

WHEN zone is clear for 3 minutes THEN turn off light

If it has to be LAN only, you will have a problem with it. Currently, this cannot be done without the Internet.

Theoretically, it could be possible to do this locally, but it is a complete step beyond the ewelink ecosystem of scenes.

The Sonoff device itself probably won’t be able to handle it. You need to have some central point, such as a server, that will run the logic flow…
I doubt whether devs will implement such functionality.