I think I found the solution. I noticed an energy saver plist with a UID appended to it.
/Library/Preferences/com.apple.PowerManagement.{UID}.plist
In addition to the default
/Library/Preferences/com.apple.PowerManagement.plist
Reading the default plist with my correct system settings gave me
{
"AC Power" = {
"Automatic Restart On Power Loss" = 1;
DarkWakeBackgroundTasks = 1;
"Disk Sleep Timer" = 10;
"Display Sleep Timer" = 0;
"System Sleep Timer" = 0;
"Wake On LAN" = 1;
};
SystemPowerSettings = {
"Update DarkWakeBG Setting" = 1;
};
}
Reading the plist with the UID gave me
{
"AC Power" = {
PrioritizeNetworkReachabilityOverSleep = 0;
"Sleep On Power Button" = 1;
"Standby Enabled" = 0;
TCPKeepAlivePref = 1;
TTYSPreventSleep = 1;
};
}
So I added the "System Sleep Timer" = 0 and "Display Sleep Timer" 0
by the following linesp.
sudo defaults write /Library/Preferences/com.apple.PowerManagement.{UID}.plist "AC Power" -dict-add "System Sleep Timer" 0
sudo defaults write /Library/Preferences/com.apple.PowerManagement.{UID}.plist "AC Power" -dict-add "Display Sleep Timer" 0