IANAEE. For an on-board application you can create a simple switch with a transistor. https://www.electronics-tutorials.ws/transistor/tran_4.html
To make something wireless you’ll probably want to go with a microcontroller or Raspberry Pi and hook up GPIO pins to the motor controls. A transistor wouldn’t be needed in that case as the microcontroller can hold the pin high or low depending on what state you want.
You mentioned ping. If you’re using Termux you may need to manually update its DNS settings (different from the system DNS). The file is /data/data/com.termux/files/usr/etc/resolv.conf
To make it roam you probably want your home dns first then some internet resolvers after that.