Based off Smart Life app.
involving my
- PIR1 (door),
- PIR2 (window)
- Laundry Lights switch.
AUTOMATION 1CODE
1. Create Automation named "Laundry Lights Auto OFF".
2. If ALL conditions are met
(a) PIR1 detects no one, AND
(b) PIR2 detects no one, AND
(c) PIR3 detects no one, AND
(d) PIR4 detects no one, AND
(e) Laundry Lights *is* switched ON. (this is here because of Then (a). You don't want Then (a) to switch ON what is otherwise already OFF.)
3. Then
(a) Laundry Lights switches ON. (This to make sure the countdown in (c) will swap into "OFF".
(b) Delay action by 3 seconds. (To make sure the switch's state is properly registered before next processing.)
(c) Laundry Lights countdown 300seconds (supposedly will swap the current "ON" into "OFF".
(d) Disable Automation "Laundry Lights Auto OFF". (Yes, disable its own self.)
4. After saving this Automation, disable it.
AUTOMATION 2CODE
1. Create Automation named "Laundry Lights Auto ON".
2. If ANY condition is met
(a) PIR1 detects motion, OR
(b) PIR2 detects motion, OR
(c) PIR3 detects motion, OR
(d) PIR4 detects motion.
3. Then
(a) Enable Automation "Laundry Lights Auto OFF".
(b) Laundry Lights countdown 0s. (disables any countdown that maybe is already in progress).
(c) Laundry Lights switches ON.
4. After saving this Automation, enable it.
AUTOMATION 3CODE
1. Create Automation named "Laundry Lights Manual OFF".
2. If ALL conditions are met
(a) Laundry Lights *is* switched OFF.
3. Then
(a) Disable Automation "Laundry Lights Auto OFF".
(b) Enable Automation "Laundry Lights Auto ON".
4. After saving this Automation, enable it.
AUTOMATION 4CODE
1. Create Automation named "Laundry Lights Manual ON".
2. If ALL conditions are met
(a) Laundry Lights *is* switched ON.
3. Then
(a) Disable Automation "Laundry Lights Auto OFF".
(b) Disable Automation "Laundry Lights Auto ON".
4. After saving this Automation, enable it.
Algorithm.
1. Always remember, PIR remembers its own "motion detected" for about 2 minutes before it resets and be useful for next "motion detected".
2. The Automation Manual OFF/ON will control whether you allow Automation Auto ON to take effect.
You don't want Automation Auto OFF/ON to wreak havoc if you intentionally and manually switched ON, right?
3. The Automation Auto ON is only enabled by and after Automation Manual OFF.
4. The Automation Auto OFF is only enabled by and after Automation Auto ON.
5. If anyone manually switches OFF before Countdown expires, the switch will forget about the Countdown. This is intentional.
6. DO NOT USE DELAY+EXPLICIT OFF in the Automation Auto OFF; you do not want
(i) the Automation was triggered some time ago, and
(ii) someone actually manually switched ON while the DELAY is still not expiring, and
(iii) ended up in dark after DELAY eventually expires and EXPLICIT OFF is finally processed.
7. If done right, your AUTO ON/OFF will not interfere with manually operating the switch OFF/ON.

edit:
1. swapped order of creating Automation 1 and Automation 2
2. updated image to remove wrong arrow flow.
3. add step for Automation Auto ON to remove countdown possibly already set in-progress by prior Auto OFF invocation.
4. add more PIR3, PIR4 as example if more PIRs or sensors are involved. mmwave?
--
DELAY is pausing processing of the automation ON THE SERVER. It does not take into account if the state of involved devices had changed while it is pausing. you will run unto awkward unintended outcome when processing is resumed.
COUNTDOWN is processed by the device itself, thus allowing it to abort the countdown when its own state changes.
Good information. Will take me some time to digest it.
Anyway, I do agree delay function is mostly makes the scene doesn't work due to some factor. Shall try the countdown function instead.