I'm trying to set up a pi + WittyPi4 for an environment where USB power can be intermittent. If the power is out for a short time, the WittyPi4 can keep it running until power is restored, but I don't want to go until the battery drops voltage. If power is out for 30 minutes, I'd like to shutdown until USB power is restored.
I scripted a simple service to monitor POWER_MODE (using the get_power_mode function from utilities.sh file) - after 10 minutes of non-zero POWER_MODE, the service runs
sudo shutdown -h now
I do have the WittyPi set with "Auto-On when USB 5V is connected [Yes]"
Thing is, when I disconnect USB power and wait for 10 minutes for the shutdown command to run, the WittyPi4 turns off the red LED for a moment, then blinks the white LED (once) and restarts the pi from the battery power.
How do I get the pi to stay down until USB power is restored?
Have you previously set the temperature related action? It is better to show the current configuration of your Witty Pi 4 L3V7.
@admin I have not set the Temperature actions, or any other config - "Auto-On when USB 5V is connected" is the only one I checked, and the default action was the behavior I wanted. Similarly, the beforeScript.sh, afterStartup.sh and beforeShutdown.sh scripts are all the default comment blocks.
I have snipped the "switch <-> GPIO 4" trace, after finding that my GPS HAT (Adafruit Ultimate GPS HAT) conflicted with that pin.
Those BASH scripts will not affect anything because your Pi was in shutdown mode and those scripts were not executed. Only the firmware has the ability to wake up your Pi.
After it boots, you can actualy check the startup reason in the wittyPi.log file. It will say "System starts up because ......".
@admin Thanks - I don't know why I didn't think to look in the log file.
I think I might have seen this "won't stay off" behavior while the GPIO 4 trace was still in place, so the wittyPi might have been seeing phantom button presses from the GPS board.