Issuing Shutdown of OS from iPhone App

What is the best way to issue a clean shutdown of the OS from within the iPhone controller app? Thanks!

You can do it in SSH, terminal, sudo shutdown now

That’s how I do it now from ssh. Im asking if it can be automated from within the controller app on my phone.

Which product of sunfounder are you using?

Pidog v2 is my product.

If you’re happy to modify the existing code then probably the easiest way is to hijack any one of the commands in the app control example that you don’t currently require, e.g “lie” and swap for

import os
os.system("sudo shutdown now")