I was thinking about Scriptable after hearing one of the latest automators shows. In particular, methods were mentioned which return the status of the device, like Device.isFaceDown() At first I thought “well, this is pretty cool, I can do a lot with it” but my next thought was “OK, but how do I trigger it?” Without a trigger on change of the hardware condition, this method looks a lot less exciting.
Keyboard Maestro solves this problem on macOS, is there any way to solve it on iOS?
Launch Center Pro can trigger things based on location or time which is something I do a lot of. Unfortunately for everything else you’ll need to have a script running which checks the status.