It works OK, for shutdown a pushbutton long press generates a 500mS pulse to the Pi's GPIO3 which halts the pi OS
Then 15 Secs later, the Pi's power is disconnected after it has fully shut down.
The only problem comes when I forget that the shutdown timer is running and try to power it up again while it's still trying to shut down!
Is there a way to temporarily disable the pb1 switch input while the shutdown timer is active?
on pb1#State do
if %eventvalue% =10 //longpress
if %v2% = 0 and %v1% = 0 //switch is OFF and volts are OK
gpio,5,1 //pi relay power on
let,2,1 //toggle switch status to ON
else
pulse,12,1,500 //pi shutdown signal to gpio3
timerset,2,15 //allow pi to fully shut down before removing power
endif
endon
on rules#timer=2 do
gpio,5,0 // pi power relay off
let,2,0 //toggle switch flag to OFF
endon