Smart Ports Power Wire

Would I be able to turn the power on and off in the code with a setup like that?