Hi,You need to write a script to execute this command.

Based on this function : [AC power loss and power adapter failure detection via GPIO];

Set to sleep 5 minutes after detecting AC power outage.