The car is fine for a while but the battery gets run down and the results are the lights/warnings you report. In some cases the engine will begin to run poorly, misfire and stall. A bit of a rest and the engine can be restarted though the symptoms appear again.
But the symptoms can also be due to a bad MAF. If you want you can disconnect the MAF at the wiring harness, then ideally clear the error codes to reset all the fuel trims to their defaults (among other things) then drive the car as you were before. If the behavior stays away then reconnect the MAF, clear the error codes again, and drive the car and see if the behavior returns.
There is also the possibility of water though generally this causes problems with the car's security system and doors/windows. But it depends upon where the water is getting into. The usual place is into the cabin due to blocked water drains, or doors due to failed window membranes, but if the water is leaking in around the rear trunk it can be wetting the DME which resides back there. Check for dampness in the cabin and in the rear trunk. You might have to remove some carpet to get the DME exposed. Avoid touching it or trying the wiring.