here is what i was thinking of doing in node red untested but you get the idea..i haven't figured out the ON part yet but i got reboot power down.
Code:
[{"id":"20000d95.1907a2","type":"exec","z":"7546b9b.db0b448","command":"sudo shutdown -h now","addpay":true,"append":"","useSpawn":"","timer":"","oldrc":false,"name":"Shutdown Pi","x":630,"y":760,"wires":[[],[],[]]},{"id":"1c00de2f.060cb2","type":"exec","z":"7546b9b.db0b448","command":"sudo reboot","addpay":true,"append":"","useSpawn":"","timer":"","oldrc":false,"name":"Reboot Pi","x":620,"y":700,"wires":[[],[],[]]},{"id":"f097e51f.98a528","type":"rpi-gpio in","z":"7546b9b.db0b448","name":"","pin":"13","intype":"down","debounce":"25","read":false,"x":340,"y":700,"wires":[["db885066.03cf4"]]},{"id":"db885066.03cf4","type":"switch","z":"7546b9b.db0b448","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"str"}],"checkall":"true","outputs":2,"x":470,"y":700,"wires":[[],["1c00de2f.060cb2"]]}]
"There's nothing to build here, but we need to understand how to wake up the Pi from a halt state before we build the shutdown functionality. Simply put, shorting pins 5 and 6 (GPIO3 and GND) together will wake the Pi up from a halt state."