I made the changes you suggested and reconfigured D2 (GPIO4) to switch1 ... when the sensor detects an object it does a power recycle. Did I overlook something ?
112:15:35.399 MQT: stat/tasmota_DAB78F/RESULT = {"Rule1":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":34,"Free":477,"Rules":"on switch1#state=1 do add1 1 endon"}}
12:15:35.700 CFG: Saved to flash at F9, Count 68, Bytes 4096
12:15:38.920 SRC: Switch
12:15:38.926 MQT: stat/tasmota_DAB78F/RESULT = {"POWER":"ON"}
12:15:38.929 MQT: stat/tasmota_DAB78F/POWER = ON
12:15:39.560 CFG: Saved to flash at F8, Count 69, Bytes 4096
12:15:39.571 SRC: Switch
12:15:39.576 MQT: stat/tasmota_DAB78F/RESULT = {"POWER":"OFF"}
12:15:39.580 MQT: stat/tasmota_DAB78F/POWER = OFF
12:15:40.559 CFG: Saved to flash at F7, Count 70, Bytes 4096
12:15:52.782 WIF: Checking connection...