Sonoff tasmota basic relay shutdown and restart after x seconds

I set the sonoff with the PowerOnState command to 1 so when I give current the relay is energized automatically. now I would like to create a command that once launched turns off the relay and turns it back on automatically after ‘x’ seconds. there is an important thing when the command is launched, the connection between HA and the sonoff will be lost and then back online after some time. do you have an idea on how to proceed?