Tasmota plug: call script via mqtt

I want to setup one of my tasmota flashed sonoffs on my router’s power adapter so that a script can be called via mqtt that toggles the power off, sleeps for 5 seconds, and then toggles back on. Wifi will drop once the power off command goes so I need a script that brings it back on. Any thoughts?

Why call a script ? Tasmota has a fine solution for that : pulsetime. You set the (inverted) pulsetime to 5 seconds.

Invert Pulsetime with
PowerOnState 5 = after a PulseTime period turn relay(s) ON (acts as inverted PulseTime mode)
See tasmota wiki section Commands

1 Like

so i just call poweroff via mqtt and it will switch back on?

Yes it will