Greetings,
Welcome to the forum.
I am not a HP employee.
Sounds like you have a Intel Management Engine firmware problem which a BIOS update did not correct. Could be a failing BIOS ROM chip or a different MB problem causing this symptom. Or just corrupted microcode caused by constant system shutdowns and erratic behavior.
A faulty power supply can cause stuff like this, something to think about.
You could try resetting CMOS by pulling the CR2032 MB battery. Let the PC sit for about 15 minutes. Do this with no AC power connected to the PC in a static free environment.
Then you may have to have a local PC tech take a look or contact HP Support (Link). Maybe you can get an extended warranty from HP.
Added suggestion: Try recovering the BIOS by following steps at this HP Site (Link).
Regards